Wrong code in R3_2_CurrentReadingCalibration?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-02-10 06:07 PM
used sdk : 5.4.7
mcu : stm32f446re
dual motor
In function R3_2_CurrentReadingCalibration has below code:
pHandle->PhaseAOffset >>= 3;
pHandle->PhaseBOffset >>= 3;
pHandle->PhaseCOffset >>= 3;
But NB_CONVERSIONS is defined 16u, So is it true the right code should be
pHandle->PhaseAOffset >>= 4;
pHandle->PhaseBOffset >>= 4;
pHandle->PhaseCOffset >>= 4;
I checked the example code used stm32g431 as below:
pHandle->PhaseAOffset /= NB_CONVERSIONS;
pHandle->PhaseBOffset /= NB_CONVERSIONS;
pHandle->PhaseCOffset /= NB_CONVERSIONS;
- Labels:
-
STM32 Motor Control
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-08-30 06:27 AM
Dear llm,
Firstly, we would like to sincerely apologize for the delay in replying to your post.
If your point is still pertinent, the difference comes from ADC 12bit left data alignment for STM32F4/F7 series, please check RM0390 for more detail.
As injected conversions results are left shifted by one and PhasexOffset computation done without this left shift, the result is (PhasexOffset <<1)>>4, then >>3 is used.
Best regards.
GMA