This project turns STM32F4-Discovery board, or any STM32F4 board with USB port into a hardware random number generator.
- GNU Arm Embedded Toolchain
- STM32CubeMX
- Firmware programming tool
- Clone this project, open
stm32_rand.iocwith STM32CubeMX. The clickGenerate CodeunderProjectmenu to download and copy STM32F4 drivers and USB libraries toDrivers/CMSIS,Drivers/STM32F4xx_HAL_DriverandMiddlewares/ST/STM32_USB_Device_Library. - Type
maketo build, ormake DEBUG=0 OPT=-O2to build a release version.
- Programme the binary to board. With the onboard ST-Link, varity of tools can be employed to programme the flash memory. Such as ST-LINK utility on Windows, or stlink from texane which works on both Linux and macOS.
- Connect the micro USB port to PC, a new serial port will be available.
- Random numbers can be accessed by simply reading data from the new serial port. A python script
dump_rand.pyis provided as an example.