cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN / Zephyr issue

zeek-atc
Associate

Custom board. STM32U5G9.

I am running Zephyr and trying to use PB8 and PB9 for the FDCAN peripheral. In loopback mode, it does not get any errors but in normal mode it does.

The odd thing is that if I change the pins in the dts file to PA11 and PA12, it works fine. 

I am guessing that it is a timing/clock issue or something but I have been arguing with this for two days and I am out of ideas.

The device tree entry is:

&fdcan1 {
// pinctrl-0 = <&fdcan1_rx_pb8 &fdcan1_tx_pb9>;
pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>;
pinctrl-names = "default";

bus-speed = <250000>;
bus-speed-data = <250000>;

status = "okay";

can-transceiver {
max-bitrate = <250000>;
};
};

If I uncomment the first pinctrl (pb8 & pb9) I see no output on the TX GPIO pin (PB9). If it is configured as shown, I do see packets on PA12.

 

Thanks!

3 REPLIES 3
mƎALLEm
ST Employee

Hello @zeek-atc and welcome to the ST community,

I'm not zephyr expert so please don't ask me how to configure CAN in zephyr. 

Meanwhile, if you have issues in Normal mode but no issues in loopback mode, there are almost three main reasons to check:

- Bitrate mismatch: the nodes on the bus are not communicating at the same bitrate.

- A hardware issue: an issue with the tranceiver: bad connection, tranceiver not well powred, bad connection, terminating resistors are missing. Tranceiver is set in standby mode (according to the tranceiver used) .Or you are not connecting to the effective CAN_Tx/Rx IOs you have configured in your software. Or something connected externally to the CAN pins in your hardware.

- HSI used instead of HSE with an external crystal. For Normal mode you need to use a crystal or any other precice clock.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
zeek-atc
Associate

Thank you for your reply. The main issue is that I have no activity on the TX pin in normal mode. In loopback mode I do see traffic on the TX pin (PA12).

 

Another odd thing is that I do not see any activity in either mode if I select the TX pin that we actually need (PB9). This is very perplexing. What could cause one pin to work but another pin to not work?

 

What registers select the clock sources for the FDCAN peripheral? 

 

Thanks a million!

As I said previously check if you have something connected to PB9 apart of the tranceiver.

Check also if PB9 IO pin itself is working. Toggle it. If it doesn’t toggle that means the IO is broken.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.