cancel
Showing results for 
Search instead for 
Did you mean: 

DMA Requests - CubeMX - Memory to Peripheral setup questions

Swyftfeet
Associate II

Complete noob in both uCs and C trying to understand how to actually read the documentation and where to look for the answers.

I am using CubeMX to generate a majority of my code and using HAL.

I have succesfully got DMA transfer to update different timer parameters by following example code from youtube and other locations:

  • Create a data Arrray
  • Trigger Event Selection :  Update Event
  • Select TIMxUP DMA request  (Mem to peripheral, Word, Circular)
  • HAL_DMA_Start(hdma, SrcAddress, DstAddress, DataLength)
  • TIMx->DIER |= (1<<8)

Ok for most part I am just poking around changing the array and destinations to view the signal results.   Cascading timers;  using timers as the input clock to other timers; using timers to update different registers on other timers.  Just exploring at an extremely basic level.

 

Some timers do not have the TimxUP DMA event and have selections like TIMxUP/CH1  or TIM8/CH1/CH2/CH3.

After several nights I am just hitting a wall.  Valley of Despair.  I cannot figure out how to use these different "Requests" in my code or how to use them to move data from an array to a destination.   

HAL_TIM_OC_Start_DMA(htim, Channel, pData, Length)

Why does the update event have a destination and this not?  Can I use the toggle functionality on a timer channel to DMA from an array to another timers PSC ?

 

 

1 REPLY 1
TDK
Guru

> Why does the update event have a destination and this not?

This varies the output register (CCRx) as that's implied by the HAL_TIM_OC_Start_DMA name. It wouldn't make sense to have any different destination.

> Can I use the toggle functionality on a timer channel to DMA from an array to another timers PSC ?

You can, but you'll need to set it up yourself. There might be HAL_DMA_* functions that can set it up for you, but you can also use direct register access.

HAL sets up most common scenarios. If you want to do something more exotic, especially with timers which have so many different configuration options, expect to write some of it yourself.

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