LPC1769 CAN Stuff Error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1769 CAN Stuff Error

814 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rails on Thu Sep 08 02:36:20 MST 2011
Hey,
I am playing around with the LPC1769 CAN Bus at the moment, but somehow the only thing I get if I send Messages are Stuff Errors with Tolerate Dominant Bit Error. I use the "lpc17xx_can.h" as driver. What did I miss?

Here's the Code:
#include "lpc17xx_can.h"

int main ()
{
    CAN_Init(LPC_CAN2, 125000);

    // P0.4 and P0.5
    PINSEL_CFG_Type PinCfg;
    PinCfg.Funcnum = 2;
    PinCfg.OpenDrain = 0;
    PinCfg.Pinmode = 0;
    PinCfg.Portnum = 0;
    PinCfg.Pinnum = 4;;
    PINSEL_ConfigPin(&PinCfg);
    PinCfg.Pinnum = 5;
    PINSEL_ConfigPin(&PinCfg);

    CAN_PinCFG_Type can_pincfg;
    can_pincfg.RD = CAN_RD2_P0_4;
    can_pincfg.TD = CAN_TD2_P0_5;

    CAN_MSG_Type can_msg;
    can_msg.dataA[0] = 0xDE;
    can_msg.dataA[1] = 0xAD;
    can_msg.dataA[2] = 0xAA;
    can_msg.dataA[3] = 0xAA;
    can_msg.dataB[0] = 0x00;
    can_msg.dataB[1] = 0x00;
    can_msg.dataB[2] = 0xAA;
    can_msg.dataB[3] = 0xAA;
    can_msg.format = STD_ID_FORMAT;
    can_msg.id = 100;
    can_msg.len = 8;
    can_msg.type = DATA_FRAME;

    CAN_IRQCmd(LPC_CAN2, CANINT_TIE1, ENABLE);
    CAN_SetAFMode(LPC_CANAF,CAN_AccOff);

    //Enable CAN Interrupt
    NVIC_EnableIRQ(CAN_IRQn);
    int i;
    while(1) {
        CAN_SendMsg(LPC_CAN2, &can_msg);
        for(i=0;i<10000000;i++){};
    }

    while(1){};

    return 0;
}
0 Kudos
3 Replies

713 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rails on Mon Sep 12 08:46:15 MST 2011
Thx for the answers, in the end it was a missing Capacitor on our self soldered board which we use in combination with the lpc1769.
0 Kudos

713 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Sep 08 07:49:00 MST 2011
Notes:

#1 Select your can pin functions before you init CAN  

#2 Is this part used somewhere :confused:

CAN_PinCFG_Type can_pincfg;
    can_pincfg.RD = CAN_RD2_P0_4;
    can_pincfg.TD = CAN_TD2_P0_5;
0 Kudos

713 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Polux rsv on Thu Sep 08 05:57:43 MST 2011
Read this post http://knowledgebase.nxp.com/showthread.php?t=1711
A corrected driver is posted in the last page.

Angelo
0 Kudos