2025-10-26 2:06 PM
I have an STM32G431 doing FOC on a little gimbal motor, but am getting strange noise on the current sense ADC when it's being triggered by TIM3. It shows up as random spikes, which values always end up being dividable by 8.
Weird thing is, if I have the ADC set to oversample, it will average out these spikes. While I'm 100% sure it's a digital artifact, not measured noise. That would never ever all end up with the last 3 bits being "000".
Here's a direct comparison by the ADC being triggered by TIM3's TRGO directly:
And changing nothing but starting the ADC through software in the TIM3 update event interrupt:
Does this ring a bell anywhere? I've been wrestling with this for days, but can't find a way to get rid of the artifacts while still triggering the ADC automatically.
2025-10-26 2:30 PM
Typically happens if VREF+ is not stable. Motor noise will exacerbate the issue, though it doesn't seem to be the main cause here.
You could also try triggering on a CCx event rather than the update, though I don't expect different results.