cancel
Showing results for 
Search instead for 
Did you mean: 

hdma_tim1_ch1.XferCpltCallback = TransferCompleteCallback; IS NOT TRIGGERIING

thannara123
Senior

I am transfering data array from an array to PWM register of TIM1.

int16_t sin_table[20]= { 0, 39, 77, 113, 147, 177, 202, 223, 238,247, 250, 247, 238, 223, 202, 177, 147, 113, 77, 39};

HAL_TIM_PWM_Start_DMA(&htim1, TIM_CHANNEL_1, (uint32_t *)sin_table, 20);

And i am trying to blink in complete transfer callback fuction as follows .

void TransferCompleteCallback(DMA_HandleTypeDef *hdma) {
{  
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
 
}

 

I am getting PWM signal as expected . but trigger the  TransferCompleteCallback).

by using break poiint the DMA Inerupt Handler triggers but not trigger the callback i said . 

 

whats the wrong am with please help me .

i am attaching the full code here 

 

aNY BODY HELP ME 

 

 

3 REPLIES 3
thannara123
Senior

Any help ?

 

MM..1
Chief II

Seems you missunderstan HAL callbacks ... read examples in folder repository firmware for your MCU...

You mark all MCUs, this isnt very helpfull. For example F4 from stm32f4xx_hal_tim.c func HAL_TIM_PWM_Start_DMA

 

switch (Channel)
  {
    case TIM_CHANNEL_1:
    {
      /* Set the DMA compare callbacks */
      htim->hdma[TIM_DMA_ID_CC1]->XferCpltCallback = TIM_DMADelayPulseCplt;
      htim->hdma[TIM_DMA_ID_CC1]->XferHalfCpltCallback = TIM_DMADelayPulseHalfCplt;

 

thannara123
Senior

Hi Thanks , I didnt find any examples related DMA transfer complete  function trigger based projects .

 

Hi may i need to register the following function to trigger the calla back function 

HAL_DMA_RegisterCallback(&hdma, HAL_DMA_XFER_CPLT_CB_ID, My_DMA_TransferCompleteCallback);

 

Or any other way to do this , is there tutorials or mannual for it ?