arch/arm/src/stm32h5: add support for HW RNG.#18549
Open
csanchezdll wants to merge 1 commit intoapache:masterfrom
Open
arch/arm/src/stm32h5: add support for HW RNG.#18549csanchezdll wants to merge 1 commit intoapache:masterfrom
csanchezdll wants to merge 1 commit intoapache:masterfrom
Conversation
Contributor
|
Hi @csanchezdll, please align CMake with Make add stm32_rng.c |
7742cff to
8da0f93
Compare
xiaoxiang781216
previously approved these changes
Mar 18, 2026
8da0f93 to
6f0196c
Compare
Contributor
Author
|
RNG requires HSI48, so I did not want to make it unconditional (some scenarios might prefer that clock disabled). Also I had to modify slightly the logic that enables that clock in RCC initialization. |
Contributor
|
Hi @csanchezdll, please fix |
Driver copied from stm32f7, which includes CEIS/SEIS clearing per reference manual. Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
6f0196c to
2d96fed
Compare
simbit18
approved these changes
Mar 18, 2026
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.
Driver copied from stm32f7, which includes CEIS/SEIS clearing per reference manual.
Summary
STM32H5 MCUs have a random number generation. According to the datasheets, the whole family has it, so there is no need
to make the change conditional on specific part number as other families (STM32H7, for example, do).
There are two slightly different implementations of the RNG driver. One is used in plain stm32, stm32h7,and stm32f0l0g0: when error flags SEIS/CEIS are set it just reads DR again. The other is used in stm32f7 and stm32l4: it clears those flags and disables/re-enables RNG on failure. This second one is the correct procedure according to the manual, so I have made stm32h5 one used that one (copies from stm32f7).
Impact
This change will affect all STM32H5 platforms, making /dev/random appear and /dev/urandom support available for selection using Kconfig.
Testing
Host:
Board is NUCLEO-H563ZI
Tested using nsh to get random numbers from RNG.
Build:
NSH prompt: