Frames lost in reception for S32K14 board

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

Frames lost in reception for S32K14 board

2,273 Views
juliana_rojas30
Contributor III

Hi everybody,

I am currently working with a S32K144 board, with the MBD Toolbox and I am having an issue in the CAN transmission of my code. I am currently testing with a simple model in which it receives a CAN message and transmits it as it is. It works while it has a lot of time for the tranmission (1000 ms), but when it comes to a fastest test (5 ms for example) it stops transmitting what it receives. I think that maybe it could be that is a message is lost and it makes the rest of messages to wait for it and anything gets transmitted anymore, but I am not sure. How can I get for all the messages to get transmitted?

Thanks in advance.

Kind regards,

Juliana

10 Replies

1,988 Views
juliana_rojas30
Contributor III

Sure, here it is!

Kind regards,

Juliana

1,988 Views
constantinrazva
NXP Employee
NXP Employee

Hello juliana.rojas3062@ctag.com ,

Thanks for the model - I'll take a look and come back with what I find.

Now regarding the RX FIFO, let me briefly walk you through:

The RX FIFO is a queue that holds up to 6 messages; this is helpful if you get them in a very fast succession. When you are enabling the RX FIFO you must be careful not to use certain MBs, as they will be reserved for this functionality. If I remember correctly, MB 0 through 5 are used + additional MBs used for ID Filtering table. The exact number of additional ones will depend on what type of filtering and what filter table you are using. To configure RX FIFO, you'll need to set-up 2 things: the ID format and the filter table. The ID format is telling you how many IDs you'll put per ID Filter table element (those that occupy additional MBs when using RX FIFO)

Format A: One full ID (standard and extended) per ID Filter Table element.

Format B: Two full standard IDs or two partial 14-bit (standard and extended) IDs per ID Filter Table element.

Format C: Four partial 8-bit Standard IDs per ID Filter Table element.

Format D: All frames rejected.

So if you are using format A for example and you are putting 2 IDs in the filter table, you'll be occupying 2 ID FIlter table elements -- this means (if I remember correctly) 2 MBs -- to be sure we should check the S32K Reference Manual.

This works like this: the CPU is repeatedly reading a message buffer structure at the output of the FIFO, so it can read the messages sequentially, in the order they were received.

Kind regards,

Razvan.

1,988 Views
juliana_rojas30
Contributor III

Helloconstantinrazvan.chivu!

 

In my case where I need to let all the IDs in,how can I configure the filter for this function? I can't put all the range of IDs, so I don't know how to do it.

Kind regards,

Juliana

0 Kudos

1,987 Views
constantinrazva
NXP Employee
NXP Employee

Hello juliana.rojas3062@ctag.com ,

I have attached here an examples of what you are aiming for - you should add another CAN configuration block if you need to have separate instances for RX/TX. Here I just used one for both operations.

Kind regards,

Razvan.

0 Kudos

1,987 Views
constantinrazva
NXP Employee
NXP Employee

Hello juliana.rojas3062@ctag.com ,

The issue was that even though RX ISR was working, when the TX block was executed, sometimes the trigger would come before the TX was completed; in this case, the 2nd operation would be aborted, and it would keep it that way for the rest of the run time. I switched to blocking mode for TX to get past this issue. Let me know if this gets you to the bus load you need.

Kind regards,

Razvan.

1,986 Views
juliana_rojas30
Contributor III

Hello constantinrazvan.chivu,

Yes, it actually helped me get to the load I needed. Thanks a lot! 

Now when I put my sending block is showing me an error that says: "Simulink Coder Error: The specified port index 'Number' of <S2>/FCAN_Send1 should be a number between 0 and -1"

Do you know what might be causing this? I tried online but I didn't have any luck finding references for this.

Thanks again!

Kind regards,

Juliana

0 Kudos

1,986 Views
constantinrazva
NXP Employee
NXP Employee

Hello juliana.rojas3062@ctag.com ,

This is an issue regarding your custom block -- take a look at the c file associated with it and make sure the mex is in the path.

Kind regards,

Razvan.

0 Kudos

1,987 Views
constantinrazva
NXP Employee
NXP Employee

Hello juliana.rojas3062@ctag.com ,

Can you answer a few questions so I get a better understanding of what is happening?

What type of transfer are you making - blocking or non-blocking? And do you know if the application is still working (you can do this by either by entering in debugging mode or by blinking an LED).

Kind regards,

Razvan.

0 Kudos

1,987 Views
juliana_rojas30
Contributor III

Hi constantinrazvan.chivu,

Sure, no problem. 

It is non-blocking. It is working but only if I send just one message or if I send a frame at a 100ms rate for example. At the point where I low the speed (5ms with 3 ID's) it stops working. The transmission from Bus Master keeps being received at the board, the problem is, I can't see the messages back at BusMaster. 

Kind regards,

Juliana

1,987 Views
constantinrazva
NXP Employee
NXP Employee

Hello juliana.rojas3062@ctag.com ,

Maybe we can profile the time it takes when the main loop is at a higher period (100ms for example) so we know the time it takes for it to complete. We can have a better understanding on what is going on when you get to higher frequencies for the main loop. If that's not it, I can suspect an issue with interleaving interrupts maybe.

Can you share your model so I can take a look?

Kind regards,

Razvan.

0 Kudos