 | RL-ARM User's Guide |  |
|
|
| ConfigurationCAN Hardware ConfigurationThe following symbols specify CAN Hardware Configuration related parameters and are located in CAN_LPC229x.c file: - PCLK (Peripheral CLocK) constant is used to calculate the correct communication speed (baudrate). The value of this constant must be calculated manually and is dependent on VPBDIV and MSEL settings in the Startup file. The value is equal to VPB Clock.
#define PCLK 60000000 /* VPB Clock = CPU Clock,
MSEL = 5,
xtal = 12 MHz,
CPU Clock = 60 MHz (MSEL * xtal) */
- VIC_NUM_CTRL1_TX .. VIC_NUM_CTRL4_TX specifies which vectored interrupt number to use for message transmission.
Since transmission is interrupt driven, it is necessary to define unique numbers of interrupts used for each controller's transmission. Acceptable values are 0 .. 15. The lower values have a higher priority.
#define VIC_NUM_CTRL1_TX 11
- VIC_NUM_CTRL1_RX .. VIC_NUM_CTRL4_RX specifies which vectored interrupt number is going to be used for message reception.
Since reception is interrupt driven, it is necessary to define unique numbers of interrupts used for each controller's reception. Acceptable values are 0 .. 15. The lower values have a higher priority.
#define VIC_NUM_CTRL1_RX 7
CAN Generic ConfigurationThe following symbols specify CAN Generic Configuration related parameters and are located in CAN_Cfg.h file: - USE_CAN_CTRL1 .. USE_CAN_CTRL4 enables the CAN controller that will be used. To enable the CAN controller, set this value to 1.
The RL-CAN uses this information to reserve the memory pool and the memory for software FIFO buffers, as well as to enable interrupts for handling transmission and reception of CAN messages on the specified CAN controller.
#define USE_CAN_CTRL1 1
#define USE_CAN_CTRL2 1
#define USE_CAN_CTRL3 0
#define USE_CAN_CTRL4 0
Using Configuration WizardYou can use the Configuration Wizard to select the parameters as shown in the picture below. File CAN_LPC229x.c edited with Configuration Wizard: 
File CAN_Cfg.h edited with Configuration Wizard: 
|
|