I am trying to communicate Pican3+Raspberry Pi 4(Device 1) with canoe in my laptop(Device 2). I am using python can isotp module in raspberry pi. I am able to send data from my code in raspberry pi to canoe, but not able to receive the data send from Canoe to raspberryPi to the isotp.socket I created in my python code. But the data is received in the raspberry pi end, verified with candump. Below is the code used.
import isotp
s = isotp.socket()
s.bind("can0", isotp.Address(rxid=0x701, txid=0x708))
s.send(b'a')
while True:
da = s.recv()
if da is not None:
print('here')
print(da)
The message sent from canoe has message ID 701 and standard can frame. In my understanding the socket is bind to receive the message with ID 701 from can0 channel. Am I missing anything? Screenshot of the message composed in canoe and the candump from raspberry is attached, please have a look.
There is no issue in the code and it is working fine. The issue was on the other end where I was trying to send the CAN frame from Canoe in my laptop to the PICAN. The frame was not created as per the ISO TP format, because of that the iso tp layer in raspberry pi linux could not process it. Once I formulated the CAN frame as per isotp the socket created as in the code receive and processed data. For more information on ISO TP protocol check https://www.emotive.de/wiki/index.php?title=ISOTP