lpcware

LPC1769 CANbus off

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by pollo89 on Wed Feb 20 04:42:51 MST 2013
Hi,
I've a LPC1769 and I connected it to my PC via CAN ( with a IXXAT USBtoCAN compact ). My firmware is a simply loop that ReceiveMessage ( and increase an index ).
I send messages with MiniMon ( ixxat software ) and it's all ok, but when I continue sending, minimon stop connections ( bus off ).
My question is: "Is code ok?".

See minimon log that i allegated.
Here my code
int main(void) {
    unsigned long i;
    CAN_MSG_Type RxMsg;            // Can RxMsg.
    PINSEL_CFG_Type pinCfg;
    // Initialize pins
    pinCfg.Funcnum = 1;
    pinCfg.OpenDrain = pinCfg.Pinmode = pinCfg.Portnum = 0;
    pinCfg.Pinnum = 0;
    PINSEL_ConfigPin(&pinCfg);  // P0.0 = CAN1RX
    pinCfg.Pinnum = 1;
    PINSEL_ConfigPin(&pinCfg);  // P0.1 = CAN1TX

    CAN_Init(LPC_CAN1 , 500000 );            // Initialize CAN1 at 500kbps
    CAN_SetAFMode( LPC_CANAF , CAN_AccBP ); // Bypass Access Filter. All ID accepted.
    i=0;
    while(1)
    {
        if( CAN_ReceiveMsg( LPC_CAN1 , &RxMsg ) == SUCCESS ) // Receive a message
            i++;
    }
    return 0 ;
}

Outcomes