2023-08-02 01:33 PM
Hi everyone,
Im havinga annoying problem, im trying to inialize the DMA with the ADC , on my custom board. when a initlize it, it works fine, i get the 3 values of the trhee adc channel stored on a buffer. But the Systick timer goes crazy. i get way more faster than it should. the MCU its running on 16Mhz HSI,the interrupt that should be 1ms, goes as low as100uS.
The strange thing, is that, whenever the DMA is not initalized, the systick runs rigth. Any ideas of wath could cause this?
Solved! Go to Solution.
2023-08-02 02:42 PM
Probably DMA is falling behind, causing you to misinterpret systick as speeding up. Reduce ADC sample rate to ~1000 Hz to test.
2023-08-02 02:14 PM
Hello @yIzumi ,
Is there DMA interrupt enabled? If your ADC is running in continuous mode with DMA transfer, the DMA interrupt could happen quickly. Consequently, your interrupts could be delayed.
Please try first to disable DMA interrupt or slow down ADC sample rate.
For now, I'm not able to reproduce it on my side. So, if nothing change, feel free to share your project.
Best Regards,
Gwénolé
2023-08-02 02:42 PM
Probably DMA is falling behind, causing you to misinterpret systick as speeding up. Reduce ADC sample rate to ~1000 Hz to test.
2023-08-03 04:14 AM - edited 2023-08-03 04:45 AM
Hi gwénolé, thanks for the quick reply and sorry for my grammar errors.
So, i disabled the DMA interrupt and reduced the adc sample rate to +-6khz, but it is still showing the same behavior, Systick is incrementing too fast when DMA is initialized. here are my ADC module and clock configs.
2023-08-03 04:16 AM
Hi TDK, thanks for the quick reply.
I tried to slow it down to 6khz but it kept showing the same behavior, i posted my configs of the adc and clock module on my reply to Gwénolé.
2023-08-03 12:13 PM
I found the problem, and as expected, it was a silly one.
I was initializing the ADC dma and telling it to store on a 6-position buffer, but the buffer was declared with 4 positions. So I guess the DMA never finished the conversion? Anyway, now it works fine. But I do think that the fast sampling time was making it worse, so really, thanks for the useful replies.