Deepak Status Report 10/5/2019
This week I got the STM32’s PWM working and set it properly. This means making the PWM center-aligned, rather than edge-aligned, and inserting dead time as described in last week’s blog post. The PWM works fine, and Bolaji was able to use it to get the motor slowly spinning. The next thing I worked on was getting UART to work. It was fairly easy to set up in blocking mode, but it ended up causing a problem. The amount of time the STM32 took to send UART data (even at a very high baudrate) was noticeably interrupting the rudimentary motor control loop. In order to deal with this, I tried to set up the UART to use the DMA. It initially didn’t work, but I found out online that the UART global interrupt must be enabled to make UART work with the DMA. This was not documented in the STM32 reference manual, and was only mentioned in a comment inside the manufacturer’s driver code. After fixing this, UART began sending but much of it was corrupted.
For now, I will move on to getting the ADC working and triggering based on the PWM timer, since sensing the motor phase voltages and currents is more important than having non-blocking UART.