A problem about send multiple can messages

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

A problem about send multiple can messages

1,107 次查看
wbj5238
Contributor III

      I  want use Can1 to send multiple can messages and Can0 to receive multiple Can messages. But  I can only receive one  message. I observed that MB index is always 1, so I think it can only send one messages. Attached is the Simulink model by MATLAB2019A. 

      Please give me an example to implement this function.

  Look forward to your solution ,thank you very much!

0 项奖励
回复
1 回复

1,036 次查看
constantinrazva
NXP Employee
NXP Employee

Hello wbj5238@163.com ,

Yes, you can send multiple messages on CAN (also true for receiving).

I saw that you use in your model MB1 and MB2 for sending the 2 messages over CAN1. If you take a look at the generated code, you'll find the following lines:

FLEXCAN_DRV_ConfigTxMb(1, 2, &txInfo, 0x3FA);

FLEXCAN_DRV_Send(1, 2, &txInfo, 0x3FA, data);

[...]

FLEXCAN_DRV_Send(1, 1, &txInfo, 0x3FF, data);

These lines set-up the transmission of 2 separate messages, one on MB1 (with ID 0x3FF) and one on MB2 (with ID 0x3FA).

Kind regards,

Razvan.

0 项奖励
回复