Hello,
i have build a project which has a CAN Communication.
I control this with CANoe and it works fine. But when I stop the CANoe simulation and restart it, the Evalboard don't send or recieve messages anymore. I have to reset it by shut off the supply voltage.
Maybe there is an Error or something because there is no BUS client anymore?! How can I reset it or deactivate it?
Thanks and Greetings,
Felix
Has anyone found a solution to this problem? I faced the same problem.
Hi,
yes.
The solution was to only send the next Message when the previous is recieved.
So I put my CAN Sender block into an enabled subsystem. This only is enabled when the transfer status is not busy. Like this:
The trigger I use for the time frame in which the message should be sended.
Greetings,
Felix
Hi,
I have the same problem with MCAN blocks and I tried the structure you suggested, but I couldn't get any results.
Gentlemen,
I am not an expert in CAN, so I will ask one of my colleagues to respond to your question.
However, the C code is generated on top of the S32K SDK for Arm. Currently, I don't see any API function that resets the CAN module.
A starting point will be to use the FLEXCAN_DRV_GetErrorStatus driver function, which returns the ESR1 register value. By having a look at this register, you can know in your code, when the Bus becomes IDLE. We don't have a block for that, but you can declare a Data Store Memory of uint32 and insert a custom code, to periodically call this function.
The only idea I have right now is to try to deinit and reinit the CAN module when the bus becomes IDE. I don't know if this is the right way, and I think there should be a more elegant way of solving this scenario. I will ask other engineers and we will reply here.
Regards,
Marius
Hello @mariuslucianand I tried running the flexcan_master_xfer_status_s32k11x.zip code it works perfectly fine when I run this code, but when I import the same data store memory block and system output block with the custom code given here in some other CAN program it doesn't work. Am I missing something here or are there any additional Simulink settings that needs to done?
Hello @felix_boeckmann, @miguelallende,
Let's try a workaround to see if on your side this fixes the problem and you can continue the CAN communication after the CAN bus is reconnected.
So, we will insert a custom code that will return the ESR1 status register. If there is an TX Error we will abort the current transfer.
CAN_Status = FLEXCAN_DRV_GetErrorStatus(CAN_INSTANCE) ;
if (CAN_Status & (1 << 9))
{
FLEXCAN_DRV_AbortTransfer(CAN_INSTANCE, MSG_BUFFER);
}
In the custom code you have to Change the CAN_INSTANCE with the instance that you are using (simply 0 or 1) and the MSG_BUFFER with the buffer that you are using (e.g. 15).
I have attached an example. Is for S32K116 but the same C code should work for your S32K144.
Let's give this a try.
Hope this helps,
Marius
Hi Felix.
I have the same problem reported days ago.
Let's see if NXP give us a solution.
BR,
Miguel.
I am also encountering this issue. Don't know why its happening!!
The rules for increasing and decreasing the error counters are somewhat complex, but the principle is simple: transmit errors give 8 error points, and receive errors give 1 error point. Correctly transmitted and/or received messages causes the counter(s) to decrease.
Example (slightly simplified): Let’s assume that node A on a bus has a bad day. Whenever A tries to transmit a message, it fails (for whatever reason). Each time this happens, it increases its Transmit Error Counter by 8 and transmits an Active Error Flag. Then it will attempt to retransmit the message and the same thing happens.