cancel
Showing results for 
Search instead for 
Did you mean: 

Adc data in awdg callback

reedomneck
Associate III


I'm using stm32u535RCT mcu and I've requirement of zero crossing detection using analog watchdog.
I need 6 channels and configured DMA circular buffer to collect 1Kb data on each channel. Channel 5 is mapped to analog watchdog.
Here I want to understand in callback how do I get channel 5 last sampled data.
Should I calculate by calculating the index with help of NDTR register or how.

 

 

1 REPLY 1
TDK
Super User

Yes, using NDTR would be the best way.

If your buffer is one sample per channel, this is easier. Otherwise, it should be an integer times the number of channels you're converting.

Be sure to invalidate cache before reading the value.

Don't use AWDG1 for this as DMA request won't be generated for out of range values (see reference manual for details).

If you feel a post has answered your question, please click "Accept as Solution".