2025-01-08 06:06 AM - last edited on 2025-01-08 06:07 AM by SofLit
Hi,
I'm using a Riverdi RVT50HQSFWN00 Screen with the STM32U5A9NJH6Q MCU. COnnected to pin PI0 is a WS2812 LED light strip. I already configured the timer 5 channel 4 for PWM generation and validated it with a scope at the pin. Right now I'm stuck at the GPDMA part. I'm able to start the PWM generation using: HAL_TIM_PWM_Start_DMA(&htim8, TIM_CHANNEL_1, (uint32_t *)pwmData, indx);
For the code I followed this tutorial: https://controllerstech.com/interface-ws2812-with-stm32/
This is my timer configuration (TIM5 global interrupt enabled):
This is GPDMA configuration:
Using a scope, I see that a PWM signal is generated but the HAL_TIM_PWM_PulseFinishedCallback() function is never called, which in the end, stops the DMA transfer.
Would really appreciate any help.
Best regards
Marko
2025-01-08 08:43 AM
Hello @m4rk0401,
In your GPDMA configuration, in the destination data setting, try enabling the destination address increment after transfer
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-01-09 06:44 AM
Thanks @Sarra.S for your quick response. I tried your suggestion without success.
I tried some more debugging today and achieved following result:
Code (reduced to most important parts) - app_freertos.c:
int datasentflag = 0;
extern TIM_HandleTypeDef htim5;
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim)
{
HAL_TIM_PWM_Stop_DMA(&htim5, TIM_CHANNEL_4);
datasentflag=1;
}
uint16_t pwmData[24];
void test()
{
for(int i=0; i<24; i++)
{
pwmData[i] = 50;
}
HAL_TIM_PWM_Start_DMA(&htim5, TIM_CHANNEL_4, (uint32_t *)pwmData, 24);
/*
while (!datasentflag){};
datasentflag = 0;
*/
}
void StartDefaultTask(void *argument)
{
/* USER CODE BEGIN defaultTask */
/* Infinite loop */
for(;;)
{
test();
osDelay(100);
}
/* USER CODE END defaultTask */
}
GPDMA configuration:
Timer configuration is the same because basic PWM generations works.
Unfortunately is set 24 different duty cycles in my code and get following result using a oscilloscope:
Any idea why only 14 cycles are outputted?
Best regards
Marko