Questions about sending and receiving multiple CAN messages

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

Questions about sending and receiving multiple CAN messages

1,254 Views
kkawai
Contributor I

Hello,

I am working with a TWR-KE18F using a modified sample model. I can send and receive 1 packet of data on the CAN bus, however I am having difficulty reading and sending multiple CAN packet from the bus. I have attached the modified sample model below. Please let me know if you have any suggestions. I would appreciate it if you could tell me the specific operation procedure.

Thank you in advance.

pic.jpg

Tags (2)
0 Kudos
Reply
5 Replies

1,074 Views
kkawai
Contributor I

Dear Alexis Andalon san,

Thank you for your advice.

I utilized the following functionyou recommended. However, the modified model stops harfway and does not output CAN normally.

I have attached the modified model below. If possible, please let me know any suggestions.

FLEXCAN_SetRxMbConfig(EXAMPLE_CAN, RX_MESSAGE_BUFFER_NUM, &mbConfig, true);

FLEXCAN_SetRxMbConfig(EXAMPLE_CAN2, RX_MESSAGE_BUFFER_NUM2, &mbConfig2, true);

Best regards,

Kazunori Kawai

pcan-view2.gif

pcan-view1.gif

0 Kudos
Reply

1,074 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Dear Kazunori,

 

I have some recommendations about your code.

 

If you're using only one CAN bus you should wait until a transfer is made to do the next one, if this is not this way the second transition will be omitted.

 

Also you should only have one global mask definition, if you have two, you'll only have the second. The mask is an AND logic with the ID so if you put 0x127 in it should do the work.

 

Also the RX/TX_MESSAGE_BUFFER_NUM should be different for each mailbox, if you don't change it you will overwrite the configurations.

 

Let me know if this helps you.

 

Best Regards,

Alexis Andalon

0 Kudos
Reply

1,074 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Dear kkawai@hhq.suzuki.co.jp‌,

Let me know if I understand correctly, the first message you send with CAN-ID 0x39C and the one with 0x3AC were send correctly, but in the reception you send more than one message to the MCU and this only receive one message. Am I right?

Best Regards,

Alexis Andalon

0 Kudos
Reply

1,074 Views
kkawai
Contributor I

Dear Alexis Andalon san,

Thank you for your response.

I will explain current situation. The model I sent receives 0x39C and sends it at 0x123. This confirmed that it was working properly. I want to add one new data to this model, but it is not successful. (For example, reception 0x3A0, transmission 0x124)
If possible, I would like to receive advice on how to change the model.

Best Regards,

Kazunori Kawai

0 Kudos
Reply

1,074 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Kazunori, 

You have two options for this, you can enable another mailboxes to receive more than one kind of ID. Or also you could enable the FIFO and set the filter to let pass more than one ID. For example, in the SDK for each mailbox the function use to configure it is the next one:

FLEXCAN_SetRxMbConfig(EXAMPLE_CAN, RX_MESSAGE_BUFFER_NUM, &mbConfig, true);

Let me know if this helps you.

Best Regards,

Alexis Andalon

0 Kudos
Reply