lpcware

LPC1769 CAN DRIVER INTERRUPT NOT HAPPENIG

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by 00zigor on Thu Sep 11 14:18:53 MST 2014
Hi, everyone.

I've just started working on LPC1769 on an custom board and i'm having problems getting the CAN BUS to work using the drivers and software examples provided here.

After some research here i've read that the drivers has a lot of bugs, and the links i've found pointing to new drivers always redirect to home in LPCware.com.

So, I can't find new drivers or examples more up to date.

I'm using a simple MCP2551 transceiver to recieve a messagem from another device transmitting every 10ms.

I already used a similar driver on LPC1788 and it worked fine.

Using a osciloscope i made sure that the signal is reaching the transceiver and is wired to the correct pins on the 1769.

I'm trying to enable CAN RX interruption but when the data comes the interruption doesn't happen.

Here's the exmple code before anyone asks:


/*********************************************************************//**
* @briefCAN_IRQ Handler, control receive message operation
* param[in]none
* @return none
**********************************************************************/
void CAN_IRQHandler()
{
uint8_t IntStatus;

IntStatus = CAN_IntGetStatus(LPC_CAN1);

//check receive interrupt
if((IntStatus >> 0) & 0x01)
{
TOGGLE_RX_LED;

}
}

int main(void) {

  /* Pin configuration
   * CAN1: select P0.21 as RD1. P0.22 as TD1 */
    PinCfg.Funcnum = 2;
    PinCfg.OpenDrain = 0;
    PinCfg.Pinmode = 0;
    PinCfg.Pinnum = 0;
    PinCfg.Portnum = 21;
    PINSEL_ConfigPin(&PinCfg);
    PinCfg.Pinnum = 22;
    PINSEL_ConfigPin(&PinCfg);

  //Initialize CAN1
    CAN_Init(LPC_CAN1, 125000);

  //Enable Interrupt
    CAN_IRQCmd(LPC_CAN1, CANINT_RIE, ENABLE);
    CAN_SetAFMode(LPC_CANAF,CAN_AccBP);

  //Enable CAN Interrupt
    NVIC_EnableIRQ(CAN_IRQn);

  // Force the counter to be placed into memory
    volatile static int i = 0 ;

  // Enter an infinite loop, just incrementing a counter
    while(1) {
        i++ ;
    }
    return 0 ;

Outcomes