CubeMX timer period value generated wrong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-17 2:55 AM
CubeMX generates weird number for timer period.
I set the timer period to 0xffffffff in the GUI. That results in CubeMX setting:
4.294967295E9
for the period. That value is wrong. It should be just 4294967295.
Is that a CubeMX bug?
- Labels:
-
STM32CubeMX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-17 3:12 AM
Hello @Community member​
Could you please explain more your request (the scenario) (which MCU) to check the issue.
Please share your ioc file to check the problem.
Best regards,
Nesrine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-17 6:16 AM
4.294967295E9 and 4294967295 are equal. One is expressed in scientific notation. Though certainly an integer would be preferable here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-17 6:25 AM
Hello Nesrine,
I am using stm32g474ve on STM32CubeIDE v1.4.0.
In the .ioc file, TIM2.PeriodNoDither is set correctly to 0xffffffff. But the generated code has this line:
- /* TIM2 init function */
- void MX_TIM2_Init(void)
- {
- TIM_ClockConfigTypeDef sClockSourceConfig = {0};
- TIM_MasterConfigTypeDef sMasterConfig = {0};
- htim2.Instance = TIM2;
- htim2.Init.Prescaler = 99;
- htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
- htim2.Init.Period = 4.294967295E9;
- ...
Best regards,
Rafael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-17 7:46 AM
Hello @Community member (Community Member)​
4.294967295E9 and 4294967295 are equal.
Best regards,
Nesrine
