Hello, I'm trying to run the lpc1768 CAN NXP sample code but the data is not received.following is there inilisation.i have connected CANH of CAN1 to CANH of CAN2 and iiy for CANL.but data is not received.
void CAN_setup (uint32_t ctrl) { LPC_CAN_TypeDef *pCAN = (ctrl == 1) ? LPC_CAN1 : LPC_CAN2; if (ctrl == 1) { LPC_SC->PCONP |= (1 << 13); /* Enable power to CAN1 block */ LPC_PINCON->PINSEL0 |= (1 << 0); /* Pin P0.0 used as RD1 (CAN1) */ LPC_PINCON->PINSEL0 |= (1 << 2); /* Pin P0.1 used as TD1 (CAN1) */ NVIC_EnableIRQ(CAN_IRQn); /* Enable CAN interrupt */ } else { LPC_SC->PCONP |= (1 << 14); /* Enable power to CAN2 block */ LPC_PINCON->PINSEL4 |= (1 << 14); /* Pin P2.7 used as RD2 (CAN2) */ LPC_PINCON->PINSEL4 |= (1 << 16); /* Pin P2.8 used as TD2 (CAN2) */ NVIC_EnableIRQ(CAN_IRQn); /* Enable CAN interrupt */ } LPC_CANAF->AFMR = 2; /* By default filter is not used */ pCAN->MOD = 1; /* Enter reset mode */ pCAN->IER = 0; /* Disable all interrupts */ pCAN->GSR = 0; /* Clear status register */ CAN_cfgBaudrate(ctrl, 500000); /* Set bit timing */ pCAN->IER = 0x0003; /* Enable Tx and Rx interrupt */ }
why PLCLSEL0 is not used for clk?
Hello,
I m also undergoing the same issue. if you got any solution, please let me know the same.
Thank you