You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some MCUs are fast enough to run the FOC algorithms from the current sense interrupt.
This was already discussion here in the forum, but it was 3 years ago, maybe the opinions have changed.
This could have several benefits:
Constant dt:
FOC will run at constant dt, this will simplify PID and Filter math and help with performance as there is no need to measure the timestamp and calculate dt (this would be needed).
Better timing:
It makes sure FOC runs on recent phase current data, and duty cycles is applied within the same pwm cycle.
Overcurrent protection
This can be used for cycle by cycle software overcurrent protection.
Sensorless
It allows injection for HFI sensorless algorithm.
HFI also needs to identify V1 and V7, and run different code for each with low side current sensing.
Solution:
Allow the user to set up a callback function as parameter to the current sense class, that will be executed in the current sense interrupt. User should manage the callback to run loopfoc().
The code should not overrun, the interrupts should be disabled before and enabled after the callback.
The text was updated successfully, but these errors were encountered:
One complication is SPI/I2C encoder updating for sensored applications. On ARM chips I can confirm that SPI reads from an ISR work fine presuming there's sufficient time for it to happen, but I'm unsure that's true for any other architecture (AVR/Xtensa/RISCV).
Still it might be advisable to not use the ADC ISR if there's an SPI/I2C sensor. I can't think of a good way to enforce that reliably, so I think that means ISR vs loop execution should be user configurable?
Still it might be advisable to not use the ADC ISR if there's an SPI/I2C sensor. I can't think of a good way to enforce that reliably, so I think that means ISR vs loop execution should be user configurable?
Agreed that the isr vs loop execution should be a flag or otherwise user configurable on mcus that support it.
Some MCUs are fast enough to run the FOC algorithms from the current sense interrupt.
This was already discussion here in the forum, but it was 3 years ago, maybe the opinions have changed.
This could have several benefits:
Constant dt:
FOC will run at constant dt, this will simplify PID and Filter math and help with performance as there is no need to measure the timestamp and calculate dt (this would be needed).
Better timing:
It makes sure FOC runs on recent phase current data, and duty cycles is applied within the same pwm cycle.
Overcurrent protection
This can be used for cycle by cycle software overcurrent protection.
Sensorless
It allows injection for HFI sensorless algorithm.
HFI also needs to identify V1 and V7, and run different code for each with low side current sensing.
Solution:
Allow the user to set up a callback function as parameter to the current sense class, that will be executed in the current sense interrupt. User should manage the callback to run loopfoc().
The code should not overrun, the interrupts should be disabled before and enabled after the callback.
The text was updated successfully, but these errors were encountered: