Why Do I Need To Configure The Systick Timer To Use The Hal Drivers?; Why Is The Systick Timer Configured To Have 1 Ms?; What Programming Model Sequence Should I Follow To Use Hal Drivers? - ST STM32F2 User Manual

Description of stm32f2 hal and low layer drivers
Hide thumbs Also See for STM32F2:
Table of Contents

Advertisement

FAQs
The Errors callbacks are called when a processing error occurs in DMA or interrupt mode.
These callbacks are customized by the user to add user proprietary code. They can be
declared in the application. Note that the same process completion callbacks are used for
DMA and interrupt mode.
Is it mandatory to use HAL_Init() function at the beginning of the user
application?
It is mandatory to use HAL_Init() function to enable the system configuration (Prefetch,
Data instruction cache,...), configure the systTick and the NVIC priority grouping and the
hardware low level initialization.
The SysTick configuration shall be adjusted by calling HAL_RCC_ClockConfig() function,
to obtain 1 ms whatever the system clock.

Why do I need to configure the SysTick timer to use the HAL drivers?

The SysTick timer is configured to be used to generate variable increments by calling
HAL_IncTick() function in SysTick ISR and retrieve the value of this variable by calling
HAL_GetTick() function.
The call HAL_GetTick() function is mandatory when using HAL drivers with Polling Process
or when using HAL_Delay().

Why is the SysTick timer configured to have 1 ms?

This is mandatory to ensure correct IO operation in particular for polling mode operation
where the 1 ms is required as timebase.
Could HAL_Delay() function block my application under certain conditions?
Care must be taken when using HAL_Delay() since this function provides accurate delay
based on a variable incremented in SysTick ISR. This implies that if HAL_Delay() is called
from a peripheral ISR process, then the SysTick interrupt must have higher priority
(numerically lower) than the peripheral interrupt, otherwise the caller ISR process will be
blocked. Use HAL_NVIC_SetPriority() function to change the SysTick interrupt priority.
What programming model sequence should I follow to use HAL drivers ?
Follow the sequence below to use the APIs provided in the HAL drivers:
Call HAL_Init() function to initialize the system (data cache, NVIC priority,...).
1.
2.
Initialize the system clock by calling HAL_RCC_OscConfig() followed by
HAL_RCC_ClockConfig().
3.
Add HAL_IncTick() function under SysTick_Handler() ISR function to enable polling
process when using HAL_Delay() function
4.
Start initializing your peripheral by calling HAL_PPP_Init().
5.
Implement the hardware low level initialization (Peripheral clock, GPIO, DMA,..) by
calling HAL_PPP_MspInit() in xx_hal_msp.c
6.
Start your process operation by calling IO operation functions.
What is the purpose of HAL_PPP_IRQHandler() function and when should I
use it?
HAL_PPP_IRQHandler() is used to handle interrupt process. It is called under
PPP_IRQHandler() function in xx_it.c. In this case, the end-user has to implement only the
callbacks functions (prefixed by __weak) to perform the appropriate action when an
interrupt is detected. Advanced users can implement their own code in PPP_IRQHandler()
without calling HAL_PPP_IRQHandler().
1368/1371
DocID028236 Rev 2
UM1940

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F2 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF