2020-07-19 09:42 PM
2020-07-20 12:23 AM
> can i use random number generate function or is there any alternative way
The stm32f401re doesn't have true random generator hardware (RNG or TRNG) on chip which can be used for some crypto algortihms. There is an app note AN4230 Application note telling you more about RNG.
The C-library rand() function is a pure software pseudo-random number generator (PRNG). It will generate the same pseudo-random number sequence after each reset. You can circumvent that by calling seed with some entropy (RTC + 96 bit unique chip ID ...). The actual implementation of rand is not standardized. Its quality may vary as there is a tradeoff between quality and speed. There are better software PRNGs around.
2020-07-20 02:05 AM
thank you knarfb
but by calling seed.when reset agian we are getting same sequence of random number.
2020-07-20 02:05 AM
rtc means tick value ???
2020-07-20 02:53 AM
no. Real-Time-Clock. Thats useful if you want to get a new seed on ervery reset. I'm sure you find a compatible type with TRNG https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-high-performance-mcus/stm32f4-series.html