2024-07-31 11:26 PM - edited 2024-08-01 12:07 AM
I am trying to use DMA with PWM data on STM32 I need clarification on few parameters setting and facing few issues.
Q1.
While configuring DMA for PWM data in tha CUBE MX, there is a option for increment Address and selector for Peripheral or Memory.
What does it mean?
Q2. What does Use FIFO option means, if turned on
Q3. Data Width selector, there are options for byte, Half word and Word. Does that means it will transfer that amount of data at each DMA transfer?
NEXT TOPIC
It works fine when PWM is started manually with a single CCR1 value
TIM1->CCR1 = 10;
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
Q3.while using DMA to transfer an array of 16 bit data to the PWM register with the DMA configuration of data width selected to half word, as we will be sending 16 bit data to CCR register of PWM channels, when i am starting a DMA transfer of array of size 10 i see total garbage
/* USER CODE BEGIN 0 */
uint16_t pwmdata[10] = { 12, 15, 20, 30, 40, 50, 60, 70, 80, 90 };
/* USER CODE END 0 */
/* USER CODE BEGIN 2 */
HAL_TIM_PWM_Start_DMA(&htim1, TIM_CHANNEL_1, (uint32_t*) pwmdata, 10);
/* USER CODE END 2 */
DMA SETTING
OUTPUT DATA
it is in the normal mode, but I see some continuous garbage via logic analyzer
After that just changing the DMA setting to the circular mode, it works fine and when put it into normal mode it starts printing garbage.
Can you please suggest where i am missing some configuration or where i am doing something wrong.