Can Message Receive Loss S32k344

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

Can Message Receive Loss S32k344

2,916 Views
Wei_H
Contributor III

There is an issue with CAN data loss when receiving. That is, I have made a counter in the receive interrupt to count up how many CAN message that received by the chip. From the result, it seems that there are loss even under low load. Please help identify issue. Thank you.

Wei_H_0-1729297798723.pngWei_H_1-1729297803551.png

@robertv 

 

0 Kudos
Reply
5 Replies

2,874 Views
Adrian_Gherca
NXP Employee
NXP Employee

Hello and thank for you interest in using MBDT,

Having your Simulink model attached to this post would allow us to better understand the issue but still, there are a few general things to consider when using the CAN communication blocks for receiving messages.

    1) Please make sure that you have multiple CanHardwareObjects configured in your configuration project. If available resources allow it, there could be one for each Can ID in the network, for better performance.
A CanHardwareObject can be configured to accept only certain Can IDs by setting the CanHwFilters in your configuration project (EB Tresos or S32 COnfiguration Tools)

Adrian_Gherca_0-1729501392680.png

    2) If you are using CanHardwareObjects with Polling processing type (not recommneded for high loads), in addition to the suggestion from point 1),  the Fixed-step size can be reduced in order to better handle the incoming messages.

Adrian_Gherca_0-1729503638319.png

 

0 Kudos
Reply

2,852 Views
Wei_H
Contributor III

Hi @Adrian_Gherca ,

Thanks for your quick response, I have attached the model along with its configuration.

I have created a test to calculate receive counter for each CAN and output in the UART.

The result show that CAN0 receive the exact amount, however, CAN 1, 2, 3 are not having the correct number of receive counter.  CAN 1 have received less than it sent, CAN 2 and CAN 3 have received more then it sent.

Wei_H_3-1729559902099.png

In the CAN controller configuration, 0, 1, 2, is for CAN 0 with different setting 3, 4, 5, 6, 7 is for CAN 1, 2, 3, 4, 5. Does adding more CAN hardware object here like CAN 0  for all the other CAN would resolve the issue? 

Wei_H_0-1729559128210.png

I have added CanRxFiFo in canController for CAN 1, 2, 3, 4, 5 with the following set up.

Is the setting correct for using legacy RxFIFO?

Wei_H_1-1729559278254.png

We are not planning to use polling, and hope that interrupt and RxFIFO can help resolve the issue mentioned above. Thanks!

 

0 Kudos
Reply

2,776 Views
Adrian_Gherca
NXP Employee
NXP Employee

Hello,

I see that you are using the Hardware Interrupt Callback block set for CanIf_RxIndication for receiving the CAN messages and then a Uart_SyncSend block for sending the messages further.
Here are a few things to consider to improve this transfer:

1) In this scenario you are using two different communication protocols for monitoring the CAN messages traffic. Depending on your configuration project it might be the case that the UART transmission works at a slower speed than the CAN reception.

2) You can try doing a synchronization between the CAN and UART commuication blocks. In the IRQ Handler callback subsystem RX_Complete_Event

Adrian_Gherca_3-1729857486742.png
call the UART_SyncSend block directly in the interrupt of the CAN RX_Complete_Event callback:

Adrian_Gherca_4-1729859676662.png

 

 


 









0 Kudos
Reply

2,759 Views
Wei_H
Contributor III

Hi @Adrian_Gherca 

I have updated a version to observe data through FreeMaster so that it's more clear to describing the issue.

 

Here's what my model now looks like:

Wei_H_1-1729882258138.png

Here's what inside can_out subsystem

Wei_H_2-1729882291618.png

We speculate that CAN2 and CAN3 will sometime received data that was meant for CAN0 and CAN1, when all four CAN and sending. This is chart is used to mainly calculate how many receive CAN message coming in from each CAN and how many times does a CAN received message that shouldn't be receiving. This test is to show that data integrity is lost when all 4 CANs are actively receiving.

 

Test1, CAN0 and CAN1 only:

Wei_H_3-1729882603117.png

in this case, everything works as expected, we can see that the number of transmit and received match for when only CAN0 and CAN1 are active.

 

Test2, CAN2 and CAN 3 only:

Wei_H_4-1729882654013.png

 

In this case, everything work as expected, CAN2 and CAN3 are receiving the exact amount be sent.

Test3, CAN0, CAN1, CAN2, and CAN 3:

Wei_H_5-1729882740923.png

 

In this case, we noticed that there are many error when all 4 CAN being active. we noticed that there are controller ID and hardware ID are being mixed incorrectly, that is we are expecting following:

ControllerID

0

1

2

3

4

5

CanHardwareObjectID

2

3

4

5

6

7

 

But if this is not the case, then ctrlErrorOut counter increase.

 

Furthermore, we added ID error test by checking source address for each CAN ID received, that is:

CAN

0

1

2

3

 

 

Source Address

0x01

0x02

0x03

0x04

 

 

 

And if this is not the case, we will consider there is ID error from the receiving side.

The same test is also done to check if data are received as expected by checking the first byte for each CAN. and we expect the following:

CAN

0

1

2

3

 

 

Data(1)

0x01

0x02

0x03

0x04

 

 

 

As we can see from test 3 image, controllerId and hardwareId does not match in occurred 42 times, and ID error in occurred 60 times, and Data error occured 98 times. So at least in this configuration, we are observing that CAN2 and CAN3 are being interfered by CAN0 and CAN1, causing data corruption and losing data integrity.

I have attached the project, let me know if there is any issue, thanks!

 

Tags (3)
0 Kudos
Reply

2,849 Views
Wei_H
Contributor III

Wei_H_0-1729561063013.png

We also tried enable FIFODMA, however, we are running into issue with the configuration. Let me know how to correctly enable DMA. Thanks!

0 Kudos
Reply