Skip to main content
GenuineDeveloper
Associate III
December 27, 2022
Solved

How to use ADC both in external triggered and regular conversion mode?

  • December 27, 2022
  • 2 replies
  • 1861 views

I am using STM32F031 family microcontroller and want to configure the ADC.

My application requires current sensing and voltage sensing. For critical measurement like current during PWM ON time, I am using the ADC in external trigger mode, triggered by the PWM timer channel.

However, for voltage sensing, I do not want the ADC to be externally triggered during the PWM ON time, instead, want to use it in regular conversion mode.

How can I achieve this, since I cannot see an option to combine both triggered and regular conversion modes of ADC? Any inputs will be helpful.

Regards,

GD

This topic has been closed for replies.
Best answer by S.Ma

You would need a.richer ADC which has injected (high prio) channels edge triggered with dedicated data registers, with normal channels in continuous loop mode, as the STM32L4 probably has. Otherwise, run continuously and use EXTI to sw capture the adc channel you need, with a bit of sw jitter.

2 replies

S.Ma
S.MaBest answer
Principal
December 27, 2022

You would need a.richer ADC which has injected (high prio) channels edge triggered with dedicated data registers, with normal channels in continuous loop mode, as the STM32L4 probably has. Otherwise, run continuously and use EXTI to sw capture the adc channel you need, with a bit of sw jitter.

Tesla DeLorean
Guru
December 27, 2022

Auto code generation only provides for basic boilerplate templates of how things can work.

The HW may be capable of more exotic modes, but you'd need to read and understand the manuals, and experiment with switching modes, or using injected methods.

Other STM32 have multiple ADC allowing each to operate in different ways, with different channels.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..