lpcware

LPC1769 CAN1 peripheral resets itself after message send

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by erbal_gfx on Thu Jul 30 03:54:59 MST 2015
Hello Guys!

I have a custom board with an LPC1769 uC on it. I want to use CAN1, and send a message first of all to check it.

After CAN initialization function I want to send a test message, but it don't happen and my peripheral sets itself to reset. Before send the register values looks fine, I've checked it. I also tested it in self test mode, in that case the TX interrupt is called, everything looks fine. My controller works on 112Mhz.

My CAN init function is the following:
(Somehow the forum doesn't show a big part of my code)
<code>

static void CAN1init(void)
{
PINSEL_CFG_Type PinCfg ={
.Portnum = PINSEL_PORT_0,
.Pinnum  = PINSEL_PIN_0,
.Funcnum = PINSEL_FUNC_1,
.OpenDrain = 0,
.Pinmode = PINSEL_PINMODE_NORMAL,
};
//CAN_RX
PINSEL_ConfigPin(&PinCfg);

//CAN TX
PinCfg.Pinnum = PINSEL_PIN_1;
PINSEL_ConfigPin(&PinCfg);

//CAN STB
PinCfg.Funcnum = PINSEL_FUNC_0;
PinCfg.Pinnum = PINSEL_PIN_3;
PinCfg.Portnum = PINSEL_PORT_2;
PinCfg.Pinmode = PINSEL_PINMODE_NORMAL;
PINSEL_ConfigPin(&PinCfg);
GPIO_SetDir(PINSEL_PORT_2, (1<<PINSEL_PIN_3), Output);
GPIO_ClearValue(PINSEL_PORT_2, (1<<PINSEL_PIN_3));

CAN_Init(LPC_CAN1, 500000);

CAN_ModeConfig(LPC_CAN1, CAN_TXPRIORITY_MODE, ENABLE);

CAN_IRQCmd(LPC_CAN1, CANINT_RIE, ENABLE);
CAN_IRQCmd(LPC_CAN1, CANINT_TIE1, ENABLE);

CAN_SetAFMode(LPC_CANAF,CAN_AccBP);

NVIC_EnableIRQ(CAN_IRQn);
}

</code>

Outcomes