2024-06-08 02:01 AM
When STM32G431 is used for motor control, the left alignment cannot be selected after oversampling is enabled, but the program will report an error when it is changed to right alignment. May I ask why?
2024-06-11 12:54 AM
Hello @duan;
As mentioned in RM0440 Reference manual STM32G4 in "21.4.26 Data management" chapter "Left-alignment is not supported in oversampling mode. When ROVSE and/or JOVSE bit is set, the ALIGN bit value is ignored and the ADC only provides right-aligned data."
Oversampling means N accumulation as mentioned "21.4.29 Oversampler" chapter. As adding two 12bit conversion will give a 13bit result, this not possible to be handled if your 12bit conversion result is left aligned.
2024-06-11 01:29 AM
Thank you very much for your answer, but I would like to ask why the motor did not rotate after I changed the right alignment to satisfy the oversampling.
2024-06-11 03:06 AM
Hello @duan;
Using a NUCLEO-G431RB board, setting right aligned mode, an "oversampling ratio" set to x16 and "Oversampling right shift" set to zero, ADC conversion dynamic result is aligned with a no oversampled conversion and motor spins.
Expected conversion signal dynamic is the left aligned conversion one.
2024-06-11 03:49 AM
Hello @duan,
Could you clarify your configuration.
Do you work with MCSDK generated code or with your own code? Do you work on 6-step or FOC project?
What is the idea behind using oversampling?
Changing from left to right alignment without any other modifications cannot lead to a functional project for obvious reason.
Regards
Cedric
2024-06-14 05:57 PM
I used this method, but the motor still wouldn't run
2024-06-14 05:59 PM
The program generated by MCSDK is a FOC project, and changing to right alignment will indeed cause the motor to fail to run.