cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G474 HRTIMER ADC Trigger

DamageG
Associate II

I'm trying to configure the ADC to read to values at a specific time in my system that uses the STM32G474.

I have two channels of peak current mode control using the HRTIMER. The outputs are reset from either a comparator event or max duty cycle compare value on each channel. 
For each channel, I want to sample a voltage at a fixed delay time after the output is reset.

Any help is greatly appreciated.

Thank you

3 REPLIES 3
Imen.D
ST Employee

Hello @DamageG ,

You can use the auto-delayed mode to introduce a fixed delay after the comparator event before triggering the ADC.

In auto-delayed mode, the CMP2 value will be added to the captured timer value when the comparator event occurs. This will generate a match event after the specified delay (e.g., 200ns).

Then, set the ADC to be triggered by the HRTIMER's compare match event (CMP2 match event). This ensures that the ADC conversion starts after the fixed delay from the comparator event.

For more detailed information on configuring the HRTIMER and Auto-Delayed Mode, refer to the STM32G4 reference manual (in HRTIM chapter) and the HRTIMER cookbook (AN4539),

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Thank you!
It's going to take me a couple of days to be able to test it out. I'll let you know how it works.

I updated the cubeIDE to the latest firmware and now I'm getting this hard fault. Any ideas? I didn't change anything in my task setup from what was working.