maxikrie opened a new pull request, #22023: URL: https://github.com/apache/nuttx/pull/22023
## Summary `nucleo-h753zi:socketcan` and `nucleo-h743zi2:socketcan` boot without any CAN interface: ``` fdcan_bittiming: Target bitrate too high - no solution possible. fdcan_bittiming: Target bitrate too high - no solution possible. nsh> ifup can0 ifup can0...Failed ``` Both boards clock FDCAN from the 8 MHz HSE (board.h already said "TODO: Not the best choice for this board?"). `STM32_FDCAN_SOCKET` selects `NET_CAN_HAVE_CANFD` and `NET_CAN_CANFD` defaults to y, so the driver uses `CONFIG_FDCANx_ARBI_BITRATE=100000` and `CONFIG_FDCANx_DATA_BITRATE=4000000`. At 8 MHz the data phase has 2 time quanta per bit, `fdcan_bittiming()` returns an error, `stm32_fdcansockinitialize()` returns before `netdev_register()`. This PR enables PLL2's Q output (VCO2 800 MHz / 10 = 80 MHz) and selects it as the FDCAN kernel clock (`RCC_D2CCIP1R_FDCANSEL_PLL2`, `STM32_FDCANCLK`), like `stm32h735g-dk`. 80 MHz gives an exact bit time for 100k, 125k, 250k, 500k and 1M nominal and for 4M data phase. PLL2 already runs for the ADC (PLL2P), so no new PLL is started. ## Impact nucleo-h743zi2 and nucleo-h753zi (identical boards, the two `board.h` files differ only in the name and a TIM8 pin). FDCAN on both now runs from 80 MHz instead of 8 MHz; the socketcan configs work. The FDCAN character driver (`stm32_fdcan.c`) also uses `STM32_FDCANCLK`. PLL2Q is new and only used by FDCAN. No other clocks change. ## Testing NUCLEO-H753ZI, master fc8d354f9a, Arm GNU Toolchain 13.3.Rel1. `nucleo-h743zi2:socketcan` was built too, and runs on this board (same die, H753 = H743 + crypto). `tools/checkpatch.sh` passes. No transceiver on the board, so the frame test uses FDCAN internal loopback (`CONFIG_STM32_FDCAN_LOOPBACK_INTERNAL`, added for the test only). | | master | this PR | |---|---|---| | boot | `fdcan_bittiming: Target bitrate too high` x2 | no error | | `ifconfig` | no can0/can1 | can0, can1 | | `ifup can0` | Failed | OK | | RCC: PLL2RDY, DIVQ2EN, PLL2DIVR.Q, FDCANSEL | - | 1, 1, /10 (80 MHz), PLL2 | | FDCAN1 NBTP / DBTP | - | BRP 50, 1+13+2 tq = 100.000 kbit/s (SP 87.5 %) / BRP 2, 1+8+1 tq = 4.000 Mbit/s | | internal loopback, 3 x 20000 classic frames (test app, HP work queue, 64 IOBs) | no interface | 60000/60000 received, in order, no corrupt frames | <details><summary>this PR</summary> ``` nsh> ifup can0 ifup can0...OK nsh> ifconfig can0 Link encap:UNSPEC at RUNNING mtu 72 can1 Link encap:UNSPEC at DOWN mtu 72 ``` ``` RCC_CR=0x0f07c035 RCC_PLLCFGR=0x001f0088 RCC_PLL2DIVR=0x00094ec7 RCC_D2CCIP1R=0x20000000 FDCAN1 NBTP=0x00310c01 DBTP=0x00010700 CCCR=0x00000300 ``` </details> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
