I have a general question about overrunning the fast thread, and potential problems that could result from this. I am asking this because I had 2 PRINTFs in some untested code that printed when the 400V incoming was shut off. This occurred while I was regulated 0 position. I am using UART1, and it looks like the PRINTF function uses the UART_WriteBlockTransfer() function. Therefore at 115200k my 2 PRINTFs would have took around 6ms to print to the console. My fast thread was running at 250us so I overran it by quite a bit.
3 times I ended up causing a DESAT on my IGBTs because of this. I have now removed the PRINTFs, but am trying to identify if this was the root cause of the problem.
I see that on initialization the current, speed, feedback, and encoder blocks all have time constants pulled from the system.h file. Therefore, when the fast thread was overran, all of the next calculations for these blocks would have been off? Could this in turn cause one of the phases to latch at a constant voltage or 100% PWM. This is what I am seeing my system do with the PRINTFs when 400V incoming AC is shut off. I do not see this with the PRINTF removed:
Blue = Differential Probe Between Phase A->B
Yellow = Incoming 400V AC
Purple = Differential Probe Between Phase B->C