cancel
Showing results for 
Search instead for 
Did you mean: 

Problem enabling RNG on STM32F407

henkdevriesst
Associate II
Posted on March 24, 2016 at 14:16

Hi,

I cannot manage to enable the RNG that is on my STM32F407VG. Using

https://github.com/libopencm3/libopencm3-examples/blob/master/examples/stm32/f4/stm32f4-discovery/random/random.c

, setting the RNGEN bit in RNG_CR does not seem to do anything, neither does setting the IE bit. No matter what I try, RNG_CR, RNG_SR and RNG_DR always all read 0.

It's hard to debug something like this. Any ideas what it could be?

Edit: nevermind, it turned out that having the PLL clock enabled is not sufficient, but that you explicitly have to enable the clock for the RNG peripheral. Thread can be locked/removed.

#rng-stm32f4-stm32f407
6 REPLIES 6
AvaTar
Lead
Posted on March 24, 2016 at 14:39

Interpreting ST's online catalog correctly, it's because the F407 has no RNG.

The F405 and the F417 have.

Nesrine M_O
Lead II
Posted on March 24, 2016 at 15:28

Hi Henk,

I recommend you to have a look to the RNG example under the STM32F4 cube firmware 

STM32Cube_FW_F4_V1.11.0\Projects\STM324xG_EVAL\Examples\RNG

This example guides you through the different configuration steps to ensure RNG random 32bit numbers generation. It has been tested with STM324xG-EVAL board and can be easily adapted to any other supported device and development board.

All STM32F405xx and STM32F407xx products embed an RNG that delivers 32-bit random numbers generated by an integrated analog circuit.

-Syrine-
AvaTar
Lead
Posted on March 24, 2016 at 15:43

>All STM32F405xx and STM32F407xx products embed an RNG that delivers 32-bit random numbers generated by an integrated analog circuit.

 

Then your  website and selection tool at

http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1577/LN11

is incorrect.

Once you select TRNG = YES in the filter, all F407 parts disappear from the list.

Nesrine M_O
Lead II
Posted on March 24, 2016 at 16:47

Hi AvaTar,

You are right. Thank you for bringing this issue to our attention.

It has been reported internally.

-Syrine-

Posted on March 24, 2016 at 17:08

We don't lock or remove threads, as they help resolve future problems

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 15, 2017 at 17:33

In the 'product selection' Table

http://www.st.com/content/st_com/en/product-selector.html

 

(and the Android & iPhone App 'ST MCU Finder' Parametric Search) the STM32F205 and the STM32F207 do not have the TRNG. In F2 Series only F215 and F217 provide TRNG !?!?

But in CubeMX you can select RNG (why not 'TRNG', that's missleading) for that F205 MCUs and a code is generated.

Also in the product description page of F205 we can read:

'... All devices offer three 12-bit ADCs, two DACs, a low-power RTC, twelve general-purpose 16-bit timers including two PWM timers for motor control, two general-purpose 32-bit timers. a true number random generator (RNG). They also feature ...'.

And, also in the data sheet we can read:

'All STM32F2xxx products embed a true RNG that delivers 32-bit random numbers produced by an integrated analog circuit.'

=> The feature lists in the selection table database must be wrong ?!?

B) if someone like to select an MCU by feature selection in the CubeMX 'New Project' generator, a select button for 'TRNG' is not available. The Android & iPhone App is providing this selection feature.

Please add 'TRNG' as a selection choice feature into CubeMX as well

   and rename RNG into TRNG in CubeMX and all MCUs documentation as much as possible.

Thanks for the support.