cancel
Showing results for 
Search instead for 
Did you mean: 

How do I update the HRTIM master timer compare 1 register using DMA from a circular buffer?

PVo.2
Associate

I'm using the Nucleo STM32G474RTE board and the LL drivers for DMA, GPIO and HRTIM and the CUBEMX in the IDE. My goal here is to drive a full H-Bridge with 4 PWM signals having the needed deadband and duty cycle control.

Using the LL libraries and CUBEMX in the IDE, I have this working using the HRTIM master timer and timers A and B driven by the master timer and inserting deadtime -- just what I need:

0693W00000QLwMfQAL.pngI can change the duty cycle by writing to the master timer compare 1 register in code using:

LL_HRTIM_TIM_SetCompare1(HRTIM1, LL_HRTIM_TIMER_MASTER, myDutyCount);

However, I want to automate the duty cycle updates once each PWM period using DMA from a circular buffer. How do I do this?

This would seem to be a standard thing to do, yet there are no examples of exactly this. The TIM_DMA_Init example uses Tim1, but the HRTIM Master Timer seems to be very different. For instance, in the example there is this line of code:

LL_DMA_ConfigAddresses(DMA1, LL_DMA_CHANNEL_5, (uint32_t)&aCCValue, (uint32_t)&TIM1->CCR3, LL_DMA_GetDataTransferDirection(DMA1, LL_DMA_CHANNEL_5));

I've tried with no success to modify this line of code to provide the DMA with the Master Timer's compare 1 register as its destination.

Anyway, I want to drive a full bridge with 4 synchronized high resolution PWM signals having deadtime and duty cycle control, where the duty cycle is simultaneously updated for all 4 PWM via DMA from a circular buffer. Perhaps someone with more experience knows a better way to use the HRTIM for this? I'm not using Timers A-F for anything else so they are free to be used here. Is there an app note that directly addresses this basic application? I'm new to ST Micro -- the docs and parts are excellent so far, but this has me stumped and frustrated.

0 REPLIES 0