FlexCAN IP example not running in normal mode on S32K344 EVB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FlexCAN IP example not running in normal mode on S32K344 EVB

Jump to solution
3,404 Views
rmariani
Contributor II

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.

Tags (1)
0 Kudos
1 Solution
3,281 Views
rmariani
Contributor II

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.

View solution in original post

0 Kudos
14 Replies
3,387 Views
PetrS
NXP TechSupport
NXP TechSupport

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

0 Kudos
3,372 Views
rmariani
Contributor II

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.

 

0 Kudos
3,368 Views
rmariani
Contributor II
Also, Petr, in the TJA1153A documentation it states the following:
"The host controller must transmit Classical CAN messages with the standard identifier 0x555 until acknowledged by the TJA1153A for automatic bit rate detection. Configuration command messages can be sent once an acknowledgement has been received. Bit rates of 125 kbit/s, 250 kbit/s and 500 kbit/s are supported during the initial configuration phase."

How do you confirm TJA1153A acknowledged using the FlexCAN_Ip driver software? Do you look for transfer status to be OK?
0 Kudos
3,359 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

try below example tested on S32K344 EVB.
It configs TJA1153 in vanilla to pass all std/ext IDs and block no messages.

BR, Petr

0 Kudos
3,329 Views
rmariani
Contributor II

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++);

}

0 Kudos
3,320 Views
PetrS
NXP TechSupport
NXP TechSupport

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

0 Kudos
3,313 Views
rmariani
Contributor II
My board is connected to a CANcase which is connected to PC running CANoe. It seems as soon as I start the CANoe application then the bus immediately goes down. I have verified the CANcase is set for same 500K baudrate as my board. I'm wondering if I don't have some CAN register configured properly.
0 Kudos
3,309 Views
rmariani
Contributor II
I also received a classic CAN example for the K3 from an NXP application engineer and it is working fine on my EVB. I can see the CAN message on my CAN scope and also on my CANoe trace window. The example is not using MCAL or RTD but instead directly accessing the peripherals. However, I noticed on my CAN scope with the classic example that the ACK is missing just like my RTD example. However, the classic CAN code seems to tolerate the missing ACK where as the RTD example is not tolerating it.
0 Kudos
2,431 Views
Jayraj1
Contributor I

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

 

0 Kudos
2,344 Views
rmariani
Contributor II

Hi Jayraj1,

I have attached the classic CAN example.

2,325 Views
Jayraj1
Contributor I

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

 

0 Kudos
3,299 Views
rmariani
Contributor II

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? 

 

0 Kudos
3,288 Views
PetrS
NXP TechSupport
NXP TechSupport

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

0 Kudos
3,282 Views
rmariani
Contributor II

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.

0 Kudos