Regarding your question, I see that you would like to insert a shunt resistor or the other current sensor to measure the DC bus current, and use the current loop as the internal loop. Unfortunately, for BLDC motor control, we have the solution to use only speed loop, the speed loop output via PI or PID algorithms will change the duty cycle of PWM directly in about 1mS cycle time and drive MOSFET/IGBT directly to change the impressed voltage on the motor. We have not the solution to use speed loop as outer loop, use current loop as internal loop. In dual loop solution, the speed loop output via PID/PI is the input current reference for current loop, after we get the actual current spec via shunt resistor, compute the error between the input current reference and the actual current, figure out the duty cycle of PWM signal via current PI/PID based on the error and drive MOSFET/IGBT in about 1mS cycle time.

In conclusion, from hardware, connect the shunt resistor to the DC bus between GND and node of 3 branches, let ADC sample the resistor voltage at the center of PWM signal, the FTM has 8 channels, you can use one FTM channel( which do not generate PWM) to set the sampling instant to implement the ADC sampling at the center of PWM signal. From software, the outloop is the speed loop, which can output the reference spec for the current loop, use the current loop as internal loop, whose output is the duty cycle time of PWM.

I suggest you refer to an1931, which uses FOC algorithms to control PMSM, but it uses both speed and current loop and use shunt resistor.

Hi, Wittawas,

Regarding your question, I see that you would like to insert a shunt resistor or the other current sensor to measure the DC bus current, and use the current loop as the internal loop. Unfortunately, for BLDC motor control, we have the solution to use only speed loop, the speed loop output via PI or PID algorithms will change the duty cycle of PWM directly in about 1mS cycle time and drive MOSFET/IGBT directly to change the impressed voltage on the motor. We have not the solution to use speed loop as outer loop, use current loop as internal loop. In dual loop solution, the speed loop output via PID/PI is the input current reference for current loop, after we get the actual current spec via shunt resistor, compute the error between the input current reference and the actual current, figure out the duty cycle of PWM signal via current PI/PID based on the error and drive MOSFET/IGBT in about 1mS cycle time.

In conclusion, from hardware, connect the shunt resistor to the DC bus between GND and node of 3 branches, let ADC sample the resistor voltage at the center of PWM signal, the FTM has 8 channels, you can use one FTM channel( which do not generate PWM) to set the sampling instant to implement the ADC sampling at the center of PWM signal. From software, the outloop is the speed loop, which can output the reference spec for the current loop, use the current loop as internal loop, whose output is the duty cycle time of PWM.

I suggest you refer to an1931, which uses FOC algorithms to control PMSM, but it uses both speed and current loop and use shunt resistor.

pls download an1931 from the website:

http://tinyurl.com/n5lzwyzBRXiangJun Rong