2021-01-21 04:33 PM
I've been working on BLDC motor control using STM32F302R8 with X-CUBE-SPN8. I've found there occurs wrong ADC conversion frequently. Thinking this comes from that the LFtimer period which is related to step changes and varies with motor speed, is not aligned with HFtimer which affects the PWM and ADC conversion, I added the following codes before every ADC conversion(HAL_ADC_GetValue()) in function MC_ADCx_SixStep_Bemf() and solved this problem. Arbitrary step changes seem to cause the corruption of ADC channel change sequence.
if( (((hadc1.Instance->SQR1)>>6 ) & 0xF) == SIXSTEP_parameters.CurrentRegular_BEMF_ch ) for BEMF
if( (((hadc1.Instance->SQR1)>>6 ) & 0xF) == SIXSTEP_parameters.ADC_SEQ_CHANNEL[index_adc_chn] ) for Vbus, current, temperature...
2021-03-01 02:15 AM
Dear @TChun.1
Just in case, what SDK version do you use?
Best regards
==
Laurent Ca...