ADC is reporting different voltage when motor not running versus running.
- September 4, 2021
- 4 replies
- 1473 views
My motor control application uses the STM32G431. The code has a serial command that reports the Vbus voltage. To get the Vbus voltage I run the following in a low priority timer callback at triggers once per second.
float V_d = (float)PQD_MotorPowMeasM1.pVBS->AvBusVoltage_d;
volts = V_d * ((ADC_REFERENCE_VOLTAGE / BUS_PARTITIONING_FACTOR))/65535.0;
The motor supply is 5Vdc and with the motor On or Off a scope trace and DVM show the 5Vdc is not changing more than 2-3mV. The divider is 30k to +5Vdc and 10k to Gnd and the tap has a 4700pf cap to ground. The tap goes to PA3 (ADC1_in5)
When the motor is not running I typically report 4.8vdc but running I may see 4.5vdc on some boards and 5.3vdc on others. The supply rail is not changing but the reported ADC reading is changing.
I am using the following ADC for motor current, Vbus and Temperature:
U adc1_in3
V adc1_in2, adc2_in2
W adc2_in1
Temp adc1_in4
Vbus adc1_in5
My pwm frequency is 23kHz and the Vbus and Temp ADC's are set per the attached code file . Any ideas what would cause this reporting error?