Almost all (except STM32F401/STM32F411) STM32F4xx MCUs have internal backup SRAM, which stores data, if power is at least on Vbat, or main voltage is active.
These MCUs have internal 4-kBytes of SRAM. It is on location where if you read “too much” you can make a HardFault error and this is something you don’t want. So be careful when you are doing with this ram.
Backup SRAM can be also used as EEPROM, if your Vbat battery is always active, so you can store data which will stay there also if you reset your device. You just have to make sure that you don’t shut down your power supply.
Difference between backup SRAM and normal SRAM is that backup SRAM stays the same if main voltage is off (but Vbat is still active), but normal SRAM will loose data stored inside.
Important: If you will try working with backup SRAM on STM32F401 or STM32F411 devices, you will get “HardFault” error when you will try to read from backup SRAM register locations.
These devices don’t have backup SRAM inside so do not try to do that or your device can stuck.
STM32F4xx devices have some parts in memory, which are read only and store some information about device. You can use them to protect your program if it is stolen from memory, or to tell programmer/debugger which device is connected with and detect flash size.
This library covers 4 things you can read from device:
Device signature is something that you probably want to know when you are working with some device. This feature returns you 16-bit length device signature value.
Some devices are from time to time updated in features, but with same name. This register returns you a revision in which it was made.
Flash size is 16bit value stored somewhere in MCU. Value is in kB (kilo bytes)
96-bit long identification part, where bits are factory programmed. Each device has different number, which gives you an opportunity to check if program on the device is “stolen” from another device, so you can disable functionality.
Let’s test what STM32F4xx devices can do. I have all “4 speed families” at home so why not to try it how fast we can go. By default, for those who don’t know max frequencies for STM32F4xx devices, they are in list below:
84MHz: STM32F401 MCUs, including Nucleo-F401 board
100MHz: STM32F411 MCUs, including Nucleo F411 board
168MHz: STM32F405/7 and STM32F415/17 MCUs, including STM32F4-Discovery board
180MHz: STM32F427/29 and STM32F437/39 MCUs, including STM32F429-Discovery board
Ok, we have everything provided, let’s test how far we can go with PLL settings. First we have to go through, how to set PLL parameters to even get any clock. Step by step on how PLL works. Continue reading →
CMSIS files from ARM provides ARM Math functions. There are also PID controller functions in different formats for f32, q31 and q7. This tutorial/project will talk about how to implement PID controller on STM32F4xx using PID functions from ARM.
Fast about PID controller. PID stands for Proportional-Integral-Derivative controller. This is a control loop feedback mechanism widely used in industrial control systems. It calculates the error between measured value and the desired setpoint value. According to the error, it then calculates output value to minimize this error.
After first FFT project, I’ve decided to make a simple snake game. Basically I’ve made it in Labview first for my partial exam at the university. It looked great so why not port it also to STM32F429-Discovery board which has everything already prepared for us.
You just need USB OTG cable and external keyboard to drive snake and you are ready to play.
Works on STM32F429-Discovery board
Supports external keyboard using USB HID Host stack on STM32
Supports selecting different speeds
More speed, more points
Standard snake game mode
Your goal is to make snake larger as possible
Supports 2 game modes
Mode 0: If you hit wall, game is stopped
Mode 1: If you hit wall, snake will come out at the other side of game area