CAN : Sending multiple 8 byte over one message ID

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN : Sending multiple 8 byte over one message ID

340 Views
sushma
Contributor III

Hello,

I'm using flexcan at 500Kbps .Is it possible to send different 8 bytes value(assigned to different message buffer box) with same CAN ID?

  uint8_t BmsStatus1[8] = {88,12,34,45,66,97,54,43};

  uint8_t BmsStatus11[8] = {0,2,3,4,5,6,7,0};

FLEXCAN_DRV_ConfigTxMb(INST_CANCOM1,MB,&dataInfo,MSG_ID);
FLEXCAN_DRV_ConfigTxMb(INST_CANCOM1,MB9,&dataInfo,MSG_ID);

FLEXCAN_DRV_Send(INST_CANCOM1, MB9, &dataInfo1, MSG_ID, &BmsStatus10); 
FLEXCAN_DRV_Send(INST_CANCOM1, MB, &dataInfo, MSG_ID, &BmsStatus1);

With this functions in code; I'm able to receive only BmsStatus1. How to get multiple 8 byte value for single message ID over multiple transmission?

Both Rx and Tx code are attached. 

0 Kudos
4 Replies

128 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I tried your TX code - left only very first row in ISR handler - and there is no issue. I can get both messages:

void LPIT_ISR (void)
{
status_t st=0;
LPIT_DRV_ClearInterruptFlagTimerChannels(INST_LPIT1,(1<<0));
st=FLEXCAN_DRV_Send(INST_CANCOM1, MB9, &dataInfo1, MSG_ID, (uint8_t *)&BmsStatus10); //632
st=FLEXCAN_DRV_Send(INST_CANCOM1, MB, &dataInfo, MSG_ID, (uint8_t *)&BmsStatus1); //632

}

pastedImage_1.png

Here is full output:

pastedImage_3.png

With the only two messages - there is no issue - but - you can't rely on this.

pastedImage_4.png

To be sure that transmitted message from MB9 ends in MB9 on receiver - you need to specify ID. With the same ID - the message can end in MB0 or MB9 - depends on traffic - if I understand it correctly. Anyway - what is your use case to have the same ID for different messages? 

Jiri 

128 Views
sushma
Contributor III

Hello Jiri,

This means that my code is working fine, but I'm not able to see it on my console(along with all my other message with different IDs). This would be solved by using CAN analyzer, right?

Thank you,

Sushma 

0 Kudos

128 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

actually - your code as it is is not working okay. the The very first MB data are rewritten by MB9, and MB9 is empty - because of the same Message ID. Here is output from unmodified code:

s32ds_2019-02-12_14-55-01.png

With two messages only it is working... somehow. But as I mentioned above - to be sure that you get all messages in proper MB - you need to specify unique ID for each message. 

Jiri 

128 Views
sushma
Contributor III

Hello Jiri

That's weird, I have a requirement of sending more than 8 bytes over 1 ID, hence I thought of using 2 MBs (CAN FD is not an option; I have to use CAN 2.0b for my requirement). Any other ways to send more than 8 bytes over CAN 2.0b without creating confusion/ traffic among the different MBs used?

Thank you,

Sushma

0 Kudos