Loading...
Searching...
No Matches

Driver for the Microchip MCP2515 can controller. More...

Detailed Description

Driver for the Microchip MCP2515 can controller.

Files

file  candev_mcp2515.h
 Definition of the implementation of the CAN controller driver.
 
file  mcp2515_params.h
 Parameters for the CAN driver implementation.
 
file  mcp2515.h
 Driver for the Microchip MCP2515 can controller.
 
file  mcp2515_defines.h
 Driver for the Microchip MCP2515 can controller.
 
file  mcp2515_spi.h
 Driver for the Microchip MCP2515 can controller.
 

Data Structures

struct  candev_mcp2515_conf
 MCP2515 configuration descriptor. More...
 
struct  candev_mcp2515
 MCP2515 device descriptor. More...
 

Macros

#define CANDEV_MCP2515_DEFAULT_BITRATE   500000
 Default CAN bitrate.
 
#define CANDEV_MCP2515_DEFAULT_SPT   875
 Default sampling point setup.
 
#define MCP2515_TX_MAILBOXES   3
 Number of transmit mailboxes.
 

Typedefs

typedef struct candev_mcp2515 candev_mcp2515_t
 MCP2515 candev descriptor.
 
typedef struct candev_mcp2515_conf candev_mcp2515_conf_t
 MCP2515 configuration descriptor.
 

Functions

void candev_mcp2515_init (candev_mcp2515_t *dev, const candev_mcp2515_conf_t *conf)
 Initialize a mcp2515 device by assigning a timing and an SPI configuration conf.
 

Receive mailboxes and filters number

for RX buffers: the MCP2515 managed 6 acceptance filters in 2 mailboxes:

  • MB0 contains 2 acceptance filters in relation with 1 acceptance mask
  • MB1 contains 4 acceptance filters in relation with 1 acceptance mask
                MB0          MB1
              +------+    +------+
      mask 0  | RXM0 |    | RXM1 | mask 1
              +======+    +======+
     filter 0 | RXF0 |    | RXF2 | filter 2
              +------+    +------+
     filter 1 | RXF1 |    | RXF3 | filter 3
              +------+    +------+
                          | RXF4 | filter 4
                          +------+
                          | RXF5 | filter 5
                          +------+
    
#define MCP2515_RX_MAILBOXES   2
 
#define MCP2515_FILTERS_MB0   2
 
#define MCP2515_FILTERS_MB1   4
 
#define MCP2515_FILTERS   (MCP2515_FILTERS_MB0 + MCP2515_FILTERS_MB1)
 

Macro Definition Documentation

◆ CANDEV_MCP2515_DEFAULT_BITRATE

#define CANDEV_MCP2515_DEFAULT_BITRATE   500000

Default CAN bitrate.

Definition at line 44 of file candev_mcp2515.h.

◆ CANDEV_MCP2515_DEFAULT_SPT

#define CANDEV_MCP2515_DEFAULT_SPT   875

Default sampling point setup.

Definition at line 51 of file candev_mcp2515.h.

◆ MCP2515_FILTERS

#define MCP2515_FILTERS   (MCP2515_FILTERS_MB0 + MCP2515_FILTERS_MB1)

Definition at line 82 of file candev_mcp2515.h.

◆ MCP2515_FILTERS_MB0

#define MCP2515_FILTERS_MB0   2

Definition at line 80 of file candev_mcp2515.h.

◆ MCP2515_FILTERS_MB1

#define MCP2515_FILTERS_MB1   4

Definition at line 81 of file candev_mcp2515.h.

◆ MCP2515_RX_MAILBOXES

#define MCP2515_RX_MAILBOXES   2

Definition at line 79 of file candev_mcp2515.h.

◆ MCP2515_TX_MAILBOXES

#define MCP2515_TX_MAILBOXES   3

Number of transmit mailboxes.

Definition at line 57 of file candev_mcp2515.h.

Typedef Documentation

◆ candev_mcp2515_t

MCP2515 candev descriptor.

Definition at line 86 of file candev_mcp2515.h.

Function Documentation

◆ candev_mcp2515_init()

void candev_mcp2515_init ( candev_mcp2515_t dev,
const candev_mcp2515_conf_t conf 
)

Initialize a mcp2515 device by assigning a timing and an SPI configuration conf.

Parameters
[out]devmcp2515 device descriptor
[in]confmcp2515 configuration