EVLSPIN32G0A2 Current Sensing Problem

Hello everybody,

I want to use SimpleFOC with the newly released EVLSPIN32G0A2 development board. Without current sensing, I can run my motor in closed-loop velocity mode using Hall sensors without any issues.

However, when I enable current sensing, the STM32G0 series MCU does not support low-side current sensing, and I get the following error:
“ERR: Low-side cs not supported!”

How can I solve this issue?

Hey @hkesoglu,
At he moment we do not support low-sode current sensing with g0 familly of STM chips. We support F1,F4, G4, H7 and L4 if I’m not mistaken.

The issue with low side current sensing is that it need to the synchronisation between the pwm timers and ADC and this is usually very specific to the MCU family.

If there is an interest for supporting the g0 familly, we can try to include it in our next release.

@Candas1 was working on a new way of handling the ADCs and current sensing with STM boards, that should be able to handle most of the families at once. But if I’m not mistaken, this code is not well tested yet.

Yeah I never released it because it’s much more complicated than expected, and I didn’t have time to continue working on it last few months.

I never tested it on G0, but here are some notes from the readme file:

  • no injected ADC, so regular ADC should be used
  • this means DMA should be used, for low side current sensing a DMA interrupt should be used in case the timer you are using is not an advanced timer(no repetition counter). My implementation doesn’t handle DMA interrupt yet as IRQs are specific for each family and can be found in the datasheet only.
  • sampling time cannot be configured per channel, only 2 common sampling times can be used.

For the time being the closest implementation is the B431 driver which is using regular ADC and DMA without interrupt for low side current sensing, but it needs to be adapted.

Thanks for your replies. From what I understand, when using low-side current sensing, it analyzes only half of the total period to estimate the current. It seems like it samples the entire signal into memory first(with DMA), then focuses on the time window when the low side is active to calculate the current values. Is that correct?