cancel
Showing results for 
Search instead for 
Did you mean: 

Timer + DMA problem

nimaltd
Senior

I am using TIM+DMA, and the main problem is that the first value should be loaded into ARR before the timer starts, but it is not. Also, regarding length, if it should be set in bytes, it should be clearly documented in a comment for that function, which currently it is not.

 uint32_t val_tim[] = {1500, 1200, 2000, 3000, 4000, 5000};

HAL_TIM_Base_Start_DMA(&htim2, val_tim, 6 * 4);

1 ACCEPTED SOLUTION

Accepted Solutions

> the first value should be loaded into ARR before the timer starts, but it is not.

You have to write it "manually". Note, that if you've set ARR preload (TIM_CR1.ARPE), you need to generate an Update to get the new ARR value valid.

>  it should be clearly documented in a comment for that function, which currently it is not.

And what does that comment say? 

IMO it takes number of transactions rather than bytes, but I don't use Cube/HAL.

JW

View solution in original post

2 REPLIES 2

> the first value should be loaded into ARR before the timer starts, but it is not.

You have to write it "manually". Note, that if you've set ARR preload (TIM_CR1.ARPE), you need to generate an Update to get the new ARR value valid.

>  it should be clearly documented in a comment for that function, which currently it is not.

And what does that comment say? 

IMO it takes number of transactions rather than bytes, but I don't use Cube/HAL.

JW

thanks for answer. i think it has written only length.