CAN reception problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

CAN reception problem

560 次查看
AsierMaser
Contributor II

Hi everyone,

I have a problem when receiving some CAN messages from other devices. I recently posted a similar question (already solved) maybe this problem is related with that one.

I have 3 different CAN busses, all of them standard frame, reception is made via interruption and sending via polling. The problem is that some messages are not received correctly, this is, the data contained in the messages does not reach the board, or it does but with a huge delay, and then stops receiving again.

I think that this capture from Freemaster will illustrate the problem. The variables at the bottom are from one message, and the variable at the top is from another message. At the red segments the data from the message is frozen or latched, like no incoming messages were being processed. At blue segments the data is received and processed correctly.

Captura.PNG

There are other times where the messages are received during more time, as in this picture, but the norm is that data keeps unprocessed.

Captura1.PNG

There are some messages that always are sent, and others that are not. I don't know what is causing this problem, but it looks like some blocks are not being executed when they should.

I am not very familiar with Simulink settings. I have tried setting RX subsystems as atomic (maybe pointless) but the problem persists. The same board developed in C (different code but same CAN buses and similar messages) is working perfectly.

I can ensure that other ECUs are sending the correct messages with the correct data as I have checked it with both CANalyzer and Busmaster tools.

BR

0 项奖励
回复
3 回复数

552 次查看
MaMM
Contributor III

Hi Asier.

Before checking the microcontroller's programming, also make sure to verify the load on the BUSCAN you have, as well as the priority of the messages. That is, with an overloaded bus or messages with very low priority, it may happen that the CAN message sender makes multiple attempts, but due to having an ID with low priority, it does not get transmitted on the bus, resulting in the ECU not reading it (not because the processor isn't reading it, but because it isn't present). Perhaps this isn't the issue, and you've already checked it, but just in case it helps.

 

0 项奖励
回复

549 次查看
AsierMaser
Contributor II

Hello MaMM,

Thanks for the reply. Indeed, I checked the bus load and it was less than 10%. Also, the priority of the messages does not seem to be the problem as I am receiving messages with high ID and not receiving messages with lower IDs. 

BR

0 项奖励
回复

514 次查看
AsierMaser
Contributor II

I update with some new info. I have checked the one of the CAN buses and compared the expected number of messages to be received with the actual number.

We have 20 messages on this bus with periodicity from 50ms to 1000ms. There are also two remote messages. But in the model at this time we are only using information from 8 messages. So, even if the interruption block is being triggered on every message received, the other 12 messages are reduced by optimization.

This is the periodicity of the messages:

  • 5 messages every 50ms.
  • 2 messages every 100ms.
  • 1 message every 1000ms.

So this give us that we should receive 121 new messages every second. The number of interruptions should be higher since there are another 12 messages on the bus triggering the interruption, but no logic is being executed at this moment.

I have placed a counter on every message subsystem and the number of times each subsystem is executed is less than it should be. For example, messages with 50ms period should be executed 20 times per second but it is not happening. Here is a picture with the number of executions per message.

 
 

Captura.PNG

As you can see there are messages with even 0 executions per second, which often increases to 2~3 to then decreases again to 0.

I hope this helps to clarify what the problem might be.

BR

0 项奖励
回复