Hello aungkm@outlook.com,
I'll answer your questions, one by one:
Thank you for your support. I could receive the messages when I used different buffer with same mask, but I could only receive only one CAN message when I used the same buffer with a different mask.
Did you use 2 blocks setting up the same MB? That is what I understand, and that is not what I meant. I was trying to say to input a mask which will accept more IDs. Lets take the following example: set the mask to 0xFFFFF0FF, and the ID to 0xFE. This way, you can get the following range of IDs: [0x0FE; 0xFFE]. This is because 0x0FE & 0xFFFFF0FF will give the same result as 0xFFE & 0xFFFFF0FF (=0xFE, the ID you've set for the specified MB). This is just an example. You can narrow the mask to narrow the acceptance interval if you'd like.
Furthermore, when I replaced the old .tlc file with the one you provided, I keep receiving an error saying that the new .tlc could not be opened for reading. Is there any update I need to do before replacing the .tlc file?
There is nothing more to be done after replacing the tlc I've sent. This is a bit strange. Could you restart MATLAB or check if something is locking that file? Could you try restarting the computer if nothing else works?
Lastly, I am having trouble understanding the following message from your reply. Do you have some sort of example to show how it works?
" Using all of these, you can make a switch/case so you can order messages by MB index or actual ID. Usually, you'll configure a few MB to accept a small range of different IDs, all of which are forming some type of class (messages of same type, but from different parts in the system, messages of same importance, etc.). This is up to the user to decide the network topology. First you'll have a switch/case using the MB index - so you can quickly sort out from which 'class' the frame came from, and then, inside each such class, you can filter for ID."
I will leave you some pseudocode example to make my idea more clear.
So we have several outputs from the CAN ISR block, among which we have:
- MB index - the index of the MB that has triggered this ISR
- ID - the ID inside the CAN frame for this specific message (that triggered this ISR)
With this information, we can do the following:
switch(MB index):
case 1:
handle_mb1_messages
case 2:
handle_mb2_messages
[etc]
end
Keep in mind that for MB1 we have decided to accept more IDs (let's take for example [0x0FE; 0xFFE] as in the previous example. Lets say that we have important messages from safety components here (lower IDs have higher importance, lower MBs have higher importance).
And in the handle_mb1_message function we have:
handle_mb1_messages:
switch(ID):
case 0x0FE:
/* got safety message 1; react */
case 0x4FE:
/* got safety message 2; react */
end
end
This is another approach to only having 1 big switch(ID), without looking at the MB index, which would look like this:
switch(ID):
case 0x0FE:
[..]
case 0x4FE:
[..]
case 0xF3F4:
/* code that would otherwise be ran only on handle_mb2_messages() */
case 0xF4F4:
/* code that would otherwise be ran only on handle_mb3_message() */
[etc]
end
Please let me know if things are more clear now.
Kind regards,
Razvan.