-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Description
Summary
The STM32H7S78-DK board under Zephyr currently doesn't support FDCAN or better said doesn't have it enabled by default.
This is due to FDCAN1 and FDCAN2 pins already being used by something else.
In the table bellow I will list all the pins that can be used for FDCAN1 and FDCAN2 and what already uses them.
Resources for information this are stm32h7s78_dk-common.dtsi, stm32h7s7l8hxh-pinctrl.dtsi and board's datasheet (Table 22, Pages 132-137).
FDCAN1:
| Pin | Functionality | State |
|---|---|---|
| PA11 | RX | Taken by ltdc |
| PB8 | RX | free |
| PD0 | RX | Taken by uart4 |
| PA12 | TX | Taken by ltdc |
| PB9 | TX | Taken by i2c1 |
| PB1 | TX | Taken by uart4 |
FDCAN2:
| Pin | Functionality | State |
|---|---|---|
| PB5 | RX | Taken by timer3 |
| PB12 | RX | Taken by ltdc |
| PB1 | TX | free* |
| PB6 | TX | Taken by i2c1 |
| PB13 | TX | Taken by ltdc |
*Taken by mac in #99296
Describe the solution you'd like
I propose an addition of something like this (of course adapted to this board):
zephyr/boards/waveshare/open103z/waveshare_open103z.dts
Lines 160 to 169 in db0c34d
| &can1 { | |
| pinctrl-0 = <&can_rx_remap1_pb8 &can_tx_remap1_pb9>; | |
| pinctrl-names = "default"; | |
| /* | |
| * make sure CAN and USB are not enabled at the same time | |
| * because they share interrupts 19, 20 (stm32f103Xb.dtsi) | |
| * reference: RM0008 rev20 page 205 | |
| */ | |
| status = "disabled"; | |
| }; |
to the stm32h7s78_dk-common.dtsi.
This way the user can enable FDCAN without needing to first find the pins in datasheet or pinctrl file, which makes it easier and less complex. The user can add FDCAN support with an overlay like this:
| /* This board disables can1 by default in favor of USB. */ | |
| &can1 { | |
| status = "okay"; | |
| }; | |
| &usb { | |
| status = "disabled"; | |
| }; |
The main question is what to disable, aka which pins to select for FDCAN1 or FDCAN2.
ltdcpins are used for display.i2c1pins are used for touch, for the display.uart4is used for console and shell.
Note that I already successfully tested the can/counter sample with FDCAN1 using pa11 and pa12 pins, with display not in use.
Would an addition like this be good? Or does it indirectly introduce more complexity into stm32h7s78_dk-common.dtsi?
If this addition is welcome, I would be happy to open a PR for this, with specified pins.