2024-04-18 03:28 AM - edited 2024-04-18 03:29 AM
Hello,
I am using a STM32MP157C development board from Myirtech and trying to interface the board with a CAN device.
I am able to bring up the can0 interface. It can send data, I can see it from oscilloscope over Can Hi and Lo pins. The dmesg output is below:
[ 1.687071] can: controller area network core (rev 20170425 abi 9)
[ 1.687246] can: raw protocol (rev 20170425)
[ 1.687258] can: broadcast manager protocol (rev 20170425 t)
[ 1.687277] can: netlink gateway (rev 20190810) max_hops=1
[ 1.846934] stm32-dma 48000000.dma: no dma pool: can't use MDMA: 0
[ 1.849379] stm32-dma 48001000.dma: no dma pool: can't use MDMA: 0
[ 4.300816] m_can_platform 4400e000.can: m_can device registered (irq=54, version=32)
...
[ 138.115515] m_can_platform 4400e000.can can0: bitrate error 0.3%
[ 138.115550] m_can_platform 4400e000.can can0: bitrate error 0.3%
[ 140.445788] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
But when the device on the can bus sends data, the board does not receive anything. (I am checking by using candump can0)
Any help would be appreciated.
Thank you.
Best regards,
Mert
Solved! Go to Solution.
2024-04-19 11:41 PM
I recently worked on this, but most of my work is related to J1939 protocol.
Did you have CAN Transceiver hooked up?
Also can you try typing this command. It will give you stats about if frames are dropped or received.
board$> ifconfig -a
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:30
Can you connect savycan or any can terminal to BMS device to see if you're getting messages. This is sanity check just to check if baud rate 500k you selected works. if not play with the baud rate.
2024-04-18 10:04 AM
The remote device is a BMS. Both sides have bus termination resistors of 120 ohms. The baud rate is 500Kbps.
The device sends data continuously. As I suspect, the remote side (STM32MP1) is not sending ACK signal.
The screen above shows Can Hi and Lo signals.
Best Regards,
Mert
2024-04-19 11:41 PM
I recently worked on this, but most of my work is related to J1939 protocol.
Did you have CAN Transceiver hooked up?
Also can you try typing this command. It will give you stats about if frames are dropped or received.
board$> ifconfig -a
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:30
Can you connect savycan or any can terminal to BMS device to see if you're getting messages. This is sanity check just to check if baud rate 500k you selected works. if not play with the baud rate.
2024-04-20 01:01 AM
The problem is solved, it was a baud issue.
Thank you.
Best regards,
Mert