Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Will the PulsePosition Library work with Teensy 4.0?

  1. #1
    Junior Member
    Join Date
    Oct 2019
    Location
    San Diego
    Posts
    2

    Will the PulsePosition Library work with Teensy 4.0?

    Can the PulsePosition library work with the newest Teensy 4.0?



    I am running the LoopBack example sketch (without modification) and receiving compilation errors when I attempt to compile with 4.0 (compilation dump below). If I change the board to Teensy 3.2, then the example compiles successfully.



    I went to find out why the CLOCKS_PER_MICROSECOND defines was not being included. I found that there are #if define checks for KINETISK and KINETISL (Kinetis family of microcontrollers) in the PulsePosition.cpp file on lines 74 and 76, that do not get included for the Teensy 4.0 (RT1060 family of microcontrollers). Here is a snippet:

    // convert from microseconds to I/O clock ticks
    #if defined(KINETISK)
    #define CLOCKS_PER_MICROSECOND ((double)F_BUS / 1000000.0)
    #elif defined(KINETISL)
    #define CLOCKS_PER_MICROSECOND ((double)F_PLL / 2000000.0)
    #endif
    #define TX_MINIMUM_SIGNAL_CLOCKS (uint32_t)(TX_MINIMUM_SIGNAL * CLOCKS_PER_MICROSECOND)
    #define TX_MAXIMUM_SIGNAL_CLOCKS (uint32_t)(TX_MAXIMUM_SIGNAL * CLOCKS_PER_MICROSECOND)
    #define TX_DEFAULT_SIGNAL_CLOCKS (uint32_t)(TX_DEFAULT_SIGNAL * CLOCKS_PER_MICROSECOND)
    #define TX_MINIMUM_SPACE_CLOCKS (uint32_t)(TX_MINIMUM_SPACE * CLOCKS_PER_MICROSECOND)
    #define TX_MINIMUM_FRAME_CLOCKS (uint32_t)(TX_MINIMUM_FRAME * CLOCKS_PER_MICROSECOND)
    #define TX_PULSE_WIDTH_CLOCKS (uint32_t)(TX_PULSE_WIDTH * CLOCKS_PER_MICROSECOND)
    #define RX_MINIMUM_SPACE_CLOCKS (uint32_t)(RX_MINIMUM_SPACE * CLOCKS_PER_MICROSECOND)



    Here is the complete compilation dump with verbose compilation enabled:

    Arduino: 1.8.9 (Linux), TD: 1.47, Board: "Teensy 4.0, Serial, Faster, US English"

    /home/rebootxl/Downloads/arduino-1.8.9/arduino-builder -dump-prefs -logger=machine -hardware /home/rebootxl/Downloads/arduino-1.8.9/hardware -tools /home/rebootxl/Downloads/arduino-1.8.9/tools-builder -tools /home/rebootxl/Downloads/arduino-1.8.9/hardware/tools/avr -built-in-libraries /home/rebootxl/Downloads/arduino-1.8.9/libraries -libraries /home/rebootxl/Arduino/libraries -fqbn=teensy:avr:teensy40:usb=serial,opt=o2std,keys =en-us -ide-version=10809 -build-path /tmp/arduino_build_567675 -warnings=none -build-cache /tmp/arduino_cache_446934 -verbose /home/rebootxl/Arduino/libraries/PulsePosition/examples/LoopBack/LoopBack.ino
    /home/rebootxl/Downloads/arduino-1.8.9/arduino-builder -compile -logger=machine -hardware /home/rebootxl/Downloads/arduino-1.8.9/hardware -tools /home/rebootxl/Downloads/arduino-1.8.9/tools-builder -tools /home/rebootxl/Downloads/arduino-1.8.9/hardware/tools/avr -built-in-libraries /home/rebootxl/Downloads/arduino-1.8.9/libraries -libraries /home/rebootxl/Arduino/libraries -fqbn=teensy:avr:teensy40:usb=serial,opt=o2std,keys =en-us -ide-version=10809 -build-path /tmp/arduino_build_567675 -warnings=none -build-cache /tmp/arduino_cache_446934 -verbose /home/rebootxl/Arduino/libraries/PulsePosition/examples/LoopBack/LoopBack.ino
    Using board 'teensy40' from platform in folder: /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr
    Using core 'teensy4' from platform in folder: /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr
    Detecting libraries used...
    /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_567675/sketch/LoopBack.ino.cpp -o /dev/null
    /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/rebootxl/Arduino/libraries/PulsePosition /tmp/arduino_build_567675/sketch/LoopBack.ino.cpp -o /dev/null
    /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/rebootxl/Arduino/libraries/PulsePosition /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp -o /dev/null
    Generating function prototypes...
    /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/rebootxl/Arduino/libraries/PulsePosition /tmp/arduino_build_567675/sketch/LoopBack.ino.cpp -o /tmp/arduino_build_567675/preproc/ctags_target_for_gcc_minus_e.cpp
    /home/rebootxl/Downloads/arduino-1.8.9/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino_build_567675/preproc/ctags_target_for_gcc_minus_e.cpp
    Compiling sketch...
    /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/../tools/precompile_helper /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_567675 /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_567675/pch/Arduino.h -o /tmp/arduino_build_567675/pch/Arduino.h.gch
    Using previously compiled file: /tmp/arduino_build_567675/pch/Arduino.h.gch
    /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/tmp/arduino_build_567675/pch -I/home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/rebootxl/Arduino/libraries/PulsePosition /tmp/arduino_build_567675/sketch/LoopBack.ino.cpp -o /tmp/arduino_build_567675/sketch/LoopBack.ino.cpp.o
    Compiling libraries...
    Compiling library "PulsePosition"
    /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/tmp/arduino_build_567675/pch -I/home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/rebootxl/Arduino/libraries/PulsePosition /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp -o /tmp/arduino_build_567675/libraries/PulsePosition/PulsePosition.cpp.o
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp: In constructor 'PulsePositionOutput::PulsePositionOutput()':
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:83:65: error: 'CLOCKS_PER_MICROSECOND' was not declared in this scope
    #define TX_MINIMUM_FRAME_CLOCKS (uint32_t)(TX_MINIMUM_FRAME * CLOCKS_PER_MICROSECOND)
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:109:19: note: in expansion of macro 'TX_MINIMUM_FRAME_CLOCKS'
    pulse_width[0] = TX_MINIMUM_FRAME_CLOCKS;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp: In constructor 'PulsePositionOutput::PulsePositionOutput(int)':
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:83:65: error: 'CLOCKS_PER_MICROSECOND' was not declared in this scope
    #define TX_MINIMUM_FRAME_CLOCKS (uint32_t)(TX_MINIMUM_FRAME * CLOCKS_PER_MICROSECOND)
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:119:19: note: in expansion of macro 'TX_MINIMUM_FRAME_CLOCKS'
    pulse_width[0] = TX_MINIMUM_FRAME_CLOCKS;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp: In member function 'bool PulsePositionOutput::begin(uint8_t, uint8_t)':
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:142:6: error: 'FTM0_MOD' was not declared in this scope
    if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM0_SC_VALUE) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:142:29: error: 'FTM0_SC' was not declared in this scope
    if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM0_SC_VALUE) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:88:24: error: 'FTM_SC_TOIE' was not declared in this scope
    #define FTM0_SC_VALUE (FTM_SC_TOIE | FTM_SC_CLKS(1) | FTM_SC_PS(0))
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:142:48: note: in expansion of macro 'FTM0_SC_VALUE'
    if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM0_SC_VALUE) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:88:51: error: 'FTM_SC_CLKS' was not declared in this scope
    #define FTM0_SC_VALUE (FTM_SC_TOIE | FTM_SC_CLKS(1) | FTM_SC_PS(0))
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:142:48: note: in expansion of macro 'FTM0_SC_VALUE'
    if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM0_SC_VALUE) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:88:66: error: 'FTM_SC_PS' was not declared in this scope
    #define FTM0_SC_VALUE (FTM_SC_TOIE | FTM_SC_CLKS(1) | FTM_SC_PS(0))
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:142:48: note: in expansion of macro 'FTM0_SC_VALUE'
    if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM0_SC_VALUE) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:144:3: error: 'FTM0_CNT' was not declared in this scope
    FTM0_CNT = 0;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:152:33: error: 'FTM0_C4SC' was not declared in this scope
    case 6: channel = 4; reg = &FTM0_C4SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:153:33: error: 'FTM0_C2SC' was not declared in this scope
    case 9: channel = 2; reg = &FTM0_C2SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:154:33: error: 'FTM0_C3SC' was not declared in this scope
    case 10: channel = 3; reg = &FTM0_C3SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:155:33: error: 'FTM0_C5SC' was not declared in this scope
    case 20: channel = 5; reg = &FTM0_C5SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:156:33: error: 'FTM0_C0SC' was not declared in this scope
    case 22: channel = 0; reg = &FTM0_C0SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:157:33: error: 'FTM0_C1SC' was not declared in this scope
    case 23: channel = 1; reg = &FTM0_C1SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:166:15: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
    framePinReg = portOutputRegister(framePin);
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:169:17: error: 'FRAME_PIN_SET' was not declared in this scope
    FRAME_PIN_SET();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:178:24: error: 'CSC_CHANGE' was not declared in this scope
    CSC_CHANGE(ftm, cscSet); // set on compare match & interrupt
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:181:45: error: 'PORT_PCR_MUX' was not declared in this scope
    *portConfigRegister(txPin) = PORT_PCR_MUX(4) | PORT_PCR_DSE | PORT_PCR_SRE;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:181:49: error: 'PORT_PCR_DSE' was not declared in this scope
    *portConfigRegister(txPin) = PORT_PCR_MUX(4) | PORT_PCR_DSE | PORT_PCR_SRE;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:181:64: error: 'PORT_PCR_SRE' was not declared in this scope
    *portConfigRegister(txPin) = PORT_PCR_MUX(4) | PORT_PCR_DSE | PORT_PCR_SRE;
    ^
    In file included from /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/core_pins.h:32:0,
    from /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/wiring.h:38,
    from /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/WProgram.h:45,
    from /tmp/arduino_build_567675/pch/Arduino.h:6,
    from /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.h:29,
    from /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:31:
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:182:20: error: 'IRQ_FTM0' was not declared in this scope
    NVIC_SET_PRIORITY(IRQ_FTM0, 32);
    ^
    /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/imxrt.h:8201:83: note: in definition of macro 'NVIC_SET_PRIORITY'
    #define NVIC_SET_PRIORITY(irqnum, priority) (*((volatile uint8_t *)0xE000E400 + (irqnum)) = (uint8_t)(priority))
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp: In member function 'bool PulsePositionOutput::write(uint8_t, float)':
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:193:26: error: 'CLOCKS_PER_MICROSECOND' was not declared in this scope
    clocks = microseconds * CLOCKS_PER_MICROSECOND;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp: In member function 'void PulsePositionOutput::isr()':
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:84:63: error: 'CLOCKS_PER_MICROSECOND' was not declared in this scope
    #define TX_PULSE_WIDTH_CLOCKS (uint32_t)(TX_PULSE_WIDTH * CLOCKS_PER_MICROSECOND)
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:223:14: note: in expansion of macro 'TX_PULSE_WIDTH_CLOCKS'
    ftm->cv += TX_PULSE_WIDTH_CLOCKS;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:224:34: error: 'CSC_CHANGE_INTACK' was not declared in this scope
    CSC_CHANGE_INTACK(ftm, cscClear); // clear on compare match & interrupt
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:84:63: error: 'CLOCKS_PER_MICROSECOND' was not declared in this scope
    #define TX_PULSE_WIDTH_CLOCKS (uint32_t)(TX_PULSE_WIDTH * CLOCKS_PER_MICROSECOND)
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:237:36: note: in expansion of macro 'TX_PULSE_WIDTH_CLOCKS'
    width = pulse_buffer[channel] - TX_PULSE_WIDTH_CLOCKS;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:244:20: error: 'FRAME_PIN_SET' was not declared in this scope
    FRAME_PIN_SET();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:246:22: error: 'FRAME_PIN_CLEAR' was not declared in this scope
    FRAME_PIN_CLEAR();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:255:33: error: 'CSC_CHANGE_INTACK' was not declared in this scope
    CSC_CHANGE_INTACK(ftm, cscSet); // set on compare match & interrupt
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:259:28: error: 'CSC_INTACK' was not declared in this scope
    CSC_INTACK(ftm, cscClear); // clear on compare match & interrupt
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp: In function 'void ftm0_isr()':
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:268:6: error: 'FTM0_SC' was not declared in this scope
    if (FTM0_SC & 0x80) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:279:26: error: 'FTM0_C0SC' was not declared in this scope
    if ((maskin & 0x01) && (FTM0_C0SC & 0x80)) PulsePositionInput::list[0]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:280:26: error: 'FTM0_C1SC' was not declared in this scope
    if ((maskin & 0x02) && (FTM0_C1SC & 0x80)) PulsePositionInput::list[1]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:281:26: error: 'FTM0_C2SC' was not declared in this scope
    if ((maskin & 0x04) && (FTM0_C2SC & 0x80)) PulsePositionInput::list[2]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:282:26: error: 'FTM0_C3SC' was not declared in this scope
    if ((maskin & 0x08) && (FTM0_C3SC & 0x80)) PulsePositionInput::list[3]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:283:26: error: 'FTM0_C4SC' was not declared in this scope
    if ((maskin & 0x10) && (FTM0_C4SC & 0x80)) PulsePositionInput::list[4]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:284:26: error: 'FTM0_C5SC' was not declared in this scope
    if ((maskin & 0x20) && (FTM0_C5SC & 0x80)) PulsePositionInput::list[5]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:290:27: error: 'FTM0_C0SC' was not declared in this scope
    if ((maskout & 0x01) && (FTM0_C0SC & 0x80)) PulsePositionOutput::list[0]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:291:27: error: 'FTM0_C1SC' was not declared in this scope
    if ((maskout & 0x02) && (FTM0_C1SC & 0x80)) PulsePositionOutput::list[1]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:292:27: error: 'FTM0_C2SC' was not declared in this scope
    if ((maskout & 0x04) && (FTM0_C2SC & 0x80)) PulsePositionOutput::list[2]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:293:27: error: 'FTM0_C3SC' was not declared in this scope
    if ((maskout & 0x08) && (FTM0_C3SC & 0x80)) PulsePositionOutput::list[3]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:294:27: error: 'FTM0_C4SC' was not declared in this scope
    if ((maskout & 0x10) && (FTM0_C4SC & 0x80)) PulsePositionOutput::list[4]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:295:27: error: 'FTM0_C5SC' was not declared in this scope
    if ((maskout & 0x20) && (FTM0_C5SC & 0x80)) PulsePositionOutput::list[5]->isr();
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp: In member function 'bool PulsePositionInput::begin(uint8_t)':
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:327:6: error: 'FTM0_MOD' was not declared in this scope
    if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM0_SC_VALUE) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:327:29: error: 'FTM0_SC' was not declared in this scope
    if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM0_SC_VALUE) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:88:24: error: 'FTM_SC_TOIE' was not declared in this scope
    #define FTM0_SC_VALUE (FTM_SC_TOIE | FTM_SC_CLKS(1) | FTM_SC_PS(0))
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:327:48: note: in expansion of macro 'FTM0_SC_VALUE'
    if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM0_SC_VALUE) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:88:51: error: 'FTM_SC_CLKS' was not declared in this scope
    #define FTM0_SC_VALUE (FTM_SC_TOIE | FTM_SC_CLKS(1) | FTM_SC_PS(0))
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:327:48: note: in expansion of macro 'FTM0_SC_VALUE'
    if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM0_SC_VALUE) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:88:66: error: 'FTM_SC_PS' was not declared in this scope
    #define FTM0_SC_VALUE (FTM_SC_TOIE | FTM_SC_CLKS(1) | FTM_SC_PS(0))
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:327:48: note: in expansion of macro 'FTM0_SC_VALUE'
    if (FTM0_MOD != 0xFFFF || (FTM0_SC & 0x7F) != FTM0_SC_VALUE) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:329:3: error: 'FTM0_CNT' was not declared in this scope
    FTM0_CNT = 0;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:337:33: error: 'FTM0_C4SC' was not declared in this scope
    case 6: channel = 4; reg = &FTM0_C4SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:338:33: error: 'FTM0_C2SC' was not declared in this scope
    case 9: channel = 2; reg = &FTM0_C2SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:339:33: error: 'FTM0_C3SC' was not declared in this scope
    case 10: channel = 3; reg = &FTM0_C3SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:340:33: error: 'FTM0_C5SC' was not declared in this scope
    case 20: channel = 5; reg = &FTM0_C5SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:341:33: error: 'FTM0_C0SC' was not declared in this scope
    case 22: channel = 0; reg = &FTM0_C0SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:342:33: error: 'FTM0_C1SC' was not declared in this scope
    case 23: channel = 1; reg = &FTM0_C1SC; break;
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:356:43: error: 'PORT_PCR_MUX' was not declared in this scope
    *portConfigRegister(pin) = PORT_PCR_MUX(4);
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:357:25: error: 'CSC_CHANGE' was not declared in this scope
    CSC_CHANGE(ftm, cscEdge); // input capture & interrupt on rising edge
    ^
    In file included from /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/core_pins.h:32:0,
    from /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/wiring.h:38,
    from /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/WProgram.h:45,
    from /tmp/arduino_build_567675/pch/Arduino.h:6,
    from /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.h:29,
    from /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:31:
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:358:20: error: 'IRQ_FTM0' was not declared in this scope
    NVIC_SET_PRIORITY(IRQ_FTM0, 32);
    ^
    /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/cores/teensy4/imxrt.h:8201:83: note: in definition of macro 'NVIC_SET_PRIORITY'
    #define NVIC_SET_PRIORITY(irqnum, priority) (*((volatile uint8_t *)0xE000E400 + (irqnum)) = (uint8_t)(priority))
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp: In member function 'void PulsePositionInput::isr()':
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:368:25: error: 'CSC_INTACK' was not declared in this scope
    CSC_INTACK(ftm, cscEdge); // input capture & interrupt on rising edge
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:85:65: error: 'CLOCKS_PER_MICROSECOND' was not declared in this scope
    #define RX_MINIMUM_SPACE_CLOCKS (uint32_t)(RX_MINIMUM_SPACE * CLOCKS_PER_MICROSECOND)
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:377:15: note: in expansion of macro 'RX_MINIMUM_SPACE_CLOCKS'
    if (count >= RX_MINIMUM_SPACE_CLOCKS) {
    ^
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp: In member function 'float PulsePositionInput::read(uint8_t)':
    /home/rebootxl/Arduino/libraries/PulsePosition/PulsePosition.cpp:417:31: error: 'CLOCKS_PER_MICROSECOND' was not declared in this scope
    return (float)value / (float)CLOCKS_PER_MICROSECOND;
    ^
    Multiple libraries were found for "PulsePosition.h"
    Used: /home/rebootxl/Arduino/libraries/PulsePosition
    Not used: /home/rebootxl/Downloads/arduino-1.8.9/hardware/teensy/avr/libraries/PulsePosition
    Using library PulsePosition at version 1.0 in folder: /home/rebootxl/Arduino/libraries/PulsePosition
    Error compiling for board Teensy 4.0.

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,238
    Quote Originally Posted by rebootxl View Post
    Can the PulsePosition library work with the newest Teensy 4.0?
    It is not ported to T4 yet. It's on Paul's TODO list. But you are welcome to port it yourself.

    https://forum.pjrc.com/threads/54711...l=1#post193717

    https://forum.pjrc.com/threads/57894...l=1#post218016
    Last edited by manitou; 10-21-2019 at 09:35 PM.

  3. #3
    Junior Member
    Join Date
    Oct 2019
    Location
    San Diego
    Posts
    2
    Thank you for the clarity! I'd be happy to port it.

    I may purchase some Teensy 3.2s in the meantime.

  4. #4
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,238
    Re: T4 PulsePosition

    see proof-of-concept sketches and discussion at
    https://forum.pjrc.com/threads/57894...l=1#post219681

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •