arch/arm/src/stm32h5: add support for HW RNG.#18549
arch/arm/src/stm32h5: add support for HW RNG.#18549xiaoxiang781216 merged 1 commit intoapache:masterfrom
Conversation
|
Hi @csanchezdll, please align CMake with Make add stm32_rng.c |
7742cff to
8da0f93
Compare
8da0f93 to
6f0196c
Compare
|
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. |
|
Hi @csanchezdll, please fix |
6f0196c to
2d96fed
Compare
|
It seems the checks failed for external reasons: I have checked other runs of the same build job Linux (arm-05) on other PRs and it runs well, so I guess this is a transient error. |
Driver copied from stm32f7, which includes CEIS/SEIS clearing per reference manual. Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
|
Hi @csanchezdll, I restarted the failed jobs |
2d96fed to
c0f97b5
Compare
|
Sorry @simbit18 I read it just after re-pushing. No way I can stop it now. I will be more patient next time, knowing that can be done. |
|
@csanchezdll Don't worry. You just have to wait three hours now and be a little more patient!!! :) |
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: