I am going through the sensorless example code using the FRDM-MC-LVBLDC and the KV31F but want to know if there is any sample code using hall sensors? The FRDM-MC-LVBLDC supports the use of hall/encoder sensors.
Of course, you can connect the Hall sensor signal to J8 connector on the FRDM-MC-LVBLDC board, it is okay. The three hall signal passes the schemitt trigger(7414) circuit to shape the edge, then connect to FTM2_CH0,FTM2_CH1,FTM1_CH1 pins, user can set up the FTM2 and FTM1 in capture mode so that the capture ISR is entered once the hall rsing/falling edge is detected, meanwhile, user can read the pin logic via GPIO input register to know the hall signal logic.
You can download sensorless BLDC code from here:
3-Phase Brushless DC Motor Control Design|NXP
Hope it can help you
Thanks for your help. I have been working on this and have got it to the following state. I use FTM0 to carry out edge aligned complimentary pwm on the first 6 channels. I have the ISR for FTM0 set to a priority level of 1. I have a PIT which is interrupted every 100ms. I have a gpio pin set to interrupt on a falling edge with a priority of 4 (I use this as a switch to set a motor running state). The problem I am experiencing now is that when I set the state to motor running the gpio interrupt does not work anymore and the motor keeps running without a way to stop it (other than reset or remove power). When the motor doesnt have any power and I change this gpio state I can keep changing it even though in software the same FTM0 pwm code should be running since the motor running state is being set and reset. I am not sure if this is a priority issue or something else.
Also when commutating the motors I read their state in the FTM0 isr and if the state has changed I commutate using the following function, FTM_UpdatePwmDutycycle(FTM0, 1, kFTM_EdgeAlignedPwm , duty_cycle);
with the channel changing according to the rotor position.
It seems like I had an unhandled port interrupt which was causing things to get stuck. Adding a dummy isr for the port fixed the issue. Is this true?
I think that the GPIO interrupt has not opportunity to be executed because of low interrupt priority. Pls check the follwoing items.
1)The FRDM-KV31F populate MKV31F512VLL12 microcontroller, which can run in120MHZ, pls check if the KV31 run in 120mhz so that the GPIO ISR have opportunity to be executed.
2)increase the GPIO interrupt priority by lowing the GPIO IPRx register value.
Retrieving data ...