Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SeeedBus does not transmit bus messages #1691

Open
RyanHope opened this issue Nov 14, 2023 · 2 comments
Open

SeeedBus does not transmit bus messages #1691

RyanHope opened this issue Nov 14, 2023 · 2 comments
Labels

Comments

@RyanHope
Copy link

Describe the bug

SeeedBus can be used with the logger and viewer scripts but data transmitted via it does not seem to actually reach the canbus.

To Reproduce

I have both a Kvaser Leaf and a SeeedStudio adapter connected to the same bus which is connected to an motorcycle ECU.
If use can.logger to sniff the bus with seedstudio and transmit the commands below, the seedstudio adapters records the messages and the response. If I reverse things and log with kvaser and transmit with seeedstudio, nothing shows up in the logger at all.

import can
# with can.Bus(interface='kvaser', channel=0) as bus:
with can.Bus(interface='seeedstudio', channel='COM12') as bus:
    msg = can.Message(arbitration_id=0x18da10f1, data=[0x02, 0x3e, 0x80, 0x55, 0x55, 0x55, 0x55, 0x55], is_extended_id=True, is_rx=False)
    bus.send(msg)
    recv_msg = bus.recv(timeout=1.0)

    msg = can.Message(arbitration_id=0x18da10f1, data=[0x02, 0x3e, 0x00, 0x55, 0x55, 0x55, 0x55, 0x55], is_extended_id=True, is_rx=False)
    bus.send(msg)
    recv_msg = bus.recv(timeout=1.0)

Expected behavior

> python -m can.logger -i seeedstudio -c COM12
Connected to SeeedBus: Serial interface: COM12
Can Logger (Started on 2023-11-13 20:58:35.139360)
Timestamp: 1699927130.034850    ID: 18da10f1    X Rx                DL:  8    02 3e 80 55 55 55 55 55
Timestamp: 1699927131.046703    ID: 18da10f1    X Rx                DL:  8    02 3e 00 55 55 55 55 55
Timestamp: 1699927131.051705    ID: 18daf110    X Rx                DL:  8    02 7e 00 aa aa aa aa aa

Additional context

OS and version: Win10
Python version: 3.8 32bit
python-can version: 5c1c46f
python-can interface/s (if applicable): seeedstudio

@RyanHope RyanHope added the bug label Nov 14, 2023
@tsabelmann
Copy link

For me it looks like that the SeeedStudio interface is not implemented properly - I mean a normal recv function like in the other interface modules is missing. Additionally, the SeeedStudio interface supports two protocols - 20 bytes fixed-size and a variable-length byte-sized protocol. Maybe, if you want, you could implement the missing parts. Feel free to reach out.

@vChavezB
Copy link

vChavezB commented Mar 6, 2024

I have found that if I add a delay after the init frame it works

so in practice I initialize the seedstudio can interface and add a delay :

 can.interface.Bus(bustype='seeedstudio',
                                     channel=self.com_port,
                                     baudrate=2000000,
                                     bitrate=500000,
                                     frame_type='STD',
                                     operation_mode='normal')
time.sleep(0.1)                                     

For some reason it seems that if not, the serial write does not send correctly the initialization frame. I tried a direct flush with self.ser.flush() in the Seedstudio class but that doesnt work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants