cancel
Showing results for 
Search instead for 
Did you mean: 

Enable oversampling conflicts in motor control using STM32G431

duan
Associate II

duan_0-1717837063729.png

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?

 

6 REPLIES 6
GMA
ST Employee

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.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA
duan
Associate II

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.

GMA
ST Employee

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. 

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA

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

 

 

duan
Associate II

I used this method, but the motor still wouldn't run

The program generated by MCSDK is a FOC project, and changing to right alignment will indeed cause the motor to fail to run.