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

Add PICO SDK support for RP2040 specific driver #242

Closed dacoolinus closed 1 year ago

dacoolinus commented 1 year ago

I am working on a platformIO project targeting the RP2040 using the WIZIO-PICO framework. The Simple-FOC library for platformIO drops in almost flawlessly with the exception of the RP2040 specific driver. The problem is the pwm_gpio_to_slice_num function. In the PICO SDK this is included with the "hardware/pwm.h" header. If I add this to the rp2040_mcu.cpp file, everything works correctly.

Could there be an additional flag added to the driver? Maybe TARGET_RP2040_BAREMETAL or something similar to include this header file?

runger1101001 commented 1 year ago

Hey, if you have a chance you could try the version of the library from the dev branch on GitHub. Another user has recently submitted the same bug, and we have fixed it on the dev branch.

It now compiles for both the earlehillpower framework as well as the official one. It would be cool to know if it works on the WIZIO-PICO framework too...

runger1101001 commented 1 year ago

The fix has been merged in the 2.3.0 release.