Hello,
I'm also getting the same problem as others here when using the FlexCAN example project "FlexCAN_Ip_Example_S32K344". I have also configured FlexCAN0_Callback instead of polling. When FlexCAN is in loopback mode I correctly detect MB Tx and Rx complete interrupts.
However, when I change from loop back to normal mode I do not ever see the MB Tx complete interrupt. I don't expect the MB Rx interrupt to be detected since I have not configured the TJA1153 yet. I need solve this fundemental problem first before I can go on to configure the TJA1153 in vanilla mode. Note I am monitoring PTA7 (CAN Tx) on scope and I see it properly but it is going continuously not just one time. This is because I believe the MB Tx interrupt is not happening. I'm attaching my main.c and mex file for you to test. Please let me know if you see anything wrong.
Solved! Go to Solution.
Hi Petr,
Thanks for your help. I'm attaching a working version of the FlexCAN example to the community. It uses the flexCAN call back. It uses both blocking and non-blocking version of Send command. Just un-comment the one to be used.
Hi,
TX interrupt (callback) is called once message is successfully transmitted without error. In your case, if transceiver is in Vanilla state, it is awaiting correct initialization and most probably a message, you transmitted, is not acknowledge by TJA1153. So it is transmitted still and you got no interrupt. You need to do a config first in Vanilla state.
Some modification of demo example is given in https://community.nxp.com/t5/S32K/S32K344-Evaluation-Board-FlexCan-Example-running/m-p/1343355
BR, Petr
Hi Petr,
I have tried you simple configuration example in main.c that you posted in other thread you listed and I still can't make work. I never see any activity on Tx (PTA7) pin and I always get that the transfer status is busy in the main while loop. Can you please check my project for correctness and test on your EVB if possible. Thanks.
Hi Petr,
I tried your example and it kind of works. To make it work I had to turn on the EN pin to the CAN chip. I now see the COFFEE message going out on the CAN bus. However, in the main while loop the FlexCAN_Ip_GetTransferStatus() always returns busy and thus I never see the first payload byte increment. Do you know why I always get busy?
while( !done )
{
idleCnt++;
status = FlexCAN_Ip_GetTransferStatus(INST_FLEXCAN_0, TX_MB_IDX);
if ( FLEXCAN_STATUS_BUSY != status )
{
dummyData[0]=byte_0++;
Sendstatus2 = FlexCAN_Ip_Send(INST_FLEXCAN_0, TX_MB_IDX, &tx_info, MSG_ID, (uint8 *)&dummyData);
}
int ii;
for(ii=0;ii<50000;ii++);
}
Hi,
is the message acknowledged by other nodes? If error is detected during transmission then it will be repeated by module and FlexCAN_Ip_GetTransferStatus do not return success.
Where is your board connected to?
Check FlexCAN ESR/ECR registers for detected error.
BR, Petr
hey rmariani,
can you share that classic CAN example for the K3 which you received from an NXP application engineer
i want to try on my evb to see can message out of the bus
hii rmariani and NXP team
i am using this Classic CAN example after converted it for S32K324 but while FlexCAN0Pins_Initialization code got terminated while Enabling EN and STB pins. so do you have idea on this?
also that FlecCAN RTD code which you have shred at last i also tried that but getting same like terminated while configuring SIUL pins for STB and EN,
thank you
Hi Petr,
I have resolved the issue. I was using the function FlexCAN_Ip_Send() with tx_info.is_polling set to true. If I set tx_info.is_polling to false the the Tx MB interrupt is happening. I believe I have to use the blocking version of send if tx_info.is_polling is set to true, correct?
Hi,
if I understand driver properly then for polling mode you can have 2 options
- using blocking function, tx_info.is_polling is don't care, I think. Interrupt is not enabled at all. Function returns after successful transmit or timeout.
- with tx_info.is_polling set and non blocking Send you should call FlexCAN_Ip_MainFunctionWrite which checks MB flag and update internal driver variables so FlexCAN_Ip_GetTransferStatus can be used. For example like
while(FlexCAN_Ip_GetTransferStatus(INST_FLEXCAN_0, TX_MB_IDX) != FLEXCAN_STATUS_SUCCESS)
{ FlexCAN_Ip_MainFunctionWrite(INST_FLEXCAN_0, TX_MB_IDX); }
BR, Petr
@PetrS ,
Can you please share the working project again ?
I tried to download, but it says no permission
Thank you