Does Simple FOC support Teensy board?

Hi,
Does anyone know if SimpleFOC is Teensy compatible? more specifically teensy 4.1.
Thanks

Hey @navid360,
The dev version of the library supports Teensy boards.

Hi Antun, I’m just trying to use the library with a TEENSY 4.1 with SimpleFOC 1.6, but while compiling It gives this error with the function analogWriteFrequency(), which needs 2 parameters, instead of one:

/home/dab/Arduino/libraries/Simple_FOC/src/common/hardware_utils.cpp: In function 'void _setHighFrequency(long int, int)':
/home/dab/Arduino/libraries/Simple_FOC/src/common/hardware_utils.cpp:116:28: error: too few arguments to function 'void analogWriteFrequency(uint8_t, float)'
   analogWriteFrequency(freq); 
                            ^
In file included from /home/dab/arduino-1.8.13/hardware/teensy/avr/cores/teensy4/wiring.h:39:0,
                 from /home/dab/arduino-1.8.13/hardware/teensy/avr/cores/teensy4/WProgram.h:45,
                 from /tmp/arduino_build_435474/pch/Arduino.h:6,
                 from /home/dab/Arduino/libraries/Simple_FOC/src/common/hardware_utils.h:4,
                 from /home/dab/Arduino/libraries/Simple_FOC/src/common/hardware_utils.cpp:1:
/home/dab/arduino-1.8.13/hardware/teensy/avr/cores/teensy4/core_pins.h:1718:6: note: declared here
 void analogWriteFrequency(uint8_t pin, float frequency);
      ^
Errore durante la compilazione per la scheda Teensy 4.1.

Is this only about newest Teensy 4.x? Are you aware of this?

EDIT:
I’ve changed around line 116 of “hardware_utils.cpp” like that and it compiles:

#elif defined(arm) && defined(CORE_TEENSY) //if teensy 3x / 4x / LC boards
// configure High PWM frequency
void _setHighFrequency(const long freq, const int pin){
analogWrite(pin, 0);
analogWriteFrequency(pin, freq);
}
#endif

AND it works…

Hey @dab,

Thanks for the heads up. I was not aware of this, I’ll update the library right away.

There are many different changes coming from few authors now, so some of them slip through the fingers sometimes. :smiley:
If you find some other inconsistencies please do not hesitate to post it or make a github issue!

Thanks

Just found this thread about teensy 4.0 H-bridge config.

Juan;
Are you still working on this? …great idea!