cancel
Showing results for 
Search instead for 
Did you mean: 

Timer options for DMA transfer on STM32F03F4P6

SteenA
Associate II

Hi there

 

I'm working on a project where I need to create 4 different pulse trains on 4 different GPIO pins

I've created and formatted a uint32_t array to be able to directly write to the GPIO BSRR register

I want to use DMA memory to peripheral in circular mode

To trigger the DMA transfer I need to pick a timer

According the the drawing on page 151 in the reference manual for STM32F030F4P6 it looks like there are trigger inputs from the basic timers TIM14, TIM16 & TIM17 to trigger the DMA transfer

 

But all the examples I've been able to find in videos and in descriptions are all using advanced timers and are using an trigger event TRGO to trigger the transfers of new data from memory to GPIO port at fixed intervals

When I'm looking on the setting options for these basic timers TIM14, TIM16 & TIM17, I do not have any option for an trigger event (TRG0) from these timers. I'm only able to pick Input Capture, Output Compare & PWN generation from the available options in CubeMX

 

Can these basic times be used for my project, or do I need to use one of the advanced timers that do have the TRGO setting.

And if so, please explaing how these basic timers can be used. Which settings etc.

 

Br Steen

 

4 REPLIES 4

> all the examples I've been able to find in videos and in descriptions are all using advanced timers and are using an trigger event TRGO to trigger the transfers of new data from memory to GPIO port at fixed intervals

This does not make sense. TRGO does not directly trigger DMA (TRGI does, but that's another story, and in fact means a trigger source which is outside this given timer).

Read description of the DMA-triggering bits in TIMx_DIER register in RM.

JW

Hi waclawek.jan

All these examples are using TRGO event to trigger the transfer via a timer:

 

https://community.st.com/t5/stm32-mcus-products/stm32f0-timer-dac-dma/td-p/458451

https://controllerstech.com/dac-in-stm32/

https://www.youtube.com/watch?v=8z-pJSTi7ME  (3 minutes into the video)

https://www.youtube.com/watch?v=0N4ECamZw2k   ( 6m minutes into the video)

 

Thanks for your hint, but I need to read more about the DIER register.

Unfortunately I cant find examples how to use this register to trigger the DMA from the basic timers

 

Br Steen

 

 

 

 

TDK
Guru

> According the the drawing on page 151 in the reference manual for STM32F030F4P6 it looks like there are trigger inputs from the basic timers TIM14, TIM16 & TIM17

I don't see TIM14 on there. I see the other two.

TDK_0-1740491583080.png

 

> When I'm looking on the setting options for these basic timers TIM14, TIM16 & TIM17, I do not have any option for an trigger event (TRG0) from these timers. I'm only able to pick Input Capture, Output Compare & PWN generation from the available options in CubeMX

I have no issues setting DMA in CubeMX on TIM16. With TIM14, it's not there because it's not an option.

TDK_1-1740491616879.png

 

TRGO options don't seem relevant here. These timers don't have one per the RM. Use the update event to trigger the transfer. Or the CH1 event.

 

 

I suspect you're mistaking TIM14 for TIM15 in the manual. They're very different.

If you feel a post has answered your question, please click "Accept as Solution".

The first two links are related to DAC triggering, that's different from DMA triggering.

The detail in third video where TRGO source is set stems from the video's author not understanding that that's irrelevant for DMA. Videos generally tend to present a poor source of information in this field, diluted and with little to no relevant feedback and extremely rarely corrected.

The idea is, that in timer you enable individual DMA triggers in the same way as you enable individual interrupt triggers - even in the same register, the mentioned TIMx_DIER. As @TDK said above, for you, the relevant options are Update or CC1 i.e. TIMx_CH1 output compare event. Then you set up the respective DMA channels - as the figure @TDK has shown above indicates, individual triggers are ORed at the input of DMA (in case of collision with other DMA trigger sources from other peripherals, the 'F030x4 offers remap, see footnotes to that figure and/or SYSCFG_CFGR1.TIM16_DMA_RMP/TIM17_DMA_RMP.

As @TDK said above, TIM14 is not an option, you may have meant TIM15.

Cube/HAL/CubeMX will hide these things for you in the clicky interface and some "library" code, but sometimes it's better to understand what one does.

JW