lpcware

Working LPC15xx LQFP48 CAN Sample

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by R2D2 on Fri Apr 24 07:04:14 MST 2015
This is a working CAN sample for LQFP48. Board library is included  :)

Working_CAN_Sample

[u]Note #1[/u]

This board library is a copy of the original LPCXpresso board library. To avoid pin muxing problems I've deleted all pin muxing entries in board_sysinit.c.

[u]Note #2[/u]

There are 3 LED's defined in board.c:

#define MAXLEDS 3
static const uint8_t ledpins[MAXLEDS] =  { 2, 3, 5};
static const uint8_t ledports[MAXLEDS] = { 0, 0, 0};


[u]Note #3[/u]

can.h is including options to switch to LOOPBACK / DAR  mode:

#define DAR_MODE//disable auto retransmission
#define LOOPBACK_MODE//enable LOOPBACK


[u]Note #4[/u]

CAN pins are selected in can_init() of can.c:

#ifdef LQFP48
//CAN signal muxing LQFP48
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 18, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 13, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
Chip_SWM_MovablePortPinAssign(SWM_CAN_TD1_O , 0, 18);
Chip_SWM_MovablePortPinAssign(SWM_CAN_RD1_I,  0, 13);
#endif
#ifdef LQFP64
/* Assign the pins rx 0[11] and tx 0[31] @ LQFP64 */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 11, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 31, (IOCON_MODE_INACT | IOCON_DIGMODE_EN));
Chip_SWM_MovablePinAssign(SWM_CAN_RD1_I, 11);/* Rx P0.11 */
Chip_SWM_MovablePinAssign(SWM_CAN_TD1_O, 31);/* Tx P0.31 */
#endif


LQFP48 / 64 is selected in can.h:

#define LQFP48//LQFP48 package


This pins are the default ISP CAN pins  :)

[u]LQFP48[/u]

CAN0_TD: PIO0_18 / Pin13
CAN0_RD: PIO0_13 / Pin21

Original Attachment has been moved to: Working_CAN_Sample.zip

Outcomes