Errors compiling Simplefoc for Teensy 3.2

Getting a series of errors regarding FTM3 on teh Teensy 3.2., Teensy 3.2 is not supposed to have an FTM3. Why is this happening?

Latest download of SimpleFOC is installed.
Using Arduino IDE 1.8.15

Arduino: 1.8.15 (Windows 10), TD: 1.54, Board: “Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English”

C:\Users\Mike\Documents\Arduino\libraries\Arduino-FOC-master\src\common\foc_utils.cpp: In function ‘float _sqrtApprox(float)’:

C:\Users\Mike\Documents\Arduino\libraries\Arduino-FOC-master\src\common\foc_utils.cpp:68:21: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

i = * ( long * ) &y;

                 ^

C:\Users\Mike\Documents\Arduino\libraries\Arduino-FOC-master\src\common\foc_utils.cpp:70:22: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

y = * ( float * ) &i;

                  ^

C:\Users\Mike\Documents\Arduino\libraries\Arduino-FOC-master\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp: In function ‘int _findTimer(int, int, int, int, int, int)’:

C:\Users\Mike\Documents\Arduino\libraries\Arduino-FOC-master\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:116:15: error: ‘FTM3_CH0_PIN’ was not declared in this scope

 if((Ah == FTM3_CH0_PIN && Al == FTM3_CH1_PIN) || 

           ^

C:\Users\Mike\Documents\Arduino\libraries\Arduino-FOC-master\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:116:37: error: ‘FTM3_CH1_PIN’ was not declared in this scope

 if((Ah == FTM3_CH0_PIN && Al == FTM3_CH1_PIN) || 

                                 ^

C:\Users\Mike\Documents\Arduino\libraries\Arduino-FOC-master\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:117:14: error: ‘FTM3_CH2_PIN’ was not declared in this scope

   (Ah == FTM3_CH2_PIN && Al == FTM3_CH3_PIN) ||

          ^

C:\Users\Mike\Documents\Arduino\libraries\Arduino-FOC-master\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:117:36: error: ‘FTM3_CH3_PIN’ was not declared in this scope

   (Ah == FTM3_CH2_PIN && Al == FTM3_CH3_PIN) ||

                                ^

C:\Users\Mike\Documents\Arduino\libraries\Arduino-FOC-master\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:118:14: error: ‘FTM3_CH4_PIN’ was not declared in this scope

   (Ah == FTM3_CH4_PIN && Al == FTM3_CH5_PIN) ){

          ^

C:\Users\Mike\Documents\Arduino\libraries\Arduino-FOC-master\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:118:36: error: ‘FTM3_CH5_PIN’ was not declared in this scope

   (Ah == FTM3_CH4_PIN && Al == FTM3_CH5_PIN) ){

                                ^

Error compiling for board Teensy 3.2 / 3.1.

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

1 Like

It is likely that you have to add a build flag to your platformio.ini

-U FTM_SC to override def in kinestic.h of Teensy core.

I am getting the same error. However, I’m not using platformio, I’m just using the Arduino IDE. Im using the Teensy 3.2, and I am getting the exact same error, line for line, that the above user is getting. How do I implement the -U FTM_SC build flag? I tried in the platform.txt and boards.txt in the teensy\hardware\avr\1.58.1 folder and neither worked.
Specifically I added this flag to boards.txt: “teensy41.build.flags.c=-U FTM_SC”
and added this flag to platform.txt: “build.flags_extra=-U FTM_SC”

neither had any effect. I would love to use this library, what is going on?
@Karl_Makes_Music

try the build flag without the space- sometimes that causes problems for me.

When you say “space-” what are you referring to? the “-U FTM_SC” line, what should I change in it to make it work? Remove the space or remove the dash and space?

OK i reread your message- I think you meant just the “space” but i got confused and thought you meant the dash at the beginning too haha

sorry for the ambiguity- yes, like this:
-UFTM_SC
I can’t promise it will fix anything, but I have had build flags ignored before because of a wrong space.

Thanks for the clarification. Unfortunately that didn’t work in the teensy platform or build.txt. Is there another file I should be editing for these build flags? like a global one? Sorry I am new to this. I want to use this library but only have the Teensy 3.2.