How to config FlexCAN when the MBs is smaller than the number of CAN messages

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

How to config FlexCAN when the MBs is smaller than the number of CAN messages

2,535 Views
Smin
Contributor II

Hello NXP,

 

My situation is similar to this user's one - Solved: What if the CAN message buffer is less than the tx... - NXP Community

I'm working on SPC5746B series.
And it handles the CANFD messages of 11 Tx and 53 Rx CAN mesages.
The CAN messages have various DLC (16/24/32 byte).
The CAN payload is 32 bytes.

In this situation,  the FlexCAN of SPC5746 has a Message Buffer limitation as 36 with 32-byte-payload.
So, It can not match all the each CANID into the one buffer.

At the old ticket Solved: What if the CAN message buffer is less than the tx... - NXP Community, Alexandrunan explained about using more FlexCAN interface to solve this kind of problem.

With MPC5xxx, is it possible to use several FlexCAN interface to have more message buffer?
if possible, how should I config the MCAL?

Please give me a guide for this.

 

Thank you for your help in advance!!!

0 Kudos
Reply
11 Replies

2,455 Views
CongDang
NXP Employee
NXP Employee

With MPC5xxx, is it possible to use several FlexCAN interface to have more message buffer?

Because MPC5xxx have many Products/Derivatives. So I don't know exactly what Products/Derivatives you use. But as long as your hardware supports more than one FlexCAN interface, you able to use the solution.

For example: The FlexCAN of SPC5746 has a Message Buffer limitation as 36 with 32-byte-payload. Then if you want to handles the CANFD messages of 11 Tx and 53 Rx CAN messages, you need at least 2 FlexCAN interface.

If possible, how should I config the MCAL?

I think User Manual of CAN driver can help on this case. You can find the document in doc folder in plugin of CAN driver

0 Kudos
Reply

2,422 Views
Smin
Contributor II

In my case, I use MPC5746B. That has 6 FlexCAN interfaces. So I think I can bind two CAN interfaces for handling over 64 messages.

My plan is to use only one external CAN transceiver. And the Rx pins of two FlexCAN are connected together with CAN transceiver's Rx pin.

I will use FlexCAN1 and FlexCAN4. It have common pin for Rx like PC[3], PC[11], PF[15] and PJ[13].

Smin_0-1692593096528.png


Is it possible to config FlexCAN_1 and FlexCAN_4 use PC[3] together?
Is there any worries about this?

0 Kudos
Reply

2,412 Views
CongDang
NXP Employee
NXP Employee

No, it's impossible. PC[3] is configured on Dio/Port driver. A pin should only configure on a single mode. There will be no way to configure the pin for both FlexCAN_1 and FlexCAN_4

 

0 Kudos
Reply

2,399 Views
Smin
Contributor II

Thank you, @CongDang 

You mean that ...
SIUL MSCR#35 selects the pin function among FlexCAN1 and FlexCAN4. MSCR can not select both pins simultaneously.

Q1. Then, to use both FlexCAN1 and FlexCAN4, I should config two pins for each FlexCAN. right?

 

Q2. Is there any limitation to using several FlexCAN Rx pins on ONE CAN transceiver?

I just want to add more FlexCAN Rx ports on the previous Rx port as below.

 

Smin_0-1692611672804.png

Q3. Is it possible to use only RX port of FlexCAN? or have to use Rx and Tx together?

0 Kudos
Reply

2,366 Views
CongDang
NXP Employee
NXP Employee

Q1. Yes.

Q2. Usually each CAN controller corresponds to one CAN transceiver. I haven't tried a connection like you describe but I think it might work. In this case FlexCAN4 behaves the same as in Listen Only Mode.

I'm understanding that with this idea you want to configure 11 MBs on FlexCAN1 for Tx and use the remaining MBs on FlexCAN1 and FlexCAN4 for 53 Rx CAN messages. But the connection doesn't help in this case. Because, FlexCAN4 cannot work independently in this case, it can only receive messages that are also received by FlexCAN1

I recommend connecting normally where both FlexCAN1 and FlexCAN4 are on the bus. Then you can just use FlexCAN1 for 11 Tx CAN messages, and use both FlexCAN1 and FlexCAN4 for 53 Rx CAN messages (e.g. FlexCAN1 will receive some CAN messages ID and FlexCAN4 will take care of the rest)

Q3. The answer is already in Q2

0 Kudos
Reply

2,356 Views
Smin
Contributor II

Thank you @CongDang so much for your help!!!

Sorry but I can't understand fully about your these mentions.

Because, FlexCAN4 cannot work independently in this case, it can only receive messages that are also received by FlexCAN1

I recommend connecting normally where both FlexCAN1 and FlexCAN4 are on the bus.

Q1. why FlexCAN4 can not receive the other message?  Does FlexCAN1 config the transceiver?
I think that CAN transceiver send all the messages to the MCU, and each FlexCAN1/4 filters that message into its buffer.

Q2. Does the 'connecting normally' means adding the CAN transceiver for FlexCAN4? = each FlexCAN has its dedicated CAN transceiver?

Q3. According to the @PetrS reply on S32K COMBINING CAN MODULE INTO ONE - NXP Community,
it is common for two CAN modules to be connected to the same transceiver.
His answer looks like a conflict with yours.
Should I need the dedicated CAN transceiver for each CAN module?

 

0 Kudos
Reply

2,296 Views
CongDang
NXP Employee
NXP Employee

Q1. Below is full description for LOM mode:

Listen-Only Mode
This bit configures FlexCAN to operate in Listen-Only mode. In this mode, transmission is disabled, all error counters described in the ECR register are frozen, and the module operates in a CAN Error Passive mode. Only messages acknowledged by another CAN station will be received. If FlexCAN detects a message that has not been acknowledged, it will flag a BIT0 error without changing the receive error counter (ECR[RXERRCNT]), as if it was trying to acknowledge the message.
Listen-Only mode is acknowledged by the state of ESR1[FLTCONF] indicating Passive Error. There can be some delay between the Listen-Only mode request and acknowledge.
This bit can be written in Freeze mode only because it is blocked by hardware in other modes.
0b - Listen-Only mode is deactivated.
1b - FlexCAN module operates in Listen-Only mode.

 

In your setup, FlexCAN4  should be in LOM. That's why I said FlexCAN4 cannot work independently in this case, it can only receive messages that are also received by FlexCAN1. Then an incoming frame will be received by both FlexCAN1 and FlexCAN4 (meaning one MB per CAN controller => don't help extend MBs).

 

Q2. Yes, but note that this idea only works with my hypothesis - "Then you can just use FlexCAN1 for 11 Tx CAN messages, and use both FlexCAN1 and FlexCAN4 for 53 Rx CAN messages (e.g. FlexCAN1 will receive some CAN messages ID and FlexCAN4 will take care of the rest)". To be honest, I have no idea if your scenario is 53 Rx CAN messages with same message ID.

Q3. I'll try to clarify more on this thread to see if I'm missing something

0 Kudos
Reply

2,236 Views
Smin
Contributor II

Hello @CongDang

Is there any update on the CAN transceiver connection with multiple FlexCAN Rx pins?

 

I tested my idea - 2 FlexCAN Rx pins on 1 Rx pin of the CAN transceiver. and it can get the messages and looks working well.

I want to check whether this concept is correct or not.  

0 Kudos
Reply

2,224 Views
CongDang
NXP Employee
NXP Employee

Hi 

I add a comment on the S32K COMBINING CAN MODULE INTO ONE - NXP Community.

But no response yet.

Your setup should work but I mean (from my point of view) I don't see the benefit of extending number of MBs with the setup.

Did you test with FlexCAN4 in LOM mode?

Can you provide the results of your observed received frames on FlexCAN1 and FlexCAN4 in the following cases:

1. The incoming frame satisfies the filter on both FlexCAN1 and FlexCAN4.

2. The incoming frame satisfies the filter on FlexCAN1 only.

3. The incoming frame satisfies the filter on FlexCAN4 only.

0 Kudos
Reply

2,130 Views
Smin
Contributor II

Hi @CongDang ,

@PetrS didn't reply on the S32K thread yet. T-T

Anyway,  let me share my config and the test result.

I added 2 port more for FlexCANs and assigned 2 CanController. The new CanControllers are set as LOM.

Smin_0-1693881754835.png  Smin_1-1693881777402.png

At the CanHardwareObject in MCAL,  I assigned a different controller to each message buffer.

Smin_2-1693881861752.png

 

I tuned my generated AUTOSAR code to handle new FlexCAN without CanSM and ComNM and it works.

By selecting a different Can Controller Reference on each MB, each FlexCAN module receives separate unique CANIDs.

e.g. CAN1 receives 0x100, and CAN2 receives 0x200. And it works well.

 

 

I just triggered this thread to check my configuration is the correct way for this concept.
This concept is confirmed by many other engineers like @PetrS

 

 

0 Kudos
Reply

2,051 Views
CongDang
NXP Employee
NXP Employee

With the EBtresos configuration that you show, are you using the below setup (I'm not able to insert pictures in comment so I'll describe

- both TX, RX of CanController_1 is connected to CAN Transceiver

- RX of CanController_2 is connected to CAN Transceiver (same with RX of CanController_1), TX of CanController_2 is not connected

- Config HOH for receiving on CanController_1 with id=0x100

- Config HOH for receiving on CanController_2 with id=0x200

And the both HOH work well?

I find it a bit strange because as far as I know If CanCotroller is in LOM, it can only receive messages that are also received by another CanCotroller that is not in LOM.

0 Kudos
Reply