Skip to content

GoosMos/CAN_interrupt

Repository files navigation

CAN Interrupt Communication

This project demonstrates data transmission and reception between devices using the CAN protocol.

Hardware

Boards: MSPM0G3507 Transmitter/Receiver: ISO1044

Operation

Each device can control the LED of the device connected via CAN_H and CAN_L through a button press. The transmission and reception of data are handled using interrupt-based communication.

Example Summary

This example demonstrates how to receive CAN Classic and CAN-FD messages using standard IDs.

Peripherals & Pin Assignments

Peripheral Pin Function
GPIOB PB22 Standard Output
GPIOB PB26 Standard Output
GPIOB PB13 Standard Output
SYSCTL PA5 HFXIN
SYSCTL PA6 HFXOUT
EVENT
CANFD0 PA13 RX Pin
CANFD0 PA12 TX Pin
DEBUGSS PA20 Debug Clock
DEBUGSS PA19 Debug Data In Out

BoosterPacks, Board Resources & Jumper Settings

Visit LP_MSPM0G3507 for LaunchPad information, including user guide and hardware files.

Pin Peripheral Function LaunchPad Pin LaunchPad Settings
PB22 GPIOB PB22 J27_5
  • PB22 can be connected to LED2 Blue
    • J5 ON Connect to LED2 Blue
    • J15 OFF Disconnect from LED2 Blue
PB26 GPIOB PB26 J27_8
  • PB26 can be connected to LED2 Red
    • J6 ON Connect to LED2 Red
    • J6 OFF Disconnect from LED2 Red
PB13 GPIOB PB13 J4_35 N/A
PA5 SYSCTL HFXIN J28_4
  • PA5 is used for HFXT functionality by default in Launchpad
    • Y2 crystal is soldered and connected by default

  • PA5 can be connected to J28_4
    • R15 is not soldered soldered by default
    • Solder R15 to connect pin to J28_4
PA6 SYSCTL HFXOUT J28_5
  • PA6 is used for HFXT functionality by default in Launchpad
    • Y2 crystal is soldered and connected by default

  • PA6 can be connected to J28_5
    • R17 is not soldered soldered by default
    • Solder R17 to connect pin to J28_5
PA13 CANFD0 CANRX J4_32/J26_3
  • PA13 can be connected to CAN/LIN connector in addition to boosterpack connector:
    • To use on J26 CAN/LIN connector:
      R65 is populated by default and connects pin to J26_3
PA12 CANFD0 CANTX J4_32/J26_1
  • PA12 can be connected to CAN/LIN connector in addition to boosterpack connector:
    • To use on J26 CAN/LIN connector:
      R64 is populated by default and connects pin to J26_1
PA20 DEBUGSS SWCLK N/A
  • PA20 is used by SWD during debugging
    • J101 15:16 ON Connect to XDS-110 SWCLK while debugging
    • J101 15:16 OFF Disconnect from XDS-110 SWCLK if using pin in application
PA19 DEBUGSS SWDIO N/A
  • PA19 is used by SWD during debugging
    • J101 13:14 ON Connect to XDS-110 SWDIO while debugging
    • J101 13:14 OFF Disconnect from XDS-110 SWDIO if using pin in application

Device Migration Recommendations

This project was developed for a superset device included in the LP_MSPM0G3507 LaunchPad. Please visit the CCS User's Guide for information about migrating to other MSPM0 devices.

Low-Power Recommendations

TI recommends to terminate unused pins by setting the corresponding functions to GPIO and configure the pins to output low or input with internal pullup/pulldown resistor.

SysConfig allows developers to easily configure unused pins by selecting BoardConfigure Unused Pins.

For more information about jumper configuration to achieve low-power using the MSPM0 LaunchPad, please visit the LP-MSPM0G3507 User's Guide.

Example Usage

Connect the CAN_RX and CAN_TX to TCAN1042DEVM pins as described in TCAN Evaluation Module User's Guide and monitor and transmit CAN-FD packages using mcan_single_message_tx example project or using a CAN Bus Analyzer tool of your choice.

The example has the following Nominal and Data Rate frequencies configured:

  • Nominal Bit Rate (250 KBits/s)
  • Data Bit Rate (2 MBits/s)

Compile, load and run the example.

To turn on the LED_1, the example must receive the following package:

  • ID : 0x03
  • DATA[0] = 0x01

To turn off the LED_1, the example must receive the following package:

  • ID : 0x03
  • DATA[0] = 0x00

To turn on the LED_2, the example must receive the following package:

  • ID : 0x04
  • DATA[0] = 0x01

To turn off the LED_2, the example must receive the following package:

  • ID : 0x04
  • DATA[0] = 0x00

Note: There is a known limitation where the example might stop receiving packages if the application halt execution after hitting a breakpoint. It is highly recommended to use free run option while testing the example.

About

CAN 프로토콜을 사용하여 디바이스간 송수신을 수행한다.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published