CAN/CAN_test_AFLUT/can_test_AFLUT.c File Reference

#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:
  • 6 entries for FullCAN Frame Format Section
  • 6 entries for Explicit Standard ID Frame Format Section
  • 6 entries for Group of Standard ID Frame Format Section
  • 6 entries for Explicit Extended ID Frame Format Section
  • 6 entries for Group of Extended ID Frame Format Section.

void CAN_InitAFMessage (void)
 Init Transmit Message We use 10 message to test Acceptance Filter operation, include:
  • 5 messages that ID exit in 5 AF Sections -> they will be receive
  • 5 messages that ID not exit in 5 AF Sections -> they will be ignored.

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]

Detailed Description

: This example used to test Acceptance Filter mode
Version:
: 1.0
Date:
: 1. June. 2009
Author:
: NguyenCao ---------------------------------------------------------------------------- Software that is described herein is for illustrative purposes only which provides customers with programming information regarding the products. This software is supplied "AS IS" without any warranties. NXP Semiconductors assumes no responsibility or liability for the use of the software, conveys no license or title under any patent, copyright, or mask work right to the product. NXP Semiconductors reserves the right to make changes in the software without notification. NXP Semiconductors also make no representation or warranty that such application will be suitable for the specified use without further testing or modification.

Define Documentation

#define CAN_PINSEL_RD1_P0_0

Value:

{0, 0, 1, \
                                                                PINSEL_PINMODE_PULLUP, \
                                                                PINSEL_PINMODE_NORMAL}
CAN function pin selection group 0

#define CAN_PINSEL_RD1_P0_21

Value:

{0, 21, 3, \
                                                                PINSEL_PINMODE_PULLUP, \
                                                                PINSEL_PINMODE_NORMAL}
CAN function pin selection group 1

#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}


Function Documentation

int c_entry ( void   ) 

THE MAIN CAN BODY

void CAN_Callback0 ( void   ) 

FullCAN Recevie Interrupt call-back function.

Parameters:
[in] none 
Returns:
none

void CAN_Callback1 ( void   ) 

Recevie Message Interrupt call-back function.

Parameters:
[in] none 
Returns:
none

void CAN_Callback2 (  ) 

Data overrun interrupt call-back function.

Parameters:
[in] none 
Returns:
none

void CAN_InitAFMessage ( void   ) 

Init Transmit Message We use 10 message to test Acceptance Filter operation, include:

  • 5 messages that ID exit in 5 AF Sections -> they will be receive
  • 5 messages that ID not exit in 5 AF Sections -> they will be ignored.

Parameters:
[in] none 
Returns:
none

void CAN_IRQHandler ( void   ) 

CAN_IRQ Handler.

Parameters:
[in] none 
Returns:
none

void CAN_SetupAFTable ( void   ) 

Init AF-Look Up Table Sections entry value We setup entries for 5 sections:

  • 6 entries for FullCAN Frame Format Section
  • 6 entries for Explicit Standard ID Frame Format Section
  • 6 entries for Group of Standard ID Frame Format Section
  • 6 entries for Explicit Extended ID Frame Format Section
  • 6 entries for Group of Extended ID Frame Format Section.

Parameters:
[in] none 
Returns:
none

void print_menu ( void   ) 

print menu

Parameters:
[in] none 
Returns:
none
print menu

Print menu.

Parameters:
[in] none 
Returns:
none
print menu

Print Welcome Screen Menu subroutine.

print_menu

Print Welcome menu.

print menu

Parameters:
[in] none 
Returns:
none
Parameters:
[in] none 
Returns:
None
Parameters:
[in] None 
Returns:
None
Parameters:
None 
Returns:
None
Print menu.

Parameters:
[in] none 
Returns:
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.

Returns:
none


Variable Documentation

const PINSEL_CFG_Type can_rd1_pin[CAN_MAX_RD1_PIN]

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"


Generated on Thu Apr 22 11:13:08 2010 for CMSISExampleCode by  doxygen 1.5.8