cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, i'm trying to generate 3ph pwm sinewaves using dma, sine lookup table and timer1.

eugene239955
Associate II
Posted on January 13, 2018 at 00:04

I working with a nucleo-f410rb and atollic truestudio along with cubemx. I can get a channel1 (or 2 or 3) of timer1 to work using HAL_TIM_PWM_Start_DMA but i can not get the three to work together. I've tried using  HAL_TIM_DMABurst_WriteStart by constructing a sine lookup table holding n pairs of three PWM values and trying to 

HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);

HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);

HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);

HAL_TIM_DMABurst_WriteStart(&htim1, TIM_DMABASE_CCR1, TIM_DMA_UPDATE, (uint32_t *)tab_a, TIM_DMABURSTLENGTH_3TRANSFERS);

where tab_a holds the values for CCR1,2,3. 

Can this be done (3 phase pwm sine waves) ? I seem to be missing something basic here.

Thanks,

Gene

1 REPLY 1
T J
Lead
Posted on January 14, 2018 at 22:33

if you want to adjust 3x PWM signals,

under a different timer interrupt with high priority, say every 100uS, write all three PWM values. from your sinewave table.

easier without a DMA,

to use a DMA, you would use a circular buffer for the whole table, but you only have one pointer per DMA

now you need 3 DMAs ?