cancel
Showing results for 
Search instead for 
Did you mean: 

how to connect the interface timer to the PWM generating timer using DMA on a STM32G4 for BLDC motor coordination using three (U-V-W) Hall Sensors?

TB
Associate III

I want to use an STM32G4 to control a BLDC motor with three (U-V-W) Hall Sensors (through a TI DRV8323S three-phase integrated gate driver). To be concrete, I am planning on using TIM1 on the STM as the interfacing timer to detect state changes (on U-V-W), and TIM20 to generate the 1x or 3x PWMs necessary to instruct the DRV8323S what to do next. I understand that DMA can be used to trigger TIM20 that a change in phase on the U-V-W channels has been detected by TIM1, bypassing any involvement at all by the Cortex M4 core. This sounds slick. Two questions:

1) Is there an accessible tutorial online somewhere with the details of how to set up the code on an STM32 to make such a bridge between timers (through DMA, bypassing the ARM core) for BLDC motor control with Hall sensors? I haven’t found it yet…

2) Though I understand it is not ideal, about how much additional latency (and, thus, motor-inefficiency) is added (say, for a typical max motor speed of 5,000 RPM, with say about 15 pole pairs) on a (170 MHz… fast!) STM32G4 by issuing an IRQ, flagged by the NVIC, to trigger the CPU to update the PWMs issued by TIM20 (assuming for the moment that nothing else is running on the ARM core to get in the way)?

Thanks heaps!

- Tom

1 REPLY 1
Laurent Ca...
Lead II

Dear @Bacteriusewley​ 

Welcome to the STM32 Community

Sorry for the late answer.

Do you have still this problem to solve?

And just in case, if not, do not hesitate to share the final solution you found. Thanks by advance.

Best regards

Laurent Ca...