Hello,
carpenter and I are working with same SBC (same project by the way). Maybe this issue is connected maybe is not.
At this stage I wanted to use CAN communication only. As You said SBC should be in FNMC and CAN transceiver should be enabled at this point. But unfortunately only sending CAN messages works, but not receiving.
I'm using FLEXCAN library. When FLEXCAN_DRV_Receive is called and I check the the transfer status the answer is always STATUS_BUSY.
The app is not going through the callback (and so through FLEXCAN_DRV_IRQHandler as well), but when I'm use FLEXCAN_DRV_Send everything seems to work as it should.
Here is a sample code (only FLEXCAN code):
bool canDataReceived = false;
#define RX_MB (1U)
#define TX_MB (0U)
#define MSG_ID_1 0x1B0
#define MSG_ID_2 0x1C0
static void flexcan0_Callback(uint8_t instance,
flexcan_event_type_t eventType,
flexcan_state_t *flexcanState)
{
(void)flexcanState;
(void)instance;
switch(eventType)
{
case FLEXCAN_EVENT_RX_COMPLETE:
canDataReceived = true;
break;
case FLEXCAN_EVENT_TX_COMPLETE:
break;
default:
break;
}
}
int main(void)
{
(...)
FLEXCAN_DRV_Init(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig0);
FLEXCAN_DRV_ConfigTxMb(INST_CANCOM1, TX_MB, &dataInfo, MSG_ID_1);
FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, RX_MB, &dataInfo, MSG_ID_2);
FLEXCAN_DRV_InstallEventCallback(INST_CANCOM1, flexcan0_Callback, NULL);
flexcan_msgbuff_t recvBuff;
FLEXCAN_DRV_Receive(INST_CANCOM1, RX_MB, &recvBuff);
for (;;)
{
if (canDataReceived)
{
FLEXCAN_DRV_Receive(INST_CANCOM1, RX_MB, &recvBuff);
canDataReceived = false;
}
}
}
Do You (or anyone) know what could possibly go wrong?