2021-12-13 02:34 AM
I'm using the P-NUCLEO-IHM001 (Nucleo-F302R8 + X-NUCLEO-IHM07M1 + BR2804-1700KV-1) pack, with MCSDK-v5.Y.2 and CubeMX - v6.3.0 with default settings.
The project loads into the MCU and the motor spins at some speed when pressing the user button on the Nucleo board - i.e. all is well. However, when interfaced with UART, and using the ST Motor Pilot, then the state machine goes into FAULT_OVER state with error message "FOC duration".
What does this mean and why do I get this fault ?
BTW, the behaviour of the motor when leading up the error is different every time the state machine is reset (i.e. after fault is acknowledged) and entering "Run" mode ( i.e. pressing the "Start" command). Sometimes it goes right back into fault and sometimes it ramps up the speed - seemingly going into FOC mode. I.e. the behaviour is not deterministic.
2021-12-13 05:06 AM
Hello @Community member ,
"FOC duration" error occurs when the algorithm did not succeed to compute the next duty cycle of the phases before the next PWM cycle.
It does not depend on the motor speed.
What is the PWM frequency ?
If you observe a different behavior when the Motor Pilot is connected, then you could try to modify the following line in main.c :
HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 0, 0);
With this one :
HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 3, 0);
Doing this the UART communication will not impact anymore the CPU bandwidth allocated for the FOC algorithm.
Could you give it a try and tell us if it solves your issue ?
Regards
Cedric
2021-12-13 05:46 AM
Hi Cedric.
Great - changing the NVIC priority of the of the DMA helped with the FAULT_OVER state.
However, the communication seems to be struggling a bit now.
I can start the motor by pressing the "Start" button in the Motor Pilot.
But when the motor is running, then I get a lot of "ERROR:ASPEP PACKET ERROR Bad CRC Header" messages and I'm not able to stop it via the Motor Pilot GUI.
2021-12-13 05:51 AM
BTW - if I check my "Drive Settings" in the "Firmware" tab of the Motor Control workbench, I see a PWM frequncy of 30 kHz...
2021-12-13 06:07 AM
Ok, PWM frequency @30Khz, is really the limit you can achieve with STM32F302, so adding extra workload with the UART end up with FOC duration.
One thig you can do is to reduce the PWM frequency. 20Khz for instance will give you a comfortable margin.
It is weird that the communication is now struggling. What is the version of the pilot do you use ?
If the DMA priority is now too low, a good trade-off would be to set it just below the FOC algo interrupt, then you could try this :
/* ADC1_IRQn interrupt configuration */
HAL_NVIC_SetPriority(ADC1_IRQn, 1, 0);
HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 2, 0);
Could you confirm that you configured your X-NUCLEO-IHM07M1 in 3 shunts ?
Cedric
2021-12-14 03:15 AM
Hi Cedric :)
I'm using the Motor Pilot - v0.9.7.
The suggested changes of the NVIC priorities did not help with the communication.
When the state-machine is in IDLE, then RX data reads "ASPEP_RESP MCP Cmd OK" and the UART seems fine.
I can press "Start" and the command gets communicated just fine.
However, when the motor is running, then immediately I get the "ERROR:ASPEP PACKET ERROR Bad CRC Header" message, and the communication stops working.
Furthermore, if I stop the motor by pressing the user-button on the Nucleo board, then the state-machine goes back into IDLE state and the communication starts working again.
The 3-shunt pins are the ones on the left and right side of the MCU on the driver board.
They are both in 3-sh configutation
2021-12-14 05:49 AM
Hello @Community member ,
"The suggested changes of the NVIC priorities did not help with the communication."
Indeed, I realized afterward that the pilot coming with 5.Y.2 is to old.
Could you try with the MCSDK 5.Y.3 ? it is delivered with motor Pilot 0.9.9 which allows to decrease the UART DMA RX interrupt priority.
Best Regards
Cedric
2021-12-14 06:06 AM
Oh. Then I need to wait for approval. Our project is cleared for the full SDK, but the download link was for the 5.Y.2 version.
I've just applied to get the newer version of the MC SDK.
2021-12-14 06:14 AM
You can download the non ful version and uses only the Pilot from it.
Cedric
2021-12-14 07:16 AM
Now I'm using the 5.4.7 version of the regular MC workbench.
When interfaced with the “Monitor�? software, the communication seems fine – with a baudrate of 115200 for the UART.
Perhaps the baudrate of the "Motor Pilot" (1843200) was to high ?