2024-04-17 11:33 PM
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);
Solved! Go to Solution.
2024-04-17 11:51 PM
> 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
2024-04-17 11:51 PM
> 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
2024-04-17 11:52 PM
thanks for answer. i think it has written only length.