Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 5 months ago.
Change canbus CANMessage format?
I want to use an extetended id mode in the can, how can I chenge it?
Question relating to:
1 Answer
10 years, 5 months ago.
Hi Andrea,
This capability is there, but perhaps not so obvious in how it is documented. I'm sure you looked at the CANMessage API and saw the "CANFormat _format=CANStandard". So, if not specified, it will always choose the 11-bit identifier format. The challenge with the APIs is to find out what the other possibilities are.
Suggestion to mbed team - improve the docs to make it easier to find this"
I know from experience that CANExtended can be used there, to select the 29-bit identifier. But as I try to find that documentation (other than in my own code), I cannot easily do so. Only by a long search did I arrive at the source code for CAN.h. The answer was not there, but by following the include file to can_api.h I found - nothing, but another include to can_helper.h. In can_helper.h, you can find this:
enum CANFormat { CANStandard = 0, CANExtended = 1, CANAny = 2 }; typedef enum CANFormat CANFormat; enum CANType { CANData = 0, CANRemote = 1 }; typedef enum CANType CANType;