simplefoc / Arduino-FOC

Arduino FOC for BLDC and Stepper motors - Arduino Based Field Oriented Control Algorithm Library
https://docs.simplefoc.com
MIT License
2.03k stars 521 forks source link

encodor miss interrupt with Arduino Espressif version 2.06 #268

Open Vorms opened 1 year ago

Vorms commented 1 year ago

From SimpleFoc I use only the encodor software. I run with Esp32 wroom. The software i wrote is for a cnc using dc motor. Whe I use the arduino espressif esp32 version 1.06 the application run perfectly. When I update the compiler using version 2.06, the encodor miss some interrupts. Revert to version 1.06 fix the problem. I see on the web, esp32 has hardware counters (PCNT). Is some body using PCNT ? Is it a good idea to replace interrupts pb PCNT ?

Regards

askuric commented 1 year ago

Hey @Vorms,

I did not have such issues on my part so far but it is possible that they did change some interrupt handling routines from one release to the other.

In the case of the cnc, I would certainly suggest using PCNT if possible. If you still want to use simplefoc then you can implement it in the form of a GenericSensor. I've actually tried it already and I was pleased with the result. Here is the example implementation. https://community.simplefoc.com/t/generic-position-sensor-class-new-sensor-easier-to-support/1491/2?u=antun_skuric

Btw, from recently we also have a DC motor implementation of the library https://github.com/simplefoc/Arduino-FOC-dcmotor Its still very much in its initial stage, but so far we had good results with it.