cancel
Showing results for 
Search instead for 
Did you mean: 

Need higher resolution speed measurement in FOC code.

BTrem.1
Senior II

In my sensorless application driving a BLDC I need the best resolution possible.

I set the SPEED_UNIT to _001Hz but the feedback from the SPD_GetAvrgMecSpeedUnit procedure still seems to be in units rounded to 6.

For example I can read 3059 and 3064 but nothing in between. I'm running a 6 pole-pair motor at nominally 30.5Hz and my requirement for speed variation is <2us p-p jitter. I'm finding it quite challenging ;)

I'm using a STM32G431 48-pin device with a STSPIN233 using 5V on a custom board. My start current peak is about 700mA and my run current is typically 35mA peak.

For my speed feedback in procedure STC_CalcTorqueReference is SPD_GetAvrgMecSpeedUnit the correct procedure to use to get measured speed?

Also, I can not find the source code that SPD_GetAvrgMecSpeedUnit uses to calculate the average, I think it is procedure STO_PLL_CalcAvrgMecSpeedUnit. Is that available?

Thank you for consideration of my problem. All suggestions welcomed.

3 REPLIES 3
Laurent Ca...
Lead II

Dear @BTrem.1​ 

Are you sure about your example?

Indeed, 3064 is not a multiple of 6 but of 8.

Best regards

I need to withdraw my question. I collected more data and plotted a histogram on over 1000 samples taken at 1ms sample rate. The table is shown below

0693W00000Czr2tQAB.jpgI think my problem is if I sample at the motor electrical rate of 5ms (6 pole pair) I get an aliasing effect and only get sample values 3328 and 3334. Is there any documentation on the procedure SPD_GetAvrgMecSpeedUnit ? It simply returns a pointer pHandle->hAvrMecSpeedUnit. I cannot find where this is updated and I can not find any information on the buffersize it is averaged in.

Thanks,

Brian

Brian

Laurent Ca...
Lead II

Dear STM32 Motor Control Community members

You follow the following thread about SPD_GetAvrgMecSpeedUnit in this new question: https://community.st.com/s/question/0D53W00000xsTlzSAE .

Best regards