STM32
COURSE
FEBRUARY 23, 2021
001 First Debug Program STLink HSE HSI Creado por: Ing.
Christian Salazar
1
Initialization
001 First Debug Program STLink HSE HSI
What will we learn?
In this video we will generate the first program that will be loaded to the STM32F429
Discovery card, in general the laboratories are oriented to be able to implement them
almost in any microcontroller of any STM32 family, we will configure the Processor Clock
to which it will work, we will use the HSI RC (High Speed Internal) which is an internal
Resistance-Capacitor type oscillator that works at 16 Mhz, which we will configure to
raise the frequency to the processor's main clock, we will also configure the HSE (High
Speed External) which is the external oscillator that has the card soldered with their
respective capacitors, we will do it in ST Microelectronics' own free STM32CubeIDE IDE
(FREE), we will insert variables to visualize their behavior throughout the program
debugging with the embedded STLink tool of the STM32F429 Discovery card and the
software free STMStudio that uses the STLink SWD protocol to access memory addresses
(variable es) of the processor and display its content in a table, curve or bars.
“We will use HAL Drivers, which will help us greatly to
port and recycle code routines from one processor of
one Family to another of another Family”.
2
Key points
SWD
It is necessary to enable Debugging of our processor with Serial Wire,
this enables debugging with SWD that uses 2 GPIOS (PA13 SWDDIO
and PA14SWDCLK), this protocol can work up to 4 Mhz between
processors.
STLINK
STLink (Card) is a Processor (Normally a STM32F1) that interacts
between the Software or variable server (STMStudio) via USB and the
processor with the SWD pins, now STLink V3 (it has a STM32H7), this
tool helps us to load and delete programs to the processor, also
access Flash memory, give and remove read and write permissions
and new features improved with the new tools, in the previous
3
images we see the appearance of the STLink V2 (Software left) and in
the following image (right ) we will see the new JAVA based tool
called STM32CubeProgrammer just like STMStudio, STM32CubeIDE,
STM32CubeMx.
STMSTUDIO
The STMStudio debugging program needs a file that normally
generates the IDE used when compiling a program correctly, these
files are extension (.elf) with STM32CubeIDE and Arduino (Tested
with the Rogger Clark version) (The Arduino version Official STM32
Core not tested) and (.axf) with MDK Keil uVision from ARM.
4
TICKS DEL SISTEMA (CMSIS):
The system ticks are nothing more than an increment of a variable
(uwTick) every millisecond, this variable is of type uint32_t that is to
say that it can count up to 0xFFFF FFFF or 4294967295, after which it
will overflow and fly to zero (0.0) again, In the video we will observe
that to obtain the value of that variable at a given moment, it is done
with the HAL_GetTick () function; which is the equivalent of the
Arduino millis () function.