arch/arm/src/stm32h7/stm32_fdcan_sock: fix clock, ILS register and ID#18300
Open
vrmay23 wants to merge 1 commit intoapache:masterfrom
Open
arch/arm/src/stm32h7/stm32_fdcan_sock: fix clock, ILS register and ID#18300vrmay23 wants to merge 1 commit intoapache:masterfrom
vrmay23 wants to merge 1 commit intoapache:masterfrom
Conversation
linguini1
requested changes
Feb 2, 2026
Contributor
linguini1
left a comment
There was a problem hiding this comment.
Please fill out the PR template
Contributor
Author
I think it is correct now. Could you please check it again? Thank you! |
Contributor
Author
|
@xiaoxiang781216 I have finished the reviews. Thanks for feedback! |
linguini1
reviewed
Feb 2, 2026
Fix three issues in the STM32H7 FDCAN SocketCAN driver: 1. Clock configuration: Allow board.h to override STM32_FDCANCLK. Previously the driver hardcoded STM32_HSE_FREQUENCY, ignoring any board-specific clock configuration. 2. ILS register bug: Fix putreg32 call that was writing FDCAN_ILS_TCL constant instead of the computed regval, causing interrupt routing issues. 3. Extended ID filter size: Increase n_extid from 64 to 128. Despite the reference manual (RM0433) suggesting 64 max, testing shows that 128 is required for reliable extended ID frame reception. With 64, some extended ID frames were silently dropped. Signed-off-by: Vinicius May <vmay.sweden@gmail.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




fix clock, ILS register and ID (extended).
Fix three issues in the STM32H7 FDCAN SocketCAN driver:
Clock configuration: Allow board.h to override STM32_FDCANCLK. Previously the driver hardcoded STM32_HSE_FREQUENCY, ignoring any board-specific clock configuration.
ILS register bug: Fix putreg32 call that was writing FDCAN_ILS_TCL constant instead of the computed regval, causing interrupt routing issues.
Extended ID filter size: Increase n_extid from 64 to 128. Despite the reference manual (RM0433) suggesting 64 max, testing shows that 128 is required for reliable extended ID frame reception. With 64, some extended ID frames were silently dropped.
Note: Please adhere to Contributing Guidelines.
Summary
Fix three critical bugs in the STM32H7 FDCAN SocketCAN driver:
Clock configuration: Allow board.h to override STM32_FDCANCLK. Previously the driver hardcoded STM32_HSE_FREQUENCY, ignoring board-specific clock configurations. This causes incorrect bit timing on boards that use PLL-derived clocks instead of HSE.
ILS register bug: Fix putreg32 call writing FDCAN_ILS_TCL constant instead of the computed regval variable. This is a read-modify-write bug that zeroes other ILS register bits and breaks interrupt routing.
Extended ID filter size: Increase n_extid from 64 to 128. Testing shows the STM32H7 hardware supports 128 filters despite ambiguous documentation. With 64 filters, extended ID frames are silently dropped under load.
Impact
Improves driver reliability and portability. Users with non-HSE FDCAN clocks or heavy extended ID usage will see immediate improvements. Backward compatible with existing configurations.
Testing
Hardware: STM32 Nucleo-H753ZI + external CAN transceiver TJA1051T and TJA1050T.
Peer: Linux PC with PEAK USB-FD adapter
Config: nucleo-h753zi:evaluation
Tools: candump, cansend