Hello… I am trying to send CAN frame using python (imx8) on can0 channel of eval board and read the same frame back. Have shorted Can_tx and Can_rx pins of the same channel.
Python prog shows frame sent on the the can0 channel but not able to read it back. Using msg=bus.recv(1) Am I missing any fundamental hardware or software functionality for CAN.
Please advise.
Thanks,
Shardul
Greetings @ShardulC,
How have you configured the can0
channel?
Also have you taken a look at the CAN example on Torizon here: How to Use CAN on TorizonCore | Toradex Developer Center
Finally have you properly added terminating resistors to your CAN setup?
Best Regards,
Jeremias
@jeremias.tx tried ip link set can0 up with bitrate if that’s the right configuration… and then ran basic python CAN prog to send frame on can 0 tx pin and receive it back on its rx pin…
Haven’t used terminating resistors, will check that.
Thanks,
Shardul
A basic configuration as shown in the article I linked should work.
Please apply terminating resistors to your setup. These are generally almost always required for any CAN setup.
Best Regards,
Jeremias
Aren’t the terminating resistors part of CAN Setup on apalis eval board ? (which includes CAN ports/interfaces, can transciever, Dc/Dc Power supply, digital isolators )
Thanks,
Shardul
Configured can0 using:
ip link set can0 type can bitrate 500000
ip link set can0 up
Output :
can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
Next command sent :
cansend can0 123#DEADBEEF
but not able to see anything on CRO connected to CAN1_TX pin on Eval Board
I don’t believe they are. You’ll need to add the terminating resistors yourself.
Do you see any kernel messages or see anything in dmesg
that might suggest some kind of error?
Also was your previous test with terminating resistors?
Finally can you provide further details on how you’ve setup the connection hardware-wise. For example what exact pins you have connected to each other and any other related details.
Best Regards,
Jeremias
Thanks @jeremias.tx. Adding terminating resistor worked just fine. Able to transmit and receive messages from can ports.
Thanks,
Shardul
Glad we were able to help resolve this issue for you!