2025-01-31 01:43 AM - edited 2025-01-31 01:48 AM
Hi,
I would like to use CAN communication on my devboard : STM32MP157f-DK2.
So I prepared OS, unfortunatelly I have to flash STM32MP157c-DK2 version according with problem described below:
So, after run OS, I edited *.dts file, by initialized &m_can1 device on PA11 and PA12 pins, which one exposed on the board connector - CN2, and connected "MCP2542 click CAN bus transceiver" board.
In OpenSTlinux userspace I try recive CAN frames by command: candump can0, and there is any problem, because when I send full frame with 8 bytes that it doesn't arrive to device. Maksimum only 5 bytes in frame arrives, like below:
What can be wrong with CAN in STM ?
Please for any tips.
2025-02-04 08:41 AM - edited 2025-02-04 08:53 AM
@SofLit you're right. The STM32MP1 support FDCAN interface, and when I try turn off I get message:
root@stm32mp1:~# ip link set can0 type can bitrate 500000 dbitrate 1000000 fd off
RTNETLINK answers: Operation not supported
According with my knowledge frames with CAN2.0 can send to CAN FD. If I'm wrong please correct me.
What I discovered during the tests....
Originally I test my CAN communication with according with below set up socketCan interface:
ip link set can0 type can bitrate 500000 dbitrate 2000000 fd on
And Like I descirbed I had a problem, where only max 5 bytes data in frame arrive to STM32 from my test application.
Now I test communication on 1M bitrate:
ip link set can0 type can bitrate 1000000 dbitrate 2000000 fd on
and the communication working, the CAN2.0 frames with 8 bytes payload data arrvied to STM32!
So, maybe now anybody can help me solve problem with 500kBaud transmission problem ? what could it be caused by?
2025-02-04 11:58 AM - edited 2025-02-04 12:02 PM
I don't have idea how to configure the MPU environnement. But according to
ip link set can0 type can bitrate 500000 dbitrate 2000000 fd on
Seems the FDCAN is activated: 500000b/s is the nominal bitrate and the 200000b/s is for the data phase bitrate. And your sender doesn't support that frame. SO you need to find how to set the FDCAN interface in CAN2.0.
So, you need to trun off the FDCAN mode: I think (I'm not sure):
ip link set can0 type can bitrate 500000 dbitrate 2000000 fd off
-> for a nominal bitrate of 500kb/s where fd mode is off.
or try:
ip link set can0 type can bitrate 500000 fd off
or
ip link set can0 type can bitrate 500000
2025-02-04 12:03 PM
See this thread:
ip link set can0 type can bitrate 500000
ifconfig can0 up