lpcware

LPC4337 CAN0, CAN1: stuck in Chip_CCAN_Send

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by monnoliv on Thu Jun 18 04:41:51 MST 2015
Hi,

I'm using the LPC4337 for a while now. Since I have some problem with the CANs peripherals in mycode, I finally decided to use and test the lpcopen periph_can example.
The problem is that the periph_can example stay stuck with the Chip_CCAN_GetTxRQST() function (called in a while loop by Chip_CCAN_Send() ).
This function always return 1 instead of 0 then the Chip_CCAN_Send() function never return.

I can see with a scope that a frame is sent (however I don't know if this frame is complete).

Is someone has encountered this kind of problem?

Regards,

Olivier


For info, example code:
CCAN_MSG_OBJ_T send_obj;
SystemCoreClockUpdate();
Board_Init();
set_pinmux();
//DEBUGOUT(WelcomeMenu);
/* Set CCAN peripheral clock under 100Mhz for working stable */
Chip_Clock_SetBaseClock(CLK_BASE_APB3, CLKIN_IDIVC, true, false);
Chip_CCAN_Init(LPC_C_CAN0);
Chip_CCAN_SetBitRate(LPC_C_CAN0, 500000);
Chip_CCAN_EnableInt(LPC_C_CAN0, (CCAN_CTRL_IE | CCAN_CTRL_SIE | CCAN_CTRL_EIE));

send_obj.id = CCAN_TX_MSG_ID;
send_obj.dlc = 4;
send_obj.data[0] = 'A';
send_obj.data[1] = 'B';
send_obj.data[2] = 'C';
send_obj.data[3] = 'D';
Chip_CCAN_Send(LPC_C_CAN0, CCAN_MSG_IF2, FALSE, &send_obj);  <----- STUCK HERE
Chip_CCAN_ClearStatus(LPC_C_CAN0, CCAN_STAT_TXOK);

Outcomes