cancel
Showing results for 
Search instead for 
Did you mean: 

Isn't this a bug in X-CUBE-SPN8 ?

TChun.11
Associate

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...

1 REPLY 1
Laurent Ca...
Lead II

Dear @TChun.1​ 

Just in case, what SDK version do you use?

Best regards

==

Laurent Ca...