2020-08-07 10:12 AM
I am configured both the FDCAN interfaces on the STM32MP1 discovery board with the settings below using STM32CubeMX.
FDCAN1: PA11 (RX) PA12 (TX)
FDCAN2: PB12 (RX) PB13 (TX)
But I can't seem to get any data from either interface. I have a logic analyzer connected and have verified that there are packets going to the discovery board but candump doesn't show anything and cansend doesn't seem to be sending out any frames.
I also use the following command to turn on each interface.
ip link set can0 type can bitrate 500000
ifconfig can0 up
Am I missing something in the settings?
Thanks,
2020-08-10 05:56 AM
Looking further into the problem it seems to be caused by the FDCAN pins not being initialized.
When I put the can interface into loopback mode I am able to see the packets that I send. But when I do a physical loop back connecting RX to TX I don't see anything.
Is there a reason certain gpio would not be configured correctly at boot? And are there work around?
2020-08-10 08:52 AM
So removing the "sleep" from the device tree of the both kernel and u-boot seemed to have fixed it.
&m_can2{
pinctrl-names = "default", "sleep";
pinctrl-0 = <&fdcan2_pins_mx>;
pinctrl-1 = <&fdcan2_sleep_pins_mx>;
status = "okay";
/* USER CODE BEGIN m_can2 */
can-transceiver {
max-bitrate = <5000000>;
};
/* USER CODE END m_can2 */
};
2021-01-11 12:40 PM
Hi @ASuar.1
I'm sorry you're having issues with CAN. I am seeing the exact same issue. Your post saved me a lot of time, and my client a lot of money. Thank you! I wish somebody at ST would take a look and fix the underlying problem.
This is my workaround for CAN1:
&m_can1 {
- pinctrl-names = "default", "sleep";
+ pinctrl-names = "default";
pinctrl-0 = <&m_can1_pins_b> ;
- pinctrl-1 = <&m_can1_sleep_pins_b>;
status = "okay";
}