2024-09-09 04:00 PM
Hi STM32 guys/gals,
The gray/white signal is for reference only, and that's the signal I'd like the generated yellow signal to achieve when starts and stops. I'm using DMA in circular mode to generate the yellow signal. However, I'm struggling to command the signal to start and stop exactly in the middle, between peak to peak. Forcing either the timer interrupt to stop or disable the DMA will make it stop anywhere between peak-to-peak but not exactly in the middle all the time. Should DMA in normal mode better for this application?
Stopped/started at bottom:
Stopped/started slightly above bottom:
Thanks,
Solved! Go to Solution.
2024-09-10 03:46 PM
Hi Mbrossett,
Thanks for the reply. I temporary solved the problem by disabling the DMA at the end of the wave generation function. Then re-load the DMA counter with the new value to start the DMA counter again and that does the trick.
2024-09-09 06:47 PM
By “middle” I am going to assume you mean the zero crossing…
If not already, the sine wave lookup table should start at value 0. Then you can use a global flag to notify the DMA_XferCpltCallback() to stop the DMA at the next interrupt. This will ensure it always starts and stops at zero. Of course this also means the output will (almost) never stop immediately as it waits until the next zero crossing.
2024-09-10 03:46 PM
Hi Mbrossett,
Thanks for the reply. I temporary solved the problem by disabling the DMA at the end of the wave generation function. Then re-load the DMA counter with the new value to start the DMA counter again and that does the trick.