0
\$\begingroup\$

I have two CAN nodes. For example, one node will transmit temperature and the other node will receive the temperature data.

We know that CAN protocol uses message identifiers (IDs). So what happens is that the receiver node will ask for data with a id of 500. The transmission node reads the request and writes the data with an ID of 3.

Can I remove the continuous checking of requests in my code for the first node and instead write the data to the second node?

\$\endgroup\$
0
2
\$\begingroup\$

CAN messages always contain either a 11 or 29 bit ID. How you use that ID, if at all, is up to you.

If you only have two nodes, and one of them only ever sends one message, then the other node could ignore the received ID entirely and just process the message according to the one and only format it can be. However, this is really bad, I'd say downright irresponsible, system architecture. It would be much better to look at the ID and discard messages that don't have the expected ID. This is a very easy thing to do, so there really isn't any excuse for not doing it.

A node that responds to a remote request for ID 500 by sending a message with ID 3 is either broken or also irresponsibly designed. I can't imagine any commercial product doing this. It might be a good idea for the requesting node to send requests for both 500 and 3 just in case, and be prepared to handle responses with either ID. Maybe someday the stupidly designed node will be fixed or upgraded. If the requester at least follows the rules, then there is less chance of a problem later.

However, I'd seriously consider finding a alternative for a node that responds with 3 to a request for 500. Something that irresponsibly designed most likely has other problems. Run away.

\$\endgroup\$
2
  • \$\begingroup\$ Appreciate your answer sir.I posted a question about the CAN project in this forum but it didn't get answered.I would request to please read the post titled 'CAN transmission not working '.The first node isn't transmitting data. \$\endgroup\$
    – Ammar
    Jan 1 '17 at 15:08
  • \$\begingroup\$ I doubt OP is using RTR frame \$\endgroup\$
    – Swanand
    Jan 5 '17 at 8:41
1
\$\begingroup\$

What I understood from your question is you have two message IDs

  1. Message ID 500 - Request for temparature data
  2. Message ID 3 - Temparature data

And I believe you are not using RTR (Remote Transmit Request) frame in message ID 500.

You can use only one message ID 3. Requestor can request for data with RTR bit set and Node with the sensor should respond. It would be better if one node periodically sends data over CAN. That is typical on CAN Bus that node periodically broadcasting it's data. In that way, Requestor may not need to send the requests. It will have data periodically. And If it needs, then it can always send an RTR frame.

In the receiver node, you can set message ID filters (Acceptance filters) so that only required messages will generate interrupt and not all.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.