You are here

Hard faults in mcpwm_foc.c?

1 post / 0 new
Last seen: 5 years 2 months ago
Joined: 2018-12-31 03:14
Posts: 1
Hard faults in mcpwm_foc.c?


I have been compiling the VESC firmware and have successfully gotten it operating in BLDC mode. However when I try to use the FOC functionality, I keep getting an IACCVIOL hard fault (Instruction access violation). It is reproduced by sending a brake current (any brake current) to the motor, or attempting to run the inductance measurement. 

The FOC control loop seems to run fine to the extent that control_duty gets set properly, and the mcpwm_foc_adc_int_handler runs to completion every time I stop it at the end with a breakpoint. However when I free-run the loop, it inevitably will hard fault in a few hundred milliseconds. 

Any idea what could be wrong?


I added default conditions to the switch statements to prevent the processor from making random jumps, now I am seeing the IACCVIOL bit is clear and the INVSTATE bit in the USER fault status register is set. I am not sure yet what that means.