Using a CAN interface to send data to the Autopi from my pc

I am trying to setup a PC CAN simulation environment with the Auto PI,
on the PC side I am using a Peak CAN interface to send messages to the Autopi using the Python CAN API, but the Autopi does not seem to read any data when I use OBD.dump,

on the other hand, I am able to read frames from the Autopi (with the same API and setup…) also when using it on my CAR, the autopi can read data straight away.

So I am not sure what could be the issue when trying to send CAN data from the PC? can any one help with this. @Peter , @Malte , @Nikola

I have exactly the same setup(USB to Peak CAN interface connected to the OBD interface) too and trying to send CAN message using cansend (from can-utils package on a PC) to Autopi.
I have the obd.protocol set to 33 and verified the bus state is connected and protocol is enabled using the obd.status command before issuing obd.dump command.
There are no messages seen with obd.dump.

Instead obd.dump results in the following error message:-

error: 'Unable to verify connectivity of protocol ‘‘auto’’: Unable to connect because
** no supported protocol found’**

For this error the corresponding log seen in /var/log/salt/minion is as below:-


Traceback (most recent call last):
File “/var/cache/salt/minion/extmods/utils/messaging.py”, line 778, in process_event
res = self.process(message)
File “/var/cache/salt/minion/extmods/utils/messaging.py”, line 106, in process
result = func(message, **settings)
File “/var/cache/salt/minion/extmods/utils/messaging.py”, line 117, in shared_worker
found, result = self._call_hook_for(message, “workflow”, message)
File “/var/cache/salt/minion/extmods/utils/messaging.py”, line 433, in _call_hook_for
return True, func(*args, **kwargs)
File “/var/cache/salt/minion/extmods/utils/messaging.py”, line 317, in extended_workflow
_, result = self._call_hook_for(message, “handler”, *args, **kwargs)
File “/var/cache/salt/minion/extmods/utils/messaging.py”, line 433, in _call_hook_for
return True, func(*args, **kwargs)
File “/var/cache/salt/minion/extmods/utils/messaging.py”, line 522, in synchronizer
return func(*args, **kwargs)
File “/var/cache/salt/minion/extmods/engines/obd_manager.py”, line 516, in dump_handler
conn.ensure_protocol(protocol, baudrate=baudrate, verify=verify)
File “/var/cache/salt/minion/extmods/utils/obd_conn.py”, line 27, in decorator
return func(self, *args, **kwargs)
File “/var/cache/salt/minion/extmods/utils/obd_conn.py”, line 263, in ensure_protocol
self.change_protocol.undecorated(self, ident, baudrate=baudrate, verify=verify) # No need to call the ‘ensure_open’ decorator again
File “/var/cache/salt/minion/extmods/utils/obd_conn.py”, line 220, in change_protocol
self._obd.change_protocol(ident, baudrate=baudrate, verify=verify)
File “/usr/local/lib/python2.7/dist-packages/obd/obd.py”, line 200, in change_protocol
ret = self.interface.set_protocol(protocol, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/obd/interfaces/stn11xx.py”, line 266, in set_protocol
ret = super(STN11XX, self).set_protocol(ident, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/obd/interfaces/elm327.py”, line 471, in set_protocol
self._protocol = self._auto_protocol(**kwargs)
File “/usr/local/lib/python2.7/dist-packages/obd/interfaces/elm327.py”, line 893, in _auto_protocol
res_0100 = self._verify_protocol(“auto”, test=not verify)
File “/usr/local/lib/python2.7/dist-packages/obd/interfaces/elm327.py”, line 845, in _verify_protocol
raise ELM327Error(msg, code=line)
ELM327Error: Unable to verify connectivity of protocol ‘auto’: Unable to connect because no supported protocol found
2021-01-20 13:02:55,552 [salt.loaded.ext.engines.api_service:27 ][ERROR ][749] exception occurred: Unable to verify connectivity of protocol ‘auto’: Unable to connect because no supported protocol found


I see exactly same error reported in 1 of the Autopi troubleshooting section called " Constant salt/minion log messages",but unable to view any reply or response posted to that query.

Please help understand the cause of issue and solution to enable send/receive of CAN messages.

1 Like

When protocol and baudrate options are passed to obd.dump command (as below) as compared to setting protocol explicitly using obd.protocol command,the error reported previously is not seen and the test data is now visible on the Autopi

autopi obd.dump protocol=31 baudrate=500000 raw_response=True duration=10

The cause of error seems that obd.dump is not picking the value set by obd.protocol.

Hi @SBJ

Thank you for reporting this. We are having a hard time reproducing this.

Could you send a message to support@autopi.io with the issues you are seeing?

Please also include the steps you’ve done to reproduce it, this would make it much easier for us.

Thanks
/Peter

the cause of the issue is that the baud rate of the CAN interface is set to a value that is lower than what’s needed to interface HS-CAN,
try:

  • obd.connection baudrate=2304000

should solve your problem, this took me a lot to discover, I hope it helps.

1 Like

Many thanks, this has helped me a lot. I am pleased and amazed how you worked this out.