HAL_Delay is offset by 2ms on the scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-02-05 4:41 AM
The scope is showing the following code takes 602ms (I'm using the external crystal, so no jitter) this 2ms can be seen on top of any delay I set.
while (1)
{
HAL_GPIO_WritePin(GPIOB, profilingPin_Pin, GPIO_PIN_SET);
HAL_Delay(300);
HAL_GPIO_WritePin(GPIOB, profilingPin_Pin, GPIO_PIN_RESET);
HAL_Delay(300);
}
The toggle of a pin takes 70-80ns so that isn't the issue. I have used the 16MHz clock
which still has the +2ms, and some jitter as expected.
Any insights on this will be greatly appreciated!
Solved! Go to Solution.
- Labels:
-
STM32CubeMX
-
STM32F4 Series
-
TIM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-02-05 5:21 AM
Review the library source code.
Seem to recall it adds one and has +/- 1ms accuracy anyway.
Only required to be at least as long as requested.
If you want tighter resolution use a clock that ticks faster than 1 KHz.​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-02-05 5:21 AM
Review the library source code.
Seem to recall it adds one and has +/- 1ms accuracy anyway.
Only required to be at least as long as requested.
If you want tighter resolution use a clock that ticks faster than 1 KHz.​
Up vote any posts that you find helpful, it shows what's working..
