How to configure DMA to change PWM frequency (led strip controlling through one-wire protocol)?
Hi! I am configuring DMA to generate a PWM signal to control addressable LEDs with an STM32563VGTx MCU.
My issue arises when generating the PWM signal using DMA. When calling the "HAL_TIM_PWM_Start_DMA" function, it executes without any errors, and the finished callback is triggered, indicating the completion of the data transmission. However, i am not able to see the data displayed on the logical analyzer.
I have verified the signal generated with a logic analyzer, and at all times, the signal remains at 0. I believe the error is not so much in the code but in the configuration of DMA and PWM.
Thanks for your help.
This is my GPDMA configuration:

This is my PWM configuration:

This is my Clock configuration:

Main code:
void HMILed_create(uint8_t numLEDs,TIM_HandleTypeDef *htim,uint32_t channel_timer, DMA_HandleTypeDef *hdma)
{
CEXCEPTION_T e;
Try
{
if (numLEDs == 0 || htim == NULL || hdma == NULL || (channel_timer != TIM_CHANNEL_1 && channel_timer != TIM_CHANNEL_2 && channel_timer != TIM_CHANNEL_3 && channel_timer != TIM_CHANNEL_4))
{
Throw(EMBL_WRONGPARAMS);
}
theHMILed.numLEDs = numLEDs;
theHMILed.htim = htim;
theHMILed.hdma = hdma;
theHMILed.channel_timer = channel_timer;
}
Catch(e)
{
Throw(e);
}
}void Send_LEDs (void)
{
HAL_TIM_PWM_Start_DMA(theHMILed.htim, theHMILed.channel_timer, (uint32_t *)pwmData, 434);
while (!theHMILed.datasentflag){};
theHMILed.datasentflag = 0;
}void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim)
{
HAL_TIM_PWM_Stop_DMA(theHMILed.htim, theHMILed.channel_timer);
theHMILed.datasentflag=1;
}
Setup:
HMILed_create(16,&htim3,TIM_CHANNEL_4, &handle_GPDMA2_Channel1);
Set_LEDs(RED);
Send_LEDs();
