cancel
Showing results for 
Search instead for 
Did you mean: 

I need to have a function that is being called everytime my DMA transfered all the data to my LEDs. How can I do that? Thanks for your answers!

ARey.17
Associate

Hi everyone! I am using STM32F446RE for a project of Tetris with a LEDs matrix (WS2812B). To communicate with my LEDs, I call HAL_TIM_PWM_Start_DMA(&htim2, TIM_CHANNEL_4, (uint32_t*)pixelsBuff, (uint16_t)pixelsBuffSize) every 500 ms. And this works well. 

Recently, I have added control of my game with a N64 controller. But I only want to check the boutons' state when I'm not sending data to my leds... For that, I need a function that is being called at the end of DMA transfer. But I am having a really hard time understanding how to do that. I tried calling HAL_DMA_RegisterCallback(&hdma_tim2_up_ch4,HAL_DMA_XFER_CPLT_CB_ID,dmaTCFunction) at the beginning of my code, dmaTCFunction being a function that I wrote. But dmaTCFunction is never called.... If I call HAL_DMA_RegisterCallback(&hdma_tim2_up_ch4,HAL_DMA_XFER_HALFCPLT_CB_ID,dmaTCFunction) at the beginning of my code, dmaTCFunction is being called each time. So I don't understand why it does not work for transfer complete.....

To summarize, I need to have a function that is being called everytime my DMA transfered all the data to my LEDs. How can I do that?

0 REPLIES 0