Skip to main content
Graduate
January 26, 2024
Solved

HRTIM burst DMA doesn't work

  • January 26, 2024
  • 2 replies
  • 1817 views

Hallo,

I want to update MASTER CMP1 over DMA and the others TIM_x on MASTER-update.

New values of CMPx registry are calculated in SysTick_Handler() and should be updated at once.

The problem is: MASTER update on DMA does not work.

Could anyone please look at my tiny project? It is maintained over CubeMX.

https://github.com/Maciej1975/HRTIM_3Phase/tree/master

 

Kind Regards

    This topic has been closed for replies.
    Best answer by DrDro

    It seems, I have found solution.

    The line:

    pTimerCfg.UpdateGating = HRTIM_UPDATEGATING_DMABURST_UPDATE;

    cannot be set inside CubeMX, but it works as I expect. TIMER_A .. C are updated only when MASTER.CMP gets update over DMA.

     

    Kind Greetings

    2 replies

    ST Employee
    January 26, 2024

    Hello @DrDro,

    Here two investigations points :

    • Firstly, you can try to call the function HAL_HRTIM_BurstDMAConfig() to validate the burst DMA operation.

    Please add :

    if(HAL_HRTIM_BurstDMATransfer(&hhrtim1, HRTIM_TIMERINDEX_TIMER_A, (uint32_t) Reg_Update, sizeof(Reg_Update)/sizeof(uint32_t)) != HAL_OK) //Add a breakpoint here
    {
     Error_Handler();
    }

     And check in debug if it works. Let me know.

    • Change RepetitionUpdate value to HRTIM_UPDATEONREPETITION_ENABLED . Indeed, it specifies whether or not registers update is triggered by the repetition event.

    Kind Regards,

    Pierre

    DrDroAuthor
    Graduate
    January 29, 2024

    Hallo Pierre,
    mentioned function HAL_HRTIM_BurstDMAConfig() is already called inside CubeMX generated initialization code, i.e. inside "static void MX_HRTIM_Init(void)". And there is no issue. Yes, I use USE_FULL_ASSERT and I get no error. The function call returns HAL_OK

    I want to if MASTER.CMP1 gets updated. What do I observe with watchpoint at 0x4001741c and SFRs-View. But nothing happens. I get watchpoint only once, as the initial value is written.

     if (HAL_HRTIM_BurstDMAConfig(&hhrtim, HRTIM_TIMERINDEX_MASTER, HRTIM_BURSTDMA_CMP1) != HAL_OK)
     {
     Error_Handler();
     }

     The second crucial function HAL_HRTIM_BurstDMATransfer() is called every 500ms to trigger mentioned DMA transfer.

    • Change RepetitionUpdate value to HRTIM_UPDATEONREPETITION_ENABLED . Indeed, it specifies whether or not registers update is triggered by the repetition event.

     Great! That was the issue. Now I get MASTER.CMP1 changed :thumbs_up: but frankfuly the watchpoint at 0x4001741c does not react on this change.

    Still not solved problem is that another TIMERs: A,B,C should be updated only on MASTER.CMP update but they are written independently.

    DrDroAuthorAnswer
    Graduate
    January 29, 2024

    It seems, I have found solution.

    The line:

    pTimerCfg.UpdateGating = HRTIM_UPDATEGATING_DMABURST_UPDATE;

    cannot be set inside CubeMX, but it works as I expect. TIMER_A .. C are updated only when MASTER.CMP gets update over DMA.

     

    Kind Greetings

    ST Employee
    January 29, 2024

    Hello @DrDro ,

    I am glad to hear that everything is running ! :grinning_face:

    The UpdateGating parameter specifies how the update occurs with respect to a burst DMA transaction or update enable inputs. You choose to do it on timer roll-over following a DMA burst transfer completion.

    Kind Regards,

    Pierre