Skip to main content
DamageG
Associate II
October 20, 2024
Question

STM32G474 HRTIMER ADC Trigger

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

This topic has been closed for replies.

3 replies

ST Technical Moderator
October 22, 2024

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),

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
DamageG
DamageGAuthor
Associate II
October 22, 2024

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.