Skip to main content
Visitor II
May 25, 2022
Question

Default Timer configuration for DAC stm32mp1 cortex M4.

  • May 25, 2022
  • 1 reply
  • 986 views

Hi

We are using stm32mp157a processor in my custom board.We want to configure DAC in cortex M4.In stm32h745xi DAC has Default Timer for interrupt.Where as in stm32mp157a we dont have that timer configuration for DAC .you can see the difference in below attachments.

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    May 25, 2022

    Hi @Sindhu Vadde​ ,

    that's normal, on STM32H7, due to legacy or shortage of NVIC inputs, the TIM6 and DAC interrupts share the same interrupt line.

    In STM32MP15x, there is separate TIM6 and DAC interrupts, which add more flexibility and could reduce amount of code in interrupt handler.

    Regards,

    In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

    Visitor II
    May 25, 2022

    Thanks for the reply,

    My code flow :

    HAL_TIM_Base_Start(&htim2);

    calcsin ();

    HAL_DAC_Start_DMA(&hdac1,DAC_CHANNEL_2,sine_val,100,DAC_ALIGN_12B_R);

    Sine Function Implementation:

    void calcsin ()

     {

        for (int i=0; i<100; i++)

        {

           sine_val[i] = ((sin(i*2*PI/100) + 1)*(4096/2));

        }

     }

    Timer Configuration :

    htim2.Instance = TIM2;

     htim2.Init.Prescaler = 64-1;

     htim2.Init.CounterMode = TIM_COUNTERMODE_UP;

     htim2.Init.Period = 100-1;

     htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;

     htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;

     if (HAL_TIM_Base_Init(&htim2) != HAL_OK)

     {

       Error_Handler();

     }

    .

    but we are uanable to get Timer Interrupt and also unable to generate Sine wave.How can i can i generate sine wavet hrough Dac? What maybe the issue with above configuration?