Errors compiling Simplefoc for Teensy 3.2 - Still Not Solved

I am getting this error when trying to compile Simple FOC on the Teensy 3.2. Works fine on the Arduino Duo, but the duo is really slow and misses encoder pulses. Here are the errors:

\Documents\Arduino\BLDC_DRIVER\BLDC_FOC_LIB\BLDC_FOC\BLDC_FOC.ino:37:41: warning: invalid conversion from ‘void ()()’ to 'void ()(byte)’ {aka 'void ()(unsigned char)'} [-fpermissive]
37 | PciListenerImp listenA(hallsensor.pinA, doA1);//UNO
| ^~~~
| |
| void (
)()
In file included from \Documents\Arduino\BLDC_DRIVER\BLDC_FOC_LIB\BLDC_FOC\BLDC_FOC.ino:6:
\Documents\Arduino\libraries\PciManager\src/PciListenerImp.h:45:37: note: initializing argument 2 of ‘PciListenerImp::PciListenerImp(byte, void ()(byte), bool)’
45 | PciListenerImp(byte pin, void (callback)(byte changeKind), bool pullUp = false);
| ~^~~~~~~~~~~~~~~~~~~~
\Documents\Arduino\BLDC_DRIVER\BLDC_FOC_LIB\BLDC_FOC\BLDC_FOC.ino:38:41: warning: invalid conversion from 'void (
)()’ to 'void (
)(byte)’ {aka 'void ()(unsigned char)'} [-fpermissive]
38 | PciListenerImp listenB(hallsensor.pinB, doB1);//UNO
| ^~~~
| |
| void (
)()
In file included from \Documents\Arduino\BLDC_DRIVER\BLDC_FOC_LIB\BLDC_FOC\BLDC_FOC.ino:6:
\Documents\Arduino\libraries\PciManager\src/PciListenerImp.h:45:37: note: initializing argument 2 of ‘PciListenerImp::PciListenerImp(byte, void ()(byte), bool)’
45 | PciListenerImp(byte pin, void (callback)(byte changeKind), bool pullUp = false);
| ~^~~~~~~~~~~~~~~~~~~~
\Documents\Arduino\BLDC_DRIVER\BLDC_FOC_LIB\BLDC_FOC\BLDC_FOC.ino:39:41: warning: invalid conversion from 'void (
)()’ to 'void (
)(byte)’ {aka 'void ()(unsigned char)'} [-fpermissive]
39 | PciListenerImp listenC(hallsensor.pinC, doC1);//UNO
| ^~~~
| |
| void (
)()
In file included from \Documents\Arduino\BLDC_DRIVER\BLDC_FOC_LIB\BLDC_FOC\BLDC_FOC.ino:6:
\Documents\Arduino\libraries\PciManager\src/PciListenerImp.h:45:37: note: initializing argument 2 of ‘PciListenerImp::PciListenerImp(byte, void (*)(byte), bool)’
45 | PciListenerImp(byte pin, void (*callback)(byte changeKind), bool pullUp = false);
| ~^~~~~~~~~~~~~~~~~~~~
\Documents\Arduino\libraries\Simple_FOC\src\common\foc_utils.cpp: In function ‘float _sqrtApprox(float)’:
\Documents\Arduino\libraries\Simple_FOC\src\common\foc_utils.cpp:68:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
68 | i = * ( long * ) &y;
| ^~~~~~~~~~~~~
Documents\Arduino\libraries\Simple_FOC\src\common\foc_utils.cpp:70:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
70 | y = * ( float * ) &i;
| ^~~~~~~~~~~~~~
\Arduino\libraries\Simple_FOC\src\common\foc_utils.cpp:68:7: warning: ‘y’ is used uninitialized [-Wuninitialized]
68 | i = * ( long * ) &y;
| ^~~~~~~~~~~~~~~
\Documents\Arduino\libraries\Simple_FOC\src\common\foc_utils.cpp:62:9: note: ‘y’ declared here
62 | float y;
| ^
\Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp: In function ‘int _findTimer(int, int, int, int, int, int)’:
\Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:116:15: error: ‘FTM3_CH0_PIN’ was not declared in this scope; did you mean ‘FTM0_CH0_PIN’?
116 | if((Ah == FTM3_CH0_PIN && Al == FTM3_CH1_PIN) ||
| ^~~~~~~~~~~~
| FTM0_CH0_PIN
\Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:116:37: error: ‘FTM3_CH1_PIN’ was not declared in this scope; did you mean ‘FTM0_CH1_PIN’?
116 | if((Ah == FTM3_CH0_PIN && Al == FTM3_CH1_PIN) ||
| ^~~~~~~~~~~~
| FTM0_CH1_PIN
\Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:117:14: error: ‘FTM3_CH2_PIN’ was not declared in this scope; did you mean ‘FTM0_CH2_PIN’?
117 | (Ah == FTM3_CH2_PIN && Al == FTM3_CH3_PIN) ||
| ^~~~~~~~~~~~
| FTM0_CH2_PIN
Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:117:36: error: ‘FTM3_CH3_PIN’ was not declared in this scope; did you mean ‘FTM0_CH3_PIN’?
117 | (Ah == FTM3_CH2_PIN && Al == FTM3_CH3_PIN) ||
| ^~~~~~~~~~~~
| FTM0_CH3_PIN
Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:118:14: error: ‘FTM3_CH4_PIN’ was not declared in this scope; did you mean ‘FTM0_CH4_PIN’?
118 | (Ah == FTM3_CH4_PIN && Al == FTM3_CH5_PIN) ){
| ^~~~~~~~~~~~
| FTM0_CH4_PIN
\Documents\Arduino\libraries\Simple_FOC\src\drivers\hardware_specific\teensy\teensy3_mcu.cpp:118:36: error: ‘FTM3_CH5_PIN’ was not declared in this scope; did you mean ‘FTM0_CH5_PIN’?
118 | (Ah == FTM3_CH4_PIN && Al == FTM3_CH5_PIN) ){
| ^~~~~~~~~~~~
| FTM0_CH5_PIN

exit status 1

Compilation error: exit status 1

This is the same error as this post: https://community.simplefoc.com/t/errors-compiling-simplefoc-for-teensy-3-2/3185/7 But the issue was never resolved. The proposed solution in that post didn’t do anything.

Hey @Max_Homes,

Sorry for the delay with answering. The check was not well made in the code to verify if the board has timer 3. And as teensy 3.2 doesnt have the timer 3, this breaks the compilation.

The fix for this issue is in the dev branch.

If you want to use the standard library and without the need to download the dev version, go to the
src/drivers/hardware_specific/teensy/teensy3_mcu.cpp file to the line 118. and change FTM3_SC to FTM3_CH0_PIN.

The same issue was reported by @PickyBiker
https://community.simplefoc.com/t/errors-compiling-simplefoc-for-teensy-3-2/3185/1

Cheers,
Antun