2015-04-11 12:18 AM
Hi,
uwTick is an uint32_t incremented each Systick interrupt 1ms. uwTick is used to execute HAL_Delay function. So i calculated, uwTick will overflow each 49 days almost. I know its a really rare event but if a system is never powered-off it shall occur. If HAL_Delay is called when uwTick is close to 2^32-1, the HAL_Delay function may return earlier than delay in ms asked in parameter because of the while condition (HAL_GetTick() - tickstart) < Delay) comparison and the uwTick that can overflows to 0. Am i true ? #stm32cube #stm32f4 #you-failed-the-interview2015-04-11 04:06 AM
Am i true ?
No2015-04-11 08:33 AM
2015-04-11 08:40 AM
Ok below argumentation is based on SysTick_Handler defined as:
HAL_IncTick();2015-04-11 05:24 PM
0x00000002 - 0xFFFFFFFE = 0x00000004
Or perhaps you would prefer the original implementation? [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/%5bbug%20report%5d%20Bug%20in%20HAL%20%28SPL%29%20delay%20function&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=180]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/[bug%20report]%20Bug%20in%20HAL%20%28SPL%29%20delay%20function&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=1802015-04-11 05:41 PM
0xFFFFFFFF - 0xFFFFFFF6 = 0x00000009
0x00000000 - 0xFFFFFFF6 = 0x0000000A
0x00000001 - 0xFFFFFFF6 = 0x0000000B
..
0x0000000A - 0xFFFFFFF6 = 0x00000014
2015-04-13 05:16 AM
Ok, some forgotted binary boolean arithmetic for subtraction made me think in a wrong way...
Thanks.