CAN Bus Handling in MBDT

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

CAN Bus Handling in MBDT

Jump to solution
783 Views
schourasiya
Contributor II

I’m using NXP’s MBDT for S32K344 for configuring FlexCAN0. I want to understand what part of CAN message handling is managed by the NXP blocks/toolbox and what needs to be handled by the application.

  • Are arbitration and buffer handling managed by the driver/toolbox? Example: If I send 0x18FEF111 first, then 0x18FEEF00 neither appears on the bus. But if 0x18FEEF00 is sent first, both are transmitted. When triggered together, only one appears.
  • So, do we need to assign dedicated Tx Hardware Objects to each message ID when sending multiple frames simultaneously?
  • Does the MBDT or SDK handle message prioritization and retries automatically if ACK is not received?
  • If a high-priority ID fails (e.g., no ACK), will it block other messages? How do we detect and recover from this?
  • Do we need to manage buffer allocation or transmission timing manually in the model to avoid blocking or message loss?
  • What’s the best way to configure multiple Tx message IDs in MBDT? With dynamic buffers.

Please clarify what is handled internally vs. what we must handle in the application.

Labels (1)
0 Kudos
Reply
1 Solution
702 Views
SorinIBancila
NXP Employee
NXP Employee

Hello,

 

How many messages do you think you need to transmit at one time?

 

I've tested on a S32K358 HVBMS reference design the following scenario:

  • Use a single TX Hardware Object and set the Can Hw Object Count to 32 (to allow a maximum of 32 messages in the buffer).
    SorinIBancila_0-1751890828580.png

     

  • In Simulink, I populated the message buffer with 32 messages, increasing the priority as it populates the buffer, to prove the arbitration process.SorinIBancila_3-1751891054922.png

     


     

The results:

As expected, the first messages sent are with low priority, as the message buffer is not completely populated. Around the 6th message, the buffer is populated and we can see that the messages with higher priority are sent first.

SorinIBancila_5-1751891107134.png

 

Since you want to use a single transceiver, it is not really possible to simultaneously send all the messages at the same time.

 

Best regards,

Sorin Bancila

 

 

 

View solution in original post

5 Replies
763 Views
SorinIBancila
NXP Employee
NXP Employee

Hello,

First of all, I want to point out that the MBDT for S32K3xx is build on top of the S32K3 RTD. The configuration of a peripheral is done in the S32 Configuration Tool to allow full flexibility on the settings you need. So basically, to check if a feature is supported by the NXP's MBDT S32K3xx, you can check the source code used by the peripheral (in the S32K3 RTD) and its available settings in the S32 Configuration Tool.

In the toolbox, you can find the implementation for the FlexCAN peripheral here: {toolboxRoot}/src/S32K3_RTD/SW32K3_S32M27x_RTD_R21-11_6.0.0/eclipse/plugins/Can_43_FLEXCAN_TS_T40D34M60I0R0/

Note! The name of the S32K3 RTD might differ, depending on which version of the MBDT S32K3 do you use.

 

The answers to your questions are based on my experience and they might not be totally accurate.

1 & 2 & 5: The toolbox does not handle any arbitration, but I am not sure what options are available in the SDK for this matter. In your example, you create another CanHardwareObject and use it to send the second message, but this approach might be difficult to manage. The second solution might be to increate the Can Hw Object Count to allow more messages in the buffer.

SorinIBancila_0-1751638634625.png

 

3: The MBDT for S32K3 does not handle any message prioritization. As far as I know, that's the job of the FlexCAN controller to retry to send the message until the ACK is received, while blocking the message the buffer.

 

4. One way to detect if a message is sent or not is to use interrupt CanIf_TxConfirmation in the Hardware Interrupt Callback to mark that a message is sent. If the interrupt is not triggered for the specified PDU, it means that the message is not sent. Moreover, there is another interrupt (CAN_ControllerBusOff) available that triggers when the conditions for CAN Bus Off are met. In the S32 Configuration Tool, there is an option to automatically recover from Bus Off.

SorinIBancila_1-1751640323228.png

 

If you have any questions, do not hesitate to reply.

Best regards, 

Sorin Bancila

 

 

728 Views
schourasiya
Contributor II
Hi Sorin,

Thanks for your input!
I wanted to clarify the best way to configure multiple Tx message IDs in MBDT when using dynamic buffers. In my case, the controller is being used for an EV application with a J1939-based CAN setup involving hundreds of cyclic messages.

Creating separate hardware objects for each message in S32CT doesn’t seem scalable or practical. I’m looking to use a single Tx Hardware Object to handle multiple messages dynamically and transmit them simultaneously over one CAN interface.

Could you please guide on the recommended setup or best practice for this use case? Also please do suggest the documentation I must refer in order to understand the working of config setting and involved Functions used in MBDT.
0 Kudos
Reply
703 Views
SorinIBancila
NXP Employee
NXP Employee

Hello,

 

How many messages do you think you need to transmit at one time?

 

I've tested on a S32K358 HVBMS reference design the following scenario:

  • Use a single TX Hardware Object and set the Can Hw Object Count to 32 (to allow a maximum of 32 messages in the buffer).
    SorinIBancila_0-1751890828580.png

     

  • In Simulink, I populated the message buffer with 32 messages, increasing the priority as it populates the buffer, to prove the arbitration process.SorinIBancila_3-1751891054922.png

     


     

The results:

As expected, the first messages sent are with low priority, as the message buffer is not completely populated. Around the 6th message, the buffer is populated and we can see that the messages with higher priority are sent first.

SorinIBancila_5-1751891107134.png

 

Since you want to use a single transceiver, it is not really possible to simultaneously send all the messages at the same time.

 

Best regards,

Sorin Bancila

 

 

 

687 Views
schourasiya
Contributor II
Understood! So If I need to transmit more than 32 messages, should I create additional Tx Hardware Objects? Also, what is the maximum number of Hardware Objects that can be configured under a single CAN transceiver or controller in S32K3 using S32CT?
Looking to understand the best way to structure HOHs for large message sets while staying within the limits.
0 Kudos
Reply
679 Views
SorinIBancila
NXP Employee
NXP Employee

Hello,

The 32 Can Hw Object Count is not the limit. You can increase the limit even further, depending on what MCU you have. You can modify the number of Can Hw Object Count and if you put a number too large, the S32CT is going to throw an error.

Best regards,

Sorin Bancila

0 Kudos
Reply