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.