2026-01-21 9:55 AM
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.
2026-01-21 10:15 AM
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).