SPNA244 September   2020 TM4C1230D5PM , TM4C1230D5PM , TM4C1230E6PM , TM4C1230E6PM , TM4C1230H6PM , TM4C1230H6PM , TM4C1231C3PM , TM4C1231C3PM , TM4C1231D5PM , TM4C1231D5PM , TM4C1231D5PZ , TM4C1231D5PZ , TM4C1231E6PM , TM4C1231E6PM , TM4C1231E6PZ , TM4C1231E6PZ , TM4C1231H6PGE , TM4C1231H6PGE , TM4C1231H6PM , TM4C1231H6PM , TM4C1231H6PZ , TM4C1231H6PZ , TM4C1232C3PM , TM4C1232C3PM , TM4C1232D5PM , TM4C1232D5PM , TM4C1232E6PM , TM4C1232E6PM , TM4C1232H6PM , TM4C1232H6PM , TM4C1233C3PM , TM4C1233C3PM , TM4C1233D5PM , TM4C1233D5PM , TM4C1233D5PZ , TM4C1233D5PZ , TM4C1233E6PM , TM4C1233E6PM , TM4C1233E6PZ , TM4C1233E6PZ , TM4C1233H6PGE , TM4C1233H6PGE , TM4C1233H6PM , TM4C1233H6PM , TM4C1233H6PZ , TM4C1233H6PZ , TM4C1236D5PM , TM4C1236D5PM , TM4C1236E6PM , TM4C1236E6PM , TM4C1236H6PM , TM4C1236H6PM , TM4C1237D5PM , TM4C1237D5PM , TM4C1237D5PZ , TM4C1237D5PZ , TM4C1237E6PM , TM4C1237E6PM , TM4C1237E6PZ , TM4C1237E6PZ , TM4C1237H6PGE , TM4C1237H6PGE , TM4C1237H6PM , TM4C1237H6PM , TM4C1237H6PZ , TM4C1237H6PZ , TM4C123AE6PM , TM4C123AE6PM , TM4C123AH6PM , TM4C123AH6PM , TM4C123BE6PM , TM4C123BE6PM , TM4C123BE6PZ , TM4C123BE6PZ , TM4C123BH6PGE , TM4C123BH6PGE , TM4C123BH6PM , TM4C123BH6PM , TM4C123BH6PZ , TM4C123BH6PZ , TM4C123FE6PM , TM4C123FE6PM , TM4C123FH6PM , TM4C123FH6PM , TM4C123GE6PM , TM4C123GE6PM , TM4C123GE6PZ , TM4C123GE6PZ , TM4C123GH6PGE , TM4C123GH6PGE , TM4C123GH6PM , TM4C123GH6PM , TM4C123GH6PZ , TM4C123GH6PZ

 

  1.   Abstract
  2.   Trademarks
  3. 1Introduction
  4. 2Installation of Edde Flex CAN Booster Pack for TI TIVA C
  5. 3Download and Import the CAN Host Examples
  6. 4Modified CAN.C for Interrupts
  7. 5Example Projects
    1. 5.1 Internal Loopback With Interrupts (simple_can_loopback)
    2. 5.2 Simple CAN Transmit (simple_can_tx)
    3. 5.3 Simple CAN Receive (simple_can_rx)
    4. 5.4 CAN UART Bridge (can_uart_bridge)
  8. 6CAN Bootloader
    1. 6.1 Bootloader Configuration
    2. 6.2 Boot Demo Program (boot_demo_can)
    3. 6.3 UART-to-CAN Bridge for LM Flash Programmer Support
      1. 6.3.1 CCS Demo Program (uart_to_can)
      2. 6.3.2 SendCANID PC Program
    4. 6.4 Using the CAN Bootloader

CAN UART Bridge (can_uart_bridge)

This example interfaces a UART to a CAN bus. It receives data on UART0 then sends it out on CAN0 and receives data on CAN0 then sends it out on UART0. For this example UART0 is configured for 115200 baud (defined in UartFunctions.h) and CAN0 is configured for 1M baud (defined in CanFunctions.h). At these rates continuous data received on the UART will consume 17% of the CAN bus bandwidth.

Data received by either UART or CAN is handled by interrupt routines. The received data is put into its respective circular buffer. Both buffers are defined with a size of 256 bytes (defined in main.h). When continuous data is received on the UART, the UART interrupt routine is triggered after receiving four bytes, a half full FIFO. The data is then collected until eight bytes are received before being put in the circular buffer. This allows the CAN transmission to be the most efficient by supporting up to eight bytes in a CAN packet. When the UART reception halts or pauses, a receive timeout (RT) interrupt is generated. In this case, all the bytes in the UART receive FIFO are transferred to the circular buffer and a CAN frame of less than eight bytes is sent.

The arbitration ID for CAN transmitted messages and CAN received messages is the same, 0x101 (defined in CanFunctions.h). This allows two devices running the same software to transmit data from one serial port to another over a CAN network. With more than two devices on the network running the same software, data received on one serial port is transmitted through the CAN network and then output on the serial ports of all the other devices.

This example uses the following interrupt handlers. To use this example in your own application you must add these interrupt handlers to your vector table.

  • CAN0IntHandler - CAN 0 interrupt handler
  • UART0IntHandler - UART 0 interrupt handler