Traffic on the CAN BUS causing the ECU to stop sending messages

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

Traffic on the CAN BUS causing the ECU to stop sending messages

2,230 Views
SAchary11
Contributor I

Hello NXP,

I am using MPC5748G(as Gateway) with s32 SDK software,

I have configured 4 channels out of which 2 channels are used for transmitting 2 CANFD messages and remaining 2 channels will be used to receive normal CAN messages from the height sensors.

The messages received from the sensors will be filtered  sent out on Tx channels which are configured to transmit the CANFD  messages to our main system through system direct CAN Bus.

I see it working fine when it is not connected to vehicle bus(when there is no traffic on the bus).

For info: I have configured the Data phase and arbitration phase exactly same as in the system.

 

As soon as I connect these transmit channels to the vehicle Bus(or System bus), It stops sending Tx messages after certain seconds.

The system Bus has around 4 to 5 messages for which our gateway has to acknowledge only for 1 messages which is sent by System through system Bus.

Since I don't see this problem when it is not connected to the main system,

I see that traffic on the system Bus is causing problem for gateway to send its Tx messages.

 

SAchary11_1-1692101791298.png

 

SAchary11_0-1692101720521.png

 

SAchary11_0-1692102146640.png

 

 

Please let me know why this problem is occuring in the lower layer of SDK

 

 

 

0 Kudos
Reply
15 Replies

2,198 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

repetitive calling of ConfigTxMb is not needed, I think, and it should not be called if you are not sure previous transmission was completed. Function deactivates TX MB. It should be enough to call Send function, but again this should be called once previous TX operation on selected MB was successfully completed. At least this function check internal status variable if transmission is complete or notfor selected TX MB. This is updated within Send function and after successful transmission within driver interrupt. So most probably Send function returns BUSY due to internal state->mbs[mb_idx].state is not FLEXCAN_MB_IDLE. Check this within debugger. Also check CODE field of used TX MB at that time. The module's ECR/ESR1 registers can give you info if any error are detected which prevents transmission.
Prepared message is send on first opportunity window on the CAN bus. If bus traffic is very high and message cannot win bus arbitration then sending can be delayed or not send at all in worst condition.

BR, Petr

0 Kudos
Reply

2,195 Views
SAchary11
Contributor I

Hi Petr,

If that is the case the problem would have occurred when I don't connect MPC5748G to main system(Steering system) also, Without connecting it to Main system I see that sensor messages are processed by MPC5748G and sent out on the bus through through configured channels without any problem.

Why do you think it works during that time?

As I mentioned even after connecting it to main system, MPC5748G has to acknowledge only one message that is sent by main system.

 

And  as you can see in my code I will call send function only after configuration of Tx MB is successful, 

Do you think after checking the status of configuration does it create problem?

 

 

0 Kudos
Reply

2,184 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

from the description I did not completely get how FlexCAN module(s) are used, if there are more CAN buses, etc. Generally, if FlexCAN is disconnected from bus and send message, it will not be ACKed, so repetitive Send calling must give you BUSY status. If it is connected and opposite node does not send anything, message will be normally transmitted once, assuming it is ACKed from opposite node. 
The ConfigTxMb only checks if selected MB index fits into configured MB range, if yes config (inactive) the MB and returns SUCCESS. It does not anyhow check if previous transmit is finished or not.

BR, Petr

0 Kudos
Reply

2,179 Views
SAchary11
Contributor I

Hi Petr,

 

I think again you are confused,

when it is disconnected from main system - It works fine , no issue -> I see that MPC5748G is continuously sending CANFD messages on the bus.(Just simulation vector Canoe box is there)

When it is connected to the main System- > MPC5748G stops sending its messages after few seconds.

I see the behavior in exact opposite manner. 

Really strange behavior.

If we can set up a meeting I can show this behavior.

0 Kudos
Reply

2,173 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

so on CAN bus you have 2 nodes, MPC5748G and CAN tool. In that case MPC5748G can send CANFD messages, CAN tool ACKs messages and you can see message within tool.
Once you connect some other node (main system) to this bus, MPC5748G stops sending messages. Is any error frames detected by Vector tool? Do you see error detected within FlexCAN module?
Do all nodes on the bus use same ISO CAN FD protocol?

BR, Petr

0 Kudos
Reply

2,167 Views
SAchary11
Contributor I

Hi PetrS,

SAchary11_0-1692271297887.png

As you can see in the above log, 1FE and 1FF are the messages received from Height sensors, these are normal CAN messages received by the channels CAN6  and CAN8 , after receiving these messages the MPC5748G will do filtering and internal calculation and will send out the info through a channels CAN 5 and CAN7 as CAN FD messages(Message ID -0x610). 

In the below log which is in system side it receives 0x610 for some time but after that it stops(highlighted in yellow)

SAchary11_1-1692271348776.png

I am using 2 separate vector Box, one at system side(screenshot 2) and another for MPC5748g(Screenshot 1)

Coming to your questions,

I don't see any CAN error in the CAN trace, MPC5748G just stops sending the messages after seeing the messages on the Bus.

All nodes on the BUS has CANFD configuration( 2 channel of MPC5748G which is connected to the system Bus has same configuration). You can see in the system log which I attached.

0 Kudos
Reply

2,071 Views
SAchary11
Contributor I

Hello Petr,

Any update on this! It looks like issue in the SDK, please let us know the reason.

 

I have configured CAN FD channel like this!

SAchary11_0-1692610663209.png

Strange this how traffic on the bus is causing the our MPC5748G to not send the messages,

Why busy is coming from the low layer,

0 Kudos
Reply

2,044 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

please specify SDK version you have.
A I already wrote, when busy is returned check with debugger driver internal state->mbs[mb_idx].state value. Also check CODE field of used TX MB at that time and MBs IFLAG/IMASK bit values. The module's ECR/ESR1 registers can be useful as well.

BR, Petr

0 Kudos
Reply

2,020 Views
SAchary11
Contributor I

Hi Petr,

SDK Version: S32DS_Power_v2.1

As you can see below state->mbs[mb_idx].state value is BUSY for both transmit and receive.

SAchary11_0-1692705851262.png

 

CAN2 and CAN 7 are used as a CANFD channels, here I attach the register values of the same when state value is busy. 

SAchary11_1-1692707518553.png

SAchary11_2-1692707561980.png

If I see the register values, I don't see any problem. 

It is always hitting this breakpoint in FLEXCAN_StartSendData()

SAchary11_0-1692707930972.png

 

Code of MB is attached " It is inactive

SAchary11_0-1692719877428.png

 

 

 

Thanks and Regards,

Sukesh

 

0 Kudos
Reply

2,002 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

so from pictures, it shows the MB1 message was transmitted (CODE is/becomes 0x8), the MB1 flag is set and IMASK as well. So MB interrupt should be called which updates status variable, calls callback if installed and clears MB flag and mask bits. So do you enter FLEXCAN_IRQHandler in this case? If yes, step through it to know TX part is executed.

BR, Petr

0 Kudos
Reply

1,736 Views
SAchary11
Contributor I

Hello Petr,

 

Both the message buffers are Busy(RX and TX message buffer), and IRQ and callback function is not called for the same.

Message buffer status:

SAchary11_0-1695134224472.png

 

Register value of CAN

SAchary11_1-1695134840461.png

Error is there in the channel and interrupt bit for the particular message buffer is not set. I am not sure why this error has occured, strange is this error occurs in the channel only when we introduce traffic on the bus, If there is no traffic then messages are transmitted properly. let us know why?

Please check the SDK and let us know.

SAchary11_0-1695135351031.png

 

We are waiting for NXP to support on this, If not please let us know

 

0 Kudos
Reply

1,660 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

it should be fine to know the error detected, from pictures error status bits are cleared. Those are always cleared when ESR1 is read, so also debugger can do that. Ideally read ESR1 within code, in error interrupt, etc. 
But if TX error counter stops at 0x80, it seems module is trying to send messages but it is not ACKed by other node(s). Could be fine to measure relevant signal too by scope/analyzer (TXD/RXD/CANH/L).
So try to check bit timing setting, so be sure it is set similarly on each node connected.

BR, Petr

0 Kudos
Reply

2,003 Views
SAchary11
Contributor I

Hi Petr,

We need support from NXP on this topic, please let us know how to setup the meeting for this, so that we can have online debugging session.

0 Kudos
Reply

2,159 Views
SAchary11
Contributor I

Hi Petrs,

I tried to create the same environment in the Canoe simulation after disconnecting the main system,

I see the same issue in MPC5748G, I am really not sure, why messages on the bus(system messages )creating the problem in MPC5748G, even though it is not configured to acknowledge the messages on the BUs,

It is strange behavior.

Something is SDK is creating this problem, I don't think any problem in application layer, It is just read and write,

Read and write is also called after successful configuration of Buffers, 

0 Kudos
Reply

2,208 Views
SAchary11
Contributor I

Hello NXp community,

Can you please let me know the reason,

It looks like problem in the lower layer of SDK, If I need to do any changes in the configuration, Please let me know, I would do the same.

0 Kudos
Reply