Hello,
I decided to put this issue to global, instead of reply only post (put hereS32K144 problems with LPSPI 16bit transmission to UJA1169 )
I'm working with UJA1169 SBC and according to some info (mentioned in discussion link above) it should be in Force Normal Mode. I wanted to use CAN communication only for my purposes. In this mode CAN transceiver should be (always) enabled. But unfortunately it looks like it does work only in one direction - sending. Receiving CAN messages doesn't work at all.
I'm using FLEXCAN library. When FLEXCAN_DRV_Receive is called and I check the the transfer status the answer is always STATUS_BUSY (commented line).
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;
}
}
}
Any hint what could possibly go wrong?