2022-03-07 08:36 AM
Hello everyone,
I am using the Nucleo l476rg and trying to use the same general purpose timer (TimX X=2 to 5) to develope both the following functions:
1)send several DMA request (let's say 1000) to transfer data from memory to SPI Data register with a rate set by the selected timer (timer update or compare)
2) The timer shall output a PWM waveform that toggles at a specific (let's say the 250th or 500th) DMA request and has a period equal to all the time needed for the DMA transfers at 1)
I am looking for a smart way to perform the above mentioned operation in HW with the same timer in order to avoid timing inaccuracies.
I have seen that the general purpose timers have 4 different CC registers. I could set the the PWM toggling with one CCR register. But how can I manage the DMA requests rate with the same timer?
Do you have any suggestion? Also on different uC that could have timers with this kind of functionalities.
Thanks in advance
2022-03-07 10:57 AM
You can't have requests happening at different frequencies on the same timer. You could use the DMA's HT and TC interrupts in such a way to trigger every 250 samples, but it will not be exact.
You could use another chained timer to get the exact waveform you want.
2022-03-07 11:06 AM
>>Also on different uC that could have timers with this kind of functionalities.
Simple CPLD?
2022-03-09 05:24 AM
I will try to use two timers with a master timer that clocks a slave timer. In this way I should achieve my goals.
I found this very useful STM32 cross-series timer overview - Application note
But can you help me in understanding the functionality highlighted in yellow?