Microchip® Advanced Software Framework

qs_mcan_basic.c File Reference

SAM MCAN basic Quick Start.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include <string.h>
#include <conf_mcan.h>

Macros

#define MCAN_RX_EXTENDED_FILTER_ID_0   0x100000A5
 
#define MCAN_RX_EXTENDED_FILTER_ID_0_BUFFER_INDEX   1
 
#define MCAN_RX_EXTENDED_FILTER_ID_1   0x10000096
 
#define MCAN_RX_EXTENDED_FILTER_INDEX_0   0
 
#define MCAN_RX_EXTENDED_FILTER_INDEX_1   1
 
#define MCAN_RX_STANDARD_FILTER_ID_0   0x45A
 
#define MCAN_RX_STANDARD_FILTER_ID_0_BUFFER_INDEX   2
 
#define MCAN_RX_STANDARD_FILTER_ID_1   0x469
 
#define MCAN_RX_STANDARD_FILTER_INDEX_0   0
 
#define MCAN_RX_STANDARD_FILTER_INDEX_1   1
 
#define MCAN_TX_BUFFER_INDEX   0
 

Functions

static void configure_console (void)
 Configure UART console. More...
 
static void configure_mcan (void)
 MCAN module initialization. More...
 
static void display_menu (void)
 display configuration menu. More...
 
int main (void)
 
void MCAN1_INT0_Handler (void)
 Interrupt handler for MCAN, inlcuding RX,TX,ERROR and so on processes. More...
 
static void mcan_send_extended_message (uint32_t id_value, uint8_t *data, uint32_t data_length)
 send extended MCAN message, More...
 
static void mcan_send_standard_message (uint32_t id_value, uint8_t *data, uint32_t data_length)
 send standard MCAN message, More...
 
static void mcan_set_extended_filter_0 (void)
 set receive extended MCAN ID, dedicated buffer More...
 
static void mcan_set_extended_filter_1 (void)
 set receive extended MCAN ID,FIFO buffer. More...
 
static void mcan_set_standard_filter_0 (void)
 set receive standard MCAN ID, dedicated buffer More...
 
static void mcan_set_standard_filter_1 (void)
 set receive standard MCAN ID,FIFO buffer. More...
 

Variables

static volatile uint32_t extended_receive_index = 0
 
static struct mcan_module mcan_instance
 
static struct
mcan_rx_element_buffer 
rx_element_buffer
 
static struct
mcan_rx_element_fifo_0 
rx_element_fifo_0
 
static struct
mcan_rx_element_fifo_1 
rx_element_fifo_1
 
static volatile uint32_t standard_receive_index = 0
 
static uint8_t tx_message_0 [CONF_MCAN_ELEMENT_DATA_SIZE]
 
static uint8_t tx_message_1 [CONF_MCAN_ELEMENT_DATA_SIZE]
 

#define MCAN_RX_EXTENDED_FILTER_ID_0   0x100000A5

Referenced by main(), and mcan_set_extended_filter_0().

#define MCAN_RX_EXTENDED_FILTER_ID_0_BUFFER_INDEX   1
#define MCAN_RX_EXTENDED_FILTER_ID_1   0x10000096

Referenced by main(), and mcan_set_extended_filter_1().

#define MCAN_RX_EXTENDED_FILTER_INDEX_0   0
#define MCAN_RX_EXTENDED_FILTER_INDEX_1   1
#define MCAN_RX_STANDARD_FILTER_ID_0   0x45A

Referenced by main(), and mcan_set_standard_filter_0().

#define MCAN_RX_STANDARD_FILTER_ID_0_BUFFER_INDEX   2
#define MCAN_RX_STANDARD_FILTER_ID_1   0x469

Referenced by main(), and mcan_set_standard_filter_1().

#define MCAN_RX_STANDARD_FILTER_INDEX_0   0
#define MCAN_RX_STANDARD_FILTER_INDEX_1   1
#define MCAN_TX_BUFFER_INDEX   0

static void configure_console ( void  )
static

Configure UART console.

References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().

Referenced by main().

static void display_menu ( void  )
static

display configuration menu.

Referenced by main().

static void mcan_send_extended_message ( uint32_t  id_value,
uint8_t *  data,
uint32_t  data_length 
)
static
static void mcan_send_standard_message ( uint32_t  id_value,
uint8_t *  data,
uint32_t  data_length 
)
static

volatile uint32_t extended_receive_index = 0
static

Referenced by MCAN1_INT0_Handler().

struct mcan_rx_element_buffer rx_element_buffer
static

Referenced by MCAN1_INT0_Handler().

struct mcan_rx_element_fifo_0 rx_element_fifo_0
static

Referenced by MCAN1_INT0_Handler().

struct mcan_rx_element_fifo_1 rx_element_fifo_1
static

Referenced by MCAN1_INT0_Handler().

volatile uint32_t standard_receive_index = 0
static

Referenced by MCAN1_INT0_Handler().

uint8_t tx_message_0[CONF_MCAN_ELEMENT_DATA_SIZE]
static

Referenced by configure_mcan(), and main().

uint8_t tx_message_1[CONF_MCAN_ELEMENT_DATA_SIZE]
static

Referenced by configure_mcan(), and main().