cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F0 ADC externally triggered and software triggered simultaneously?

GenuineDeveloper
Associate III

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

7 REPLIES 7

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

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

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.

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!

maybe i am thinking wrong but you can use the PWM signal for the trigger? with the rising edge so the conversion is almost instan after PWM tigger? In my case (STM32G070RB) it will use the EXT11.


_legacyfs_online_stmicro_images_0693W00000biOYSQA2.png
_legacyfs_online_stmicro_images_0693W00000biOYXQA2.png 

I am doing this already. This doesn't answer my query.

My question is: Is there a way to manage ADC to run on external trigger for 1 channel and polling for rest of the channels?

Sorry i didn't understand the query, i count find anything in de RM https://www.st.com/resource/en/reference_manual/dm00091010-stm32f030x4x6x8xc-and-stm32f070x6xb-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

The closed thing i think is Discontinuous mode. Sadly i cannot help you any further