Skip to main content
Visitor II
May 29, 2024
Solved

Problem with TIM3 Input capture with DMA

  • May 29, 2024
  • 3 replies
  • 1165 views

Hello everybody,

I am trying to use the TIM3 those input capture mode with DMA transfer. After buffer is full the DMA call the callback function IT. Then i execute the stop DMA function. But after this sequence, the DMA no reinitialize. I am using the Cube MX for initialize the code.

What could I be doing wrong?

I am using the STM32C011F6P6

 

 

The code:

uint16_t period_buffer[52];

HAL_TIM_IC_Start_DMA(&htim3, TIM_CHANNEL_1, (uint32_t*) period_buffer, 52);

 

 

void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
{
       HAL_TIM_IC_Stop_DMA(&htim3, TIM_CHANNEL_1);
}

    This topic has been closed for replies.
    Best answer by VSchu.1

    I'm operating in normal mode, I had to include one more command to solve the problem:

    void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
    {
           if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1)
          {
                  HAL_TIM_IC_Stop_DMA(&htim3, TIM_CHANNEL_1);
     
                  HAL_DMA_Abort(&hdma_tim3_ch1); //this solves the problem
         }
    }

    3 replies

    ST Employee
    May 30, 2024

    Hello @VSchu.1

    Please share your DMA configuration

    I suppose you're configuring DMA in circular mode, if you're using normal mode you need to reinitialize the DMA transfer manually in the callback function. 

     

    VSchu.1AuthorAnswer
    Visitor II
    June 3, 2024

    I'm operating in normal mode, I had to include one more command to solve the problem:

    void HAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim)
    {
           if(htim->Channel == HAL_TIM_ACTIVE_CHANNEL_1)
          {
                  HAL_TIM_IC_Stop_DMA(&htim3, TIM_CHANNEL_1);
     
                  HAL_DMA_Abort(&hdma_tim3_ch1); //this solves the problem
         }
    }
    ST Employee
    May 30, 2024

    Hello @VSchu.1 

    In order to reproduce the possible issue, could you please provide more details on your setting project if possible, attach your .ioc file/configuration.

    Super User
    May 30, 2024

    > But after this sequence, the DMA no reinitialize.

    What does this mean?

    What are the symptoms, and how are they different from the expected behaviour?

    JW