Hello,
can me somebody help?LPC has only 32 can messages, which make interrupt. It is posible to catch all messages on CAN?
I have:
Init function
Chip_SCU_PinMuxSet(3, 1,(SCU_MODE_INACT | SCU_MODE_INBUFF_EN | SCU_MODE_FUNC2));
Chip_SCU_PinMuxSet(3, 2,(SCU_MODE_INACT | SCU_MODE_FUNC2));
Chip_SCU_PinMuxSet(2, 13, (SCU_MODE_FUNC0 | SCU_PINIO_FAST));
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 1, 13); /* GPIO5[6] = USB1_PWR_EN */
Chip_GPIO_SetPinState(LPC_GPIO_PORT, 1, 13, false); /* GPIO5[6] output high */
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_EnableTestMode(LPC_C_CAN0);
Chip_CCAN_ConfigTestMode(LPC_C_CAN0, (CCAN_TEST_BASIC_MODE | CCAN_TEST_BASIC_MODE));
Chip_CCAN_EnableInt(LPC_C_CAN0, (CCAN_CTRL_IE | CCAN_CTRL_SIE | CCAN_CTRL_EIE));
NVIC_EnableIRQ(C_CAN0_IRQn);
and interrupt function:
void CAN0_IRQHandler(void)
{
CCAN_MSG_OBJ_T msg_buf;
uint32_t can_interrupt;
uint32_t can_status;
uint16_t can_mini_id_0 = 0;
uint16_t can_mini_id_1 = 0;
uint16_t i_mod = 0;
while ( (can_interrupt = Chip_CCAN_GetIntID(LPC_C_CAN0)) != 0 )
{
if ((CCAN_INT_STATUS == can_interrupt) && (CCAN_STAT_RXOK & LPC_C_CAN0->STAT))
{
msg_buf.id = (LPC_C_CAN0->IF[CCAN_MSG_IF1].ARB1 | LPC_C_CAN0->IF[CCAN_MSG_IF1].ARB2 << 16);
.....
LPC_C_CAN0->STAT = LPC_C_CAN0->STAT & (~CCAN_STAT_RXOK);
}
}
but I can't to catch any messages....
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------