cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get can0 interface to appear on STM32MP157f-dk2

IanY
Associate II

Hello,

I am trying to setup CANbus on the STM32MP157f-dk2 board, but I am unable to get any CAN interface to appear. I have installed the STM32MP1 OpenSTLinux Developer-Package onto the board, and I am using an SN65HVD230 transceiver.

First I tried enabling pins PB12 and PB13 for FDCAN2, and connecting the transceiver to GPIO pins 10 and 36 on the board.

For device tree configuration, I generated a device tree source file with STM32CubeMX and copied the pinctrl and m_can2 bindings from the generated file into "stm32mp157f-dk2.dts" located in the kernel sources. I then compiled the device tree using "make ARCH=arm dtbs". I then copy stm32mp157f-dk2.dtb to the board.

I attached the exact dts file I am using.


For driver configuration, I believe the BOSCH M_CAN driver is enabled by default, so I did not change anything in Menuconfig. Although I doubled checked that the selections were correct.

 

IanY_4-1715666366381.png

IanY_5-1715666429018.png

 


The can0 interface does not appear as an available network interface:

root@stm32mp1:~# ls /sys/class/net
end0  lo  usb0 wlan0


I also checked the log messages to see if the driver was properly set up:

root@stm32mp1:~# dmesg | grep CAN
[    0.310964] CAN device driver interface
[    0.361318] NET: Registered PF_CAN protocol family


Then I checked the device-tree on the board and it seems the device is enabled:

root@stm32mp1:/proc/device-tree/soc/etzpc@5c007000# cat can@4400f000/status
okay


Another thing I have tried is setting up FDCAN1 by adding the m_can1 binding to the end of "stm32mp157f-dk2.dts".

&m_can1 {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&m_can1_pins_b>;
pinctrl-1 = <&m_can1_sleep_pins_b>;
status = "okay";
};

This binding will set the pinctrl to pins PA11 and PA12, which connect to pins 5 and 3 of CN2 on the board. However, I am experiencing the exact same issue in this scenario. I see the same log messages as above, and confirmed that the can@4400e000 status is okay.


I started to wonder if maybe the interface will not be available if there is no transceiver connected? I have tried connecting my SN65HVD230 transceiver, but this does not seem to make any difference.

I am also wondering if there is a problem with how I am modifying the device tree sources? Or perhaps there are issues if some other devices are also using the same pins?

I noticed in the post https://community.st.com/t5/stm32-mpus-products/how-to-setup-fdcan-on-stm32mp157f-dk2/td-p/66594 the op said they removed the i2c pullup resistors connected to pins PA11 and PA12. I am assuming they mean they desoldered those resistors from the board? Is that really necessary?

Any help would be greatly appreciated!

10 REPLIES 10
ienecode
Associate III

@xchen

Thank you !

m_can1 and m_can2  works perfectly with DSI display.

The problem with my display was generated by my wrong written application - I had reciving frames based on while loop which on bloking my program.