Skip to main content
GenuineDeveloper
Associate III
April 19, 2023
Question

STM32F0 ADC externally triggered and software triggered simultaneously?

  • April 19, 2023
  • 7 replies
  • 3313 views

Hi,

I need to measure 5 signals using the ADC. Out of the 5 signals, one is current (voltage across series shunt) which needs to be measured ONLY during transistor ON time, hence the ADC needs to be externally triggered by the PWM (OCREF). Other channels aren't time critical and can be triggered by software at regular intervals.

The controller(STM32F0 / STM32G0) I am using doesn't support ADC dual modes (Injected and Regulated) simultaneously.

Hence, currently I am changing between externally triggered and polling mode of ADC whenever the transistor drive needs to run and stops respectively and reading the data by DMA.

But, my concern here is:

1) Since I am unnecessarily scanning 5 channels during PWM ON time(where only 1 channel is required to be time critical), I am worried that the conversion completion time of all channels will exceed the ON time in cases of very low duty cycles.

2) Whether this method is correct and efficient considering the controller limitation? Is there a better way of doing this?

BR

This topic has been closed for replies.

7 replies

PieterInHetBos
Associate II
April 19, 2023

Why cant you just use polling mode (with DMA) and filter the irrelevant data in software. I am sure there is a big enough diffrence between ON state and OFF

1) If you set the rank of your current measurement channel to 1 this will (i think) measure that channel first.

2) If your current measurement is realy critical maybe use an external ADC with beter precision of oversampling if needed.

GenuineDeveloper
Associate III
April 19, 2023

1) Using polling mode, will not help sync data acquisition instance with that of transistor ON time. That is the reason controllers has ADC with external trigger feature!

2) Using an external ADC will improve accuracy (with increased BOM cost!) but again, how will you sync with the Transistor ON time?

BR

PieterInHetBos
Associate II
April 19, 2023

1)Is your current sample frequency higer or lower than the voltage sample frequency. If the voltage doesn't matter you can use the transistor ON time as universal sample frequency. Make sure your current measurement is first inline.

2) I get the BOM cost. But there are ADC with external trigger functions, i get you dont like the idea of more cost.

GenuineDeveloper
Associate III
April 19, 2023

1) Even if I keep the sampling frequency equal to the PWM frequency, how can I trigger the ADC at the right instance(rising/falling edge) with varying duty cycle?

2) It also complicates!