From 6f9348a2825813bef6a9c2486a2bcda78557be65 Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Fri, 15 Mar 2024 16:07:19 +1100 Subject: [PATCH] Fixes for CAN init on T41 --- speeduino/board_teensy41.cpp | 3 +++ speeduino/board_teensy41.h | 5 ++++- speeduino/comms_CAN.cpp | 7 +++---- speeduino/init.cpp | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/speeduino/board_teensy41.cpp b/speeduino/board_teensy41.cpp index 6a76e1d6..919186b8 100644 --- a/speeduino/board_teensy41.cpp +++ b/speeduino/board_teensy41.cpp @@ -7,9 +7,12 @@ #include "timers.h" #include "comms_secondary.h" +/* + //These are declared locally in comms_CAN now due to this issue: https://github.com/tonton81/FlexCAN_T4/issues/67 FlexCAN_T4 Can0; FlexCAN_T4 Can1; FlexCAN_T4 Can2; +*/ static void PIT_isr(); static void TMR1_isr(void); diff --git a/speeduino/board_teensy41.h b/speeduino/board_teensy41.h index 93eb25e1..d7c35814 100644 --- a/speeduino/board_teensy41.h +++ b/speeduino/board_teensy41.h @@ -172,10 +172,13 @@ #define SECONDARY_SERIAL_T HardwareSerial #include + /* + //These are declared locally in comms_CAN now due to this issue: https://github.com/tonton81/FlexCAN_T4/issues/67 extern FlexCAN_T4 Can0; extern FlexCAN_T4 Can1; extern FlexCAN_T4 Can2; - //#define NATIVE_CAN_AVAILABLE //Disable for now as it causes lockup + */ + #define NATIVE_CAN_AVAILABLE //Disable for now as it causes lockup #endif //CORE_TEENSY #endif //TEENSY41_H diff --git a/speeduino/comms_CAN.cpp b/speeduino/comms_CAN.cpp index 23e20ed1..d2bf0d6c 100644 --- a/speeduino/comms_CAN.cpp +++ b/speeduino/comms_CAN.cpp @@ -17,11 +17,10 @@ CAN_message_t inMsg; CAN_message_t outMsg; //These are declared locally for Teensy due to this issue: https://github.com/tonton81/FlexCAN_T4/issues/67 -#if defined(CORE_TEENSY35) // use for Teensy 3.5 only +#if defined(CORE_TEENSY35) || defined(CORE_TEENSY36) // use for Teensy 3.5/3.6 only FlexCAN_T4 Can0; -#elif defined(CORE_TEENSY41) // use for Teensy 3.6 only - FlexCAN_T4 Can0; - FlexCAN_T4 Can1; +#elif defined(CORE_TEENSY41) // use for Teensy 4.1 only + FlexCAN_T4 Can0; #endif // Forward declare diff --git a/speeduino/init.cpp b/speeduino/init.cpp index 97e82f06..973226fd 100644 --- a/speeduino/init.cpp +++ b/speeduino/init.cpp @@ -1539,7 +1539,7 @@ void setPinMapping(byte boardID) pinTrigger = 20; //The CAS pin pinTrigger2 = 21; //The Cam Sensor pin - pinTrigger3 = 23; + pinTrigger3 = 24; pinStepperDir = 34; pinStepperStep = 35;