From aa4e55245818f0229f3ad6caa77d98b4026fb61b Mon Sep 17 00:00:00 2001 From: bicycleguy Date: Thu, 25 Feb 2016 12:45:13 -0800 Subject: [PATCH] Added 33333 bps Added the General Motors SWCAN (Single Wire CAN) bus speed. --- FlexCAN.cpp | 5 ++++- README.md | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/FlexCAN.cpp b/FlexCAN.cpp index 7ad1312..9dd9dd0 100644 --- a/FlexCAN.cpp +++ b/FlexCAN.cpp @@ -39,7 +39,10 @@ FlexCAN::FlexCAN(uint32_t baud) FLEXCAN0_MCR |= FLEXCAN_MCR_FEN; // segment splits and clock divisor based on baud rate - if ( 50000 == baud ) { + if ( 33333 == baud ) { + FLEXCAN0_CTRL1 = (FLEXCAN_CTRL_PROPSEG(2) | FLEXCAN_CTRL_RJW(2) + | FLEXCAN_CTRL_PSEG1(1) | FLEXCAN_CTRL_PSEG2(1) | FLEXCAN_CTRL_PRESDIV(59)); + } else if ( 50000 == baud ) { FLEXCAN0_CTRL1 = (FLEXCAN_CTRL_PROPSEG(2) | FLEXCAN_CTRL_RJW(1) | FLEXCAN_CTRL_PSEG1(7) | FLEXCAN_CTRL_PSEG2(3) | FLEXCAN_CTRL_PRESDIV(19)); } else if ( 100000 == baud ) { diff --git a/README.md b/README.md index e94ffd8..6fa1f6d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Even though the Teensy is operating on 3.3V, use of 5V transceivers may be an op Note that CAN will normally require termination resistors. These are located at the two ends of a CAN bus to prevent reflections. Do not add more terminators when connecting devices to an existing properly terminated CAN bus. -Supported baud rates are 50000, 100000, 125000, 250000, 500000, and 1000000 bits per second. If the baud rate is not specified it will default to 125000. +Supported baud rates are 33333, 50000, 100000, 125000, 250000, 500000 and 1000000 bits per second. If the baud rate is not specified it will default to 125000. ###CAN Transceiver Options Please add parts you are using successfully with Teensy 3.1 to this list. @@ -20,6 +20,7 @@ Please add parts you are using successfully with Teensy 3.1 to this list. - NXP TJA1050T/VM,118 on the same 5V supply as the Teensy. (1MBPS) - Microchip MCP2551 on 5V (reported at 500KBPS) - Linear LT1796 on 5V (not speedtested) +- Freescale MC33897CTEF/R2 33.33 kbs single wire CAN compliant to GMW3089v2.4 ###Driver API **begin()**