|
TM STM32F4xx Libraries
v1.0.0
Libraries for STM32F4xx devices from Tilen Majerle
|
Pretty accurate delay functions with SysTick or any other timer - http://stm32f4-discovery.com/2014/04/library-03-stm32f429-discovery-system-clock-and-pretty-precise-delay-library/. More...
Modules | |
| TM_DELAY_Typedefs | |
| Library Typedefs. | |
| TM_DELAY_Macros | |
| Library Macros. | |
| TM_DELAY_Variables | |
| Library Variables. | |
| TM_DELAY_Functions | |
| Library Functions. | |
Pretty accurate delay functions with SysTick or any other timer - http://stm32f4-discovery.com/2014/04/library-03-stm32f429-discovery-system-clock-and-pretty-precise-delay-library/.
If you are using GCC compiler, then your microseconds delay is probably totally inaccurate. USE TIMER FOR DELAY, otherwise your delay will not be accurate. Another way is to use ARM compiler.
As of version 2.0 you have now two possible ways to make a delay. The first (and default) is Systick timer. It makes interrupts every 1ms. If you want delay in "us" accuracy, there is simple pooling (variable) mode.
The second (better) options is to use one of timers on F4xx MCU. Timer also makes an interrupts every 1ms (for count time) instead of 1us as it was before. For "us" delay, timer's counter is used to count ticks. It makes a new tick each "us". Not all MCUs have all possible timers, so this lib has been designed that you select your own.
By default, Systick timer is used for delay. If you want your custom timer, open defines.h file, add lines below and edit for your needs.
With this setting (using custom timer) you have better accuracy in "us" delay. Also, you have to know, that if you want to use timer for delay, you have to include additional files:
Delay functions (Delay, Delayms) are now Inline functions. This allows faster execution and more accurate delay.
If you are working with Keil uVision and you are using Systick for delay, then set KEIL_IDE define in options for project:
Custom timers are a way to make some tasks in a periodic value. As of version 2.4, delay library allows you to create custom timer which count DOWN and when it reaches zero, callback is called.
You can use variable settings for count, reload value and auto reload feature.
Version 2.4
- May 26, 2015
- Added support for custom timers which can be called periodically
Version 2.3
- April 18, 2015
- Fixed support for internal RC clock
Version 2.2
- January 12, 2015
- Added support for custom function call each time 1ms interrupt happen
- Function is called TM_DELAY_1msHandler(void), with __weak parameter
- attributes.h file needed
Version 2.1
- GCC compiler fixes
- Still prefer that you use TIM for delay if you are working with ARM-GCC compiler
Version 2.0
- November 28, 2014
- Delay library has been totally rewritten. Because Systick is designed to be used
in RTOS, it is not compatible to use it at the 2 places at the same time.
For that purpose, library has been rewritten.
- Read full documentation above
Version 1.0
- First release
- STM32F4xx - STM32F4xx RCC: Only if you want to use TIMx for delay instead of Systick - STM32F4xx TIM: Only if you want to use TIMx for delay instead of Systick - MISC - defines.h - TM TIMER PROPERTIES: Only if you want to use TIMx for delay instead of Systick - attribute.h