Skip to content

Commit

Permalink
Fixes for CAN init on T41
Browse files Browse the repository at this point in the history
  • Loading branch information
noisymime committed Mar 15, 2024
1 parent 5bef8d4 commit 6f9348a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions speeduino/board_teensy41.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CAN1, RX_SIZE_256, TX_SIZE_16> Can0;
FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_16> Can1;
FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_16> Can2;
*/

static void PIT_isr();
static void TMR1_isr(void);
Expand Down
5 changes: 4 additions & 1 deletion speeduino/board_teensy41.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,13 @@
#define SECONDARY_SERIAL_T HardwareSerial

#include <FlexCAN_T4.h>
/*
//These are declared locally in comms_CAN now due to this issue: https://github.com/tonton81/FlexCAN_T4/issues/67
extern FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can0;
extern FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_16> Can1;
extern FlexCAN_T4<CAN3, RX_SIZE_256, TX_SIZE_16> 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
7 changes: 3 additions & 4 deletions speeduino/comms_CAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, RX_SIZE_256, TX_SIZE_16> Can0;
#elif defined(CORE_TEENSY41) // use for Teensy 3.6 only
FlexCAN_T4<CAN0, RX_SIZE_256, TX_SIZE_16> Can0;
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can1;
#elif defined(CORE_TEENSY41) // use for Teensy 4.1 only
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> Can0;
#endif

// Forward declare
Expand Down
2 changes: 1 addition & 1 deletion speeduino/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6f9348a

Please sign in to comment.