2021-07-24 03:41 PM
Hello,
I'm having trouble using the RNG peripheral on the STM32F207.
I'm using the HAL functions to set things up and I keep getting back the same number. I've made sure to enable the RNG Clock. See the steps below:
__RNG_CLK_ENABLE()
__HAL_RNG_ENABLE()
HAL_RNG_GetRandomNumber()
The polling doesn't time out, it just keeps returning the same number. I've tried to enable the interrupt as well and the interrupt never arrives.
What am I doing wrong?
Thank you
2021-07-25 01:05 AM
Rewrite your code for direct register access, at least the directly RNG related part - that's fairly easy, just enable RNG, and then check status bit and if set, read out data.
You should get a debugger, makes life easier (although sometimes can get into way, too).
JW
2021-07-25 07:13 AM
Figured out the problem... I was never setting the Instance of the RNG handler to point to the base of the RNG peripheral so it was never getting enabled. :|
Thanks for all your help.