Teensy 3.2 SimpleFOC Compiling Error

Hi guys,
i get this error while compiling the example programms in the SimpleFOC library:
Board: Teensy 3.1

In function `BLDCDriver3PWM::init()':
./BLDCDriver3PWM.cpp:53: undefined reference to `_configure3PWM(long, int, int, int)'
In function `BLDCDriver3PWM::setPwm(float, float, float)':
./BLDCDriver3PWM.cpp:71: undefined reference to `_writeDutyCycle3PWM(float, float, float, int, int, int)'
collect2: error: ld returned 1 exit status

Tried normal and devs Version of the Project.

Thanks you very much in advance.

Welcome @producer.

For some reason CORE_TEENSY is not defined so this file is (probably wrongly) skipped

Are you using platformio? If so you need to #include <Arduino.h> at top of file

hi, thank you for the quick reply.
Iā€™m using the Arduino IDE with the Teensyduino extension.

Try replacing CORE_TEENSY with TEENSYDUINO in the file i linked above.

Unfortunately, the same error message still comes up. Even after replacing the Name as you said.

tried replacing line 3 in teensy_mcu.cpp with:
#if defined(TEENSYDUINO)
and the error disappeared. There seems to be an problem with the arm option also.

Another Problem: In line 15 in teensy_mcu.cpp the function is defined as
void _configure3PWM(long pwm_frequency,const int pinA, const int pinB, const int pinC, const int pinD)
The Code only works without the const int pinD variable for the enable feature.
There seems to be only 4 variables expected in _configure3PWM(long, int, int, int)

Hey @producer,

You are absolutely right. The problem is that i forgot to implement these functions to the teensy implementation!
Thanks for the heads up!

The updated code is already in the dev thread! :smiley:

This should not be a problem of compiler flags, o not change the teensy compiler flags.

1 Like