#include "lpc17xx_can.h"#include "lpc17xx_libcfg.h"#include "lpc17xx_nvic.h"#include "lpc17xx_pinsel.h"#include "debug_frmwrk.h"Defines | |
| #define | CAN_PINSEL_RD1_P0_0 |
| #define | CAN_PINSEL_TD1_P0_1 |
| #define | CAN_PINSEL_RD2_P0_4 |
| #define | CAN_PINSEL_TD2_P0_5 |
| #define | CAN_PINSEL_RD1_P0_21 |
| #define | CAN_PINSEL_TD1_P0_22 |
| #define | CAN_PINSEL_RD2_P2_7 |
| #define | CAN_PINSEL_TD2_P2_8 |
| #define | CAN_MAX_RD1_PIN (2) |
| #define | CAN_MAX_TD1_PIN (2) |
| #define | CAN_MAX_RD2_PIN (2) |
| #define | CAN_MAX_TD2_PIN (2) |
| #define | MAX_ENTRY 512 |
| #define | CAN_TX_MSG_CNT 10 |
| #define | CAN_RX_MSG_CNT 5 |
Functions | |
| void | CAN_IRQHandler (void) |
| CAN_IRQ Handler. | |
| void | CAN_Callback0 () |
| FullCAN Recevie Interrupt call-back function. | |
| void | CAN_Callback1 () |
| Recevie Message Interrupt call-back function. | |
| void | CAN_Callback2 () |
| Data overrun interrupt call-back function. | |
| void | CAN_PinCfg (void) |
| void | CAN_InitMessage (void) |
| void | CAN_SetupAFTable (void) |
Init AF-Look Up Table Sections entry value We setup entries for 5 sections:
| |
| void | CAN_InitAFMessage (void) |
Init Transmit Message We use 10 message to test Acceptance Filter operation, include:
| |
| void | PrintMessage (CAN_MSG_Type *CAN_Msg) |
| Print Message via COM1 param[in] msg: point to CAN_MSG_Type object that will be printed. | |
| void | print_menu () |
| print menu | |
| int | c_entry (void) |
| int | main (void) |
| void | check_failed (uint8_t *file, uint32_t line) |
Variables | |
| uint8_t | menu [] |
| const PINSEL_CFG_Type | can_rd1_pin [CAN_MAX_RD1_PIN] |
| const PINSEL_CFG_Type | can_td1_pin [CAN_MAX_TD1_PIN] |
| const PINSEL_CFG_Type | can_rd2_pin [CAN_MAX_RD2_PIN] |
| const PINSEL_CFG_Type | can_td2_pin [CAN_MAX_TD2_PIN] |
| CAN_MSG_Type | AFTxMsg [CAN_TX_MSG_CNT] |
| CAN_MSG_Type | AFRxMsg [CAN_RX_MSG_CNT] |
| uint32_t | CANRxCount = 0 |
| uint32_t | CANTxCount = 0 |
| uint32_t | CANErrCount = 0 |
| AF_SectionDef | AFTable |
| FullCAN_Entry | FullCAN_Table [6] |
| SFF_Entry | SFF_Table [6] |
| SFF_GPR_Entry | SFF_GPR_Table [6] |
| EFF_Entry | EFF_Table [6] |
| EFF_GPR_Entry | EFF_GPR_Table [6] |
| #define CAN_PINSEL_RD1_P0_0 |
Value:
{0, 0, 1, \
PINSEL_PINMODE_PULLUP, \
PINSEL_PINMODE_NORMAL}
| #define CAN_PINSEL_RD1_P0_21 |
Value:
{0, 21, 3, \
PINSEL_PINMODE_PULLUP, \
PINSEL_PINMODE_NORMAL}
| #define CAN_PINSEL_RD2_P0_4 |
Value:
{0, 4, 2, \
PINSEL_PINMODE_PULLUP, \
PINSEL_PINMODE_NORMAL}
| #define CAN_PINSEL_RD2_P2_7 |
Value:
{2, 7, 1, \
PINSEL_PINMODE_PULLUP, \
PINSEL_PINMODE_NORMAL}
| #define CAN_PINSEL_TD1_P0_1 |
Value:
{0, 1, 1, \
PINSEL_PINMODE_PULLUP, \
PINSEL_PINMODE_NORMAL}
| #define CAN_PINSEL_TD1_P0_22 |
Value:
{0, 22, 3, \
PINSEL_PINMODE_PULLUP, \
PINSEL_PINMODE_NORMAL}
| #define CAN_PINSEL_TD2_P0_5 |
Value:
{0, 5, 2, \
PINSEL_PINMODE_PULLUP, \
PINSEL_PINMODE_NORMAL}
| #define CAN_PINSEL_TD2_P2_8 |
Value:
{2, 8, 1, \
PINSEL_PINMODE_PULLUP, \
PINSEL_PINMODE_NORMAL}
| int c_entry | ( | void | ) |
THE MAIN CAN BODY
| void CAN_Callback0 | ( | void | ) |
FullCAN Recevie Interrupt call-back function.
| [in] | none |
| void CAN_Callback1 | ( | void | ) |
Recevie Message Interrupt call-back function.
| [in] | none |
| void CAN_Callback2 | ( | ) |
Data overrun interrupt call-back function.
| [in] | none |
| void CAN_InitAFMessage | ( | void | ) |
Init Transmit Message We use 10 message to test Acceptance Filter operation, include:
| [in] | none |
| void CAN_IRQHandler | ( | void | ) |
CAN_IRQ Handler.
| [in] | none |
| void CAN_SetupAFTable | ( | void | ) |
Init AF-Look Up Table Sections entry value We setup entries for 5 sections:
| [in] | none |
| void print_menu | ( | void | ) |
print menu
| [in] | none |
Print menu.
| [in] | none |
Print Welcome Screen Menu subroutine.
print_menu
Print Welcome menu.
print menu
| [in] | none |
| [in] | none |
| [in] | None |
| None |
| [in] | none |
| void PrintMessage | ( | CAN_MSG_Type * | CAN_Msg | ) |
Print Message via COM1 param[in] msg: point to CAN_MSG_Type object that will be printed.
| const PINSEL_CFG_Type can_rd1_pin[CAN_MAX_RD1_PIN] |
Initial value:
| const PINSEL_CFG_Type can_rd2_pin[CAN_MAX_RD2_PIN] |
Initial value:
{
CAN_PINSEL_RD2_P0_4, CAN_PINSEL_RD2_P2_7 }
| const PINSEL_CFG_Type can_td1_pin[CAN_MAX_TD1_PIN] |
Initial value:
{
CAN_PINSEL_TD1_P0_1, CAN_PINSEL_TD1_P0_22 }
| const PINSEL_CFG_Type can_td2_pin[CAN_MAX_TD2_PIN] |
Initial value:
{
CAN_PINSEL_TD2_P0_5, CAN_PINSEL_TD2_P2_8 }
| uint8_t menu[] |
Initial value:
"********************************************************************************\n\r"
"Hello NXP Semiconductors \n\r"
"CAN demo \n\r"
"\t - MCU: LPC17xx \n\r"
"\t - Core: ARM CORTEX-M3 \n\r"
"\t - Communicate via: UART0 - 115200 bps \n\r"
"Use 2 CAN peripherals: CAN1&CAN2 to transfer data\n\r"
"This example tests full Acceptance Filter operation \n\r"
"It supports FullCAN and Group ID Frame Format \n\r"
"********************************************************************************\n\r"
1.5.8