STM32H7 Zephyr CAN Driver #69073
-
Hello everyone, I currently started with the STM32H747I_disco and CAN. The CAN implementation looks like this: fdcan1: can@4000a000 { I added following devicetree overlay file: / { can_phy2: can-phy2 { &fdcan1 {
The debug terminal sends a error message: "can_stm32h7: CAN pinctrl setup failed (-2)" I want to use the onboard CAN drivers but there isn't a native pinctrl configuration available in the YAML file. Some users have used different drivers like SPI to communicate with a external CAN driver this is not what I want. Am I getting something fundamentally wrong? Is it possible to use STM32 native CAN drivers with Zephyr. I could switch back to the STM32 hal drivers, but I'd rather not. Informations: I'm compiling and running the project on the M4 chip. I hope this information is sufficient to get ahead. Its my first post and I'd really like to get in touch with the community. Best regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Everything in your DTS snippets above look fine, except that you're missing a pinctrl configuration in
Current
It is definitely possible, yes. I am using the FDCAN driver for the STM32H7 myself. |
Beta Was this translation helpful? Give feedback.
That actually was the issue. Thanks! It finally compiles now. And it seems as if packages are being send. :D I'll have to test it with a can module but I think this should work out.
Final overlay file:
#include <st/h7/stm32h747Xi_m4.dtsi>
/ {
chosen {
zephyr,console = &uart8;
zephyr,canbus = &fdcan1;
};
};
&uart8 {
status="okay";
};
&fdcan1 {
pinctrl-names = "default";
pinctrl-0 = <&fdcan1_rx_pb8 &fdcan1_tx_pb9>;
bus-speed = <125000>;
bus-speed-data = <1000000>;
status = "okay";
};
Kconfig:
CONFIG_GPIO=y
CONFIG_CAN=y
CONFIG_CAN_FD_MODE=y
CONFIG_CAN_STM32H7_FDCAN=y
CONFIG_ISOTP=y
CONFIG_REBOOT=y
CONFIG_LOG=y
CONFIG_DEBUG=y
CONFIG_CONSOLE=y
CONFIG_…