2023-07-03 03:22 PM - edited 2023-07-04 09:31 AM
Hi,
I am having trouble getting the Timer to trigger a DMA -> SPI operation. Namely, I want to set the timer up to run,. Then, get every overflow event to trigger the DMA to move a byte into the SPI. The SPI should auto-send. Then, the cycle repeats until the DMA has moved a N-bytes.
I am feeling really blind, because I cannot figure out the problem. At first, I was trying to find the right setting to get the Timer to trigger a DMA request upon UEV generation. However, I could not find such a feature. So instead, I setup DMA1 Channel 3. TIM6 should map to this DMA. Then I setup TIM6 to generate a UEV upon Overflow (URS = 1, UDIS = 0). Finally, I setup TIM6 to generate a DMA request upon update (UDE = 1).
Still nothing.
Can I get some input?
--------------------------------------------------------------------------------------------------------------------------
What I am trying to do may not be possible in the way that I thought.
Would the DMA rapid fire send N-bytes to the SPI upon the first successful DMA request? Is there a way to get it to send only 1 byte at a time, triggered by the timer?
--------------------------------------------------------------------------------------------------------------------------
And auto-increment through memory? So..
Solved! Go to Solution.
2023-07-04 02:46 AM
Hello @Dude, thank you for your post,
The problem could be related to the time trigger or the DMA config as well as the SPI peripheral!
So, first, make sure -by looking at the datasheet- that the DMA request is lined to the right SPI peripheral
Regarding your question about the DMA; ofc it is possible -in the DMA config- by setting the DMA transfer size to 1 byte and enabling auto-increment for the DMA source address.
Regarding the timer trigger, I think one way to know if the UEV is triggered is the use an interrupt handler for the timer's UEV and use a GPIO pin or print a message... to see if the UEV is even triggered! -Maybe it's not the easiest way but you need to localize exactly where comes the problem
Hope that helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-07-04 10:03 AM
2023-07-03 03:27 PM - edited 2023-07-04 09:31 AM
Content shuffled up
2023-07-03 03:28 PM - edited 2023-07-04 09:31 AM
Content shuffled up
2023-07-04 02:07 AM
Which STM32?
How do you trigger DMA? Show the register which selects the trigger source.
JW
JW
2023-07-04 02:46 AM
Hello @Dude, thank you for your post,
The problem could be related to the time trigger or the DMA config as well as the SPI peripheral!
So, first, make sure -by looking at the datasheet- that the DMA request is lined to the right SPI peripheral
Regarding your question about the DMA; ofc it is possible -in the DMA config- by setting the DMA transfer size to 1 byte and enabling auto-increment for the DMA source address.
Regarding the timer trigger, I think one way to know if the UEV is triggered is the use an interrupt handler for the timer's UEV and use a GPIO pin or print a message... to see if the UEV is even triggered! -Maybe it's not the easiest way but you need to localize exactly where comes the problem
Hope that helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-07-04 08:28 AM - edited 2023-07-04 09:35 AM
Okay so the Timer is triggering an UEV event when I use interrupts.
2023-07-04 08:31 AM
So Channel 3 should be able to be triggered by TIM 6 and cause SPI1 TX to transmit...?
2023-07-04 08:33 AM - edited 2023-07-04 09:34 AM
Content shuffled down
2023-07-04 08:49 AM - edited 2023-07-04 09:34 AM
Content Shuffled down
2023-07-04 09:11 AM - edited 2023-07-04 09:36 AM
Are you sure that the transfers can do as I want? Thanks to you and Waclawek.jan, I am able to get the DMA to trigger, as caused by TIM6 UEV occurrence.
Will the DMA in circular buffer mode with N-bytes (CNDTR3 = N-bytes arbitrary number) move one byte per DMA request or N-bytes per DMA request?
thanks