2023-07-28 09:25 AM - edited 2023-07-28 09:26 AM
eg, in stm32l0xx_ll_utils.c
/**
* @brief This function configures the Cortex-M SysTick source of the time base.
* HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro)
* @note When a RTOS is used, it is recommended to avoid changing the SysTick
* configuration by calling this function, for a delay use rather osDelay RTOS service.
* Ticks Number of ticks
* @retval None
*/
For the 'Ticks' parameter, "Number of ticks" is pretty meaningless - what is this "number"? What does it signify??
It should say, I think, "Number of ticks per second"
Thus LL_Init1msTick does LL_InitTick(HCLKFrequency, 1000U) to give 1000 ticks per second - or 1 tick per millisecond.
2023-07-28 09:34 AM
Also, the documentation fails to mention that this function (and, thus, also LL_Init1msTick) disables the SysTick interrupt.
That's an important side-effect that really needs to be noted - as can be seen from the number of forum posts about it!
2023-07-28 01:03 PM - edited 2023-07-28 01:28 PM
>Also, the documentation fails to mention that this function (and, thus, also LL_Init1msTick) disables the SysTick interrupt.
>That's an important side-effect that really needs to be noted
+1
2023-07-29 01:58 AM
And the "Number of ticks per second" can be called just "Tick frequency (Hz)". Those comments are written by the Captain Obvious, who doesn't even really understand the purpose of comments. And what is really the point of this function, when CMSIS has SysTick_Config(), which does almost the same and enables the interrupt?
By the way, don't get me wrong, but, if I would report this level of issues, there would be tens and hundreds of reports for every HAL/LL file. And that is one of the reasons I count HAL as a complete junk - fixing it or even reporting all of the issues actually requires more work than rewriting a decent driver library from the scratch.
2023-08-01 10:09 AM
Dear Chicken,
If you don't report the issues, you can hardly complain about there being issues.
Love,
Egg xx.
2023-08-03 03:21 AM - edited 2023-08-03 03:22 AM
Hello All,
Thank you for rising this up.
An internal ticket (ID 158538) is submitted in order to improve and avoid such issue.
PS: ID 158538 is an internal tracking number and is not accessible or usable by customers.
Imen
2023-08-21 02:23 AM - edited 2023-08-21 02:24 AM
@Imen.D - thanks for that.
I hope this is a general ticket - not just specific to this particular function - as this type of poor-commenting is widespread.
In general, anything which involves a physical quantity should document what "units of measure" are used - in this case, "ticks per second".
And side-effects should be noted - another example here: