Data Structures | Macros | Typedefs | Variables
CANMSP432E4.h File Reference

Detailed Description

CAN driver implementation for a MSP432E4 CAN controller.

============================================================================

The CAN header file should be included in an application as follows:

Stack requirements

The CANMSP432E4 driver is a (ring) buffered driver that stores data it may

have already received in a user-supplied background buffer.

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <ti/devices/msp432e4/inc/msp432.h>
#include <ti/devices/msp432e4/driverlib/gpio.h>
#include <ti/devices/msp432e4/driverlib/pin_map.h>
#include <ti/drivers/dpl/ClockP.h>
#include <ti/drivers/dpl/HwiP.h>
#include <ti/drivers/dpl/SemaphoreP.h>
#include <ti/drivers/gpio/GPIOMSP432E4.h>
#include <ti/drivers/CAN.h>
#include <ti/drivers/utils/List.h>
#include <ti/drivers/utils/StructRingBuf.h>
Include dependency graph for CANMSP432E4.h:

Go to the source code of this file.

Data Structures

struct  CANMSP432E4_HWAttrs
 CANMSP432E4 Hardware attributes. More...
 
struct  CANMSP432E4_Object
 CANMSP432E4 Object. More...
 

Macros

#define CANMSP432E4_PA0_CAN0RX   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 0, GPIO_PA0_CAN0RX)
 PA0 is used for CAN0 RX. More...
 
#define CANMSP432E4_PA1_CAN0TX   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 1, GPIO_PA1_CAN0TX)
 PA1 is used for CAN0 RX. More...
 
#define CANMSP432E4_PB0_CAN1RX   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 0, GPIO_PB0_CAN1RX)
 PB0 is used for CAN1 RX. More...
 
#define CANMSP432E4_PB1_CAN1TX   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 1, GPIO_PB1_CAN1TX)
 PB1 is used for CAN1 RX. More...
 

Typedefs

typedef void(* CANMSP432E4_ErrorCallback) (CAN_Handle handle, uint32_t error)
 The definition of an optional callback function used by the CAN driver to notify the application when a receive error (FIFO overrun, parity error, etc) occurs. More...
 
typedef struct CANMSP432E4_HWAttrs CANMSP432E4_HWAttrs
 CANMSP432E4 Hardware attributes. More...
 
typedef struct CANMSP432E4_Object CANMSP432E4_Object
 CANMSP432E4 Object. More...
 
typedef struct CANMSP432E4_ObjectCANMSP432E4_Handle
 

Variables

const CAN_FxnTable CANMSP432E4_fxnTable
 

Macro Definition Documentation

§ CANMSP432E4_PA0_CAN0RX

#define CANMSP432E4_PA0_CAN0RX   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 0, GPIO_PA0_CAN0RX)

PA0 is used for CAN0 RX.

§ CANMSP432E4_PA1_CAN0TX

#define CANMSP432E4_PA1_CAN0TX   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 1, GPIO_PA1_CAN0TX)

PA1 is used for CAN0 RX.

§ CANMSP432E4_PB0_CAN1RX

#define CANMSP432E4_PB0_CAN1RX   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 0, GPIO_PB0_CAN1RX)

PB0 is used for CAN1 RX.

§ CANMSP432E4_PB1_CAN1TX

#define CANMSP432E4_PB1_CAN1TX   GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 1, GPIO_PB1_CAN1TX)

PB1 is used for CAN1 RX.

Typedef Documentation

§ CANMSP432E4_ErrorCallback

typedef void(* CANMSP432E4_ErrorCallback) (CAN_Handle handle, uint32_t error)

The definition of an optional callback function used by the CAN driver to notify the application when a receive error (FIFO overrun, parity error, etc) occurs.

Parameters
CAN_HandleCAN_Handle
errorThe current value of the receive status register. Please refer to the device data sheet to interpret this value.

§ CANMSP432E4_HWAttrs

CANMSP432E4 Hardware attributes.

The baseAddr, intNum, and flowControl fields are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For MSP432E4 driverlib these definitions are found in:

  • ti/devices/msp432e4/driverlib/inc/msp432e4xxx.h
  • ti/devices/msp432e4/driverlib/interrupt.h
  • ti/devices/msp432e4/driverlib/can.h

intPriority is the CAN peripheral's interrupt priority, as defined by the underlying OS. It is passed unmodified to the underlying OS's interrupt handler creation code, so you need to refer to the OS documentation for usage. For example, for SYS/BIOS applications, refer to the ti.sysbios.family.arm.m3.Hwi documentation for SYS/BIOS usage of interrupt priorities. If the driver uses the ti.dpl interface instead of making OS calls directly, then the HwiP port handles the interrupt priority in an OS specific way. In the case of the SYS/BIOS port, intPriority is passed unmodified to Hwi_create().

A sample structure is shown below:

struct can_frame canMSP432E4TxBuffer[2][4];
struct can_frame canMSP432E4RxBuffer[2][4];
const CANMSP432E4_HWAttrs canMSP432E4HWAttrs[] = {
{
.baseAddr = CAN0_BASE,
.intNum = INT_CAN0,
.intPriority = (~0),
.rxPin = CANMSP432E4_PA0_U0RX,
.txPin = CANMSP432E4_PA1_U0TX,
.baudRate = 125000;
.errorFxn = NULL
},
{
.baseAddr = CAN1_BASE,
.intNum = INT_CAN1,
.intPriority = (~0),
.rxPin = CANMSP432E4_PB0_U1RX,
.txPin = CANMSP432E4_PB1_U1TX,
.baudRate = 125000;
.errorFxn = NULL,
}
};

§ CANMSP432E4_Object

CANMSP432E4 Object.

The application must not access any member variables of this structure!

§ CANMSP432E4_Handle

Variable Documentation

§ CANMSP432E4_fxnTable

const CAN_FxnTable CANMSP432E4_fxnTable
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale