Identifying Steering Wheel Button Packets - An Example
  • 0
  • <b>Am I sending correct CAN packets?</b>
    I am making some modest progress. Because I couldn't get the serial filter command to work I have changed the JSON output code in SerialCommand.h so it shows Message ID and payload of only one particular message ID. A very basic filter. By trial and error, I found the messages of events that occur when for instance the mirrors are folded, the doors are locked, the windows go up/down and the fan (up/down). Finally some meaning in all that data :-)
    On to the next challenge, send some CAN packets to make something happen. No successful attempts so far. Hopefully someone can see what is going wrong. For example, when I fold the mirrors I see these messages:
    "id":"50","payload":["0","5B","40","5","D9","3","4","0"] - folding
    "id":"50","payload":["0","5B","40","5","89","3","4","0"] - finished
    "id":"50","payload":["0","5B","40","5","E9","3","4","0"] - unfolding
    "id":"50","payload":["0","5B","40","5","89","3","4","0"] - finished
    Logging in HEX looks like this:
    00 50 00 5B 40 05 89 03 04 00 08
    00 50 00 5B 40 05 D9 03 04 00 08
    00 50 00 5B 40 05 E9 03 04 00 08
    So, I was hoping I could trigger the 'folding/unfolding mirrors " action by sending the following packets:
    02010050005B4005D903040008
    02010050005B4005E903040008
    I thought:
    0201 = send on bus 1, 0050 = message id, 005B4005D9030400=payload, 08 = length
    But nothing happens. I tried the windows and door lock commands too but no luck. I think I have to recycle the CBT after each failure to try again, so that's what I do...
    <b>Another question:</b> in CoolTerm you can set the Transmit option "Terminate send string data" with 0D 0A, should this setting be active? I tried it with and without but it didn't make a difference.

  • 0
  • <b>Two things made it easier for me to identify messages:</b>

    1. Change the code so you get JSON output (remove comment "//" before the #define JSON_OUT in SerialCommand.h as mentioned serveral places on the forum).
    2. I altered the JSON output code a bit so I could filter one single message ID , this way I could see if messages change when pressing buttons. It is not a big deal but it helped me a lot in finding out what is going on, this is what I changed:

    Original code:

    #ifdef JSON_OUT
    Output to serial as json string
    activeSerial->print(F("{"packet": {"status":""));
    activeSerial->print( msg.busStatus,HEX);
    activeSerial->print(F("","channel":""));
    activeSerial->print( busses[msg.busId-1].name );
    activeSerial->print(F("","length":""));
    activeSerial->print(msg.length,HEX);

    if (msg.frame_id==0x0078)
    {
    activeSerial->print(F(""id":""));
    activeSerial->print(msg.frame_id,HEX);
    activeSerial->print(F("","timestamp":""));
    activeSerial->print(millis(),DEC);
    activeSerial->print(F("","payload":[""));
    for (int i=0; i<8; i++) {
    activeSerial->print(msg.frame_data[i],HEX);
    if( i<7 ) activeSerial->print(F("",""));
    }
    activeSerial->print(F(""]"));
    activeSerial->println();
    }

    Changed code that replaces the above:

    #ifdef JSON_OUT

    if (msg.frame_id==0x0078) // <b>->change this message ID figure out if it changes when you press buttons in the car</b>
    {
    activeSerial->print(F(""id":""));
    activeSerial->print(msg.frame_id,HEX);
    activeSerial->print(F("","payload":[""));
    for (int i=0; i<8; i++) {
    activeSerial->print(msg.frame_data[i],HEX);
    if( i<7 ) activeSerial->print(F("",""));
    }
    activeSerial->print(F(""]"));
    activeSerial->println();
    }
    Disadvantage of this method is that you need to compile and upload the code for each message ID you want to test. It's a drag but it works.

  • 0
  • If I have specific message id's how can I look just that data up?

    0x01F0A000

    AEMnet Revision 2013-05-29
    CAN 2.0
    29 bit format unless otherwise specified
    500 kBit/sec unless otherwise specified
    8 data bytes/message
    All multi-byte data packed big endian unless specified (most significant byte transmitted first)
    All bits numbered with the LSB = bit0, MSB = bit7

    Message ID: 0x01F0A000
    Source: AEM V2 EMS/Infinity (P/N 30-6XXX/30-71XX)
    Target: Any
    Rate: 16.6ms continuous
    Byte Label Data Type Scaling Offset Range
    0 Engine Speed 16 bit unsigned 0.39063 rpm/bit 0 0 to 25,599.94
    1
    2 Engine Load* 16 bit unsigned 0.00261230481157781 5.48000026028603 0 to 99.998 %
    3
    4 Throttle 16 bit unsigned 0.0015259 %/bit 0 0 to 99.998 %
    5
    6 Air Temp 8 bit signed, 2's complement 1 Deg C/bit 0 -128 to 127 C
    7 Coolant Temp 8 bit signed, 2's complement 1 Deg C/bit 0 -128 to 127 C

    Log
    https://s3.amazonaws.com/uploads.hipchat.com/17476/678926/5yP6DoV7L8ua0ME/CoolTerm Capture 2015-04-04 15-04-13.txt

  • 0
  • Hi TheBoz, have you tried to change the code of SerialCommand.h the way I did? Have you downloaded the source from Github and done a compile & upload? Your logging looks like HEX data saved in ASCII format which is not readable, it's easier to save it in HEX format when you are logging HEX data. When you use JSON output it is better to save it in RAW format.
    Mind you, when Derek has finished the app filtering messages will be MUCH easier ;-)

  • 0
  • So this is what I am getting when running the JSON version. I still have no clue how to just look up a specific message id. When I filtered for "0x01F0A000", the result was nothing. it looks like there is data transmitting, I am just unsure what is what. Also after logging for about minutes, the only ID that was there was 7C, and status would flip from 3 to 2.

    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181919","payload":["0","0","48","40","0","22","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181923","payload":["19","EB","FA","EB","FA","EB","76","B0"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181927","payload":["FF","82","0","0","0","30","B8","AC"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181931","payload":["0","0","48","35","0","23","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181935","payload":["FF","82","0","0","0","30","B8","AC"]}}
    {"packet": {"status":"2","channel":"Bus 1","length":"8","id":"7C","timestamp":"181939","payload":["19","DC","FA","EB","FA","EB","76","B0"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181943","payload":["0","0","48","33","0","23","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181946","payload":["FF","82","0","0","0","30","B9","3"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181950","payload":["0","0","48","3A","0","23","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181954","payload":["FF","82","0","0","0","30","B9","3"]}}
    {"packet": {"status":"2","channel":"Bus 1","length":"8","id":"7C","timestamp":"181957","payload":["19","DC","FA","EB","FA","EB","76","B0"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181961","payload":["0","0","48","37","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181965","payload":["FF","82","0","0","0","30","B9","3"]}}
    {"packet": {"status":"2","channel":"Bus 1","length":"8","id":"7C","timestamp":"181969","payload":["19","DC","FA","EB","FA","EB","76","B0"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181974","payload":["0","0","48","37","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181977","payload":["FF","82","0","0","0","30","B9","3"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181981","payload":["0","0","48","36","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181985","payload":["FF","82","0","0","0","30","B9","3"]}}
    {"packet": {"status":"2","channel":"Bus 1","length":"8","id":"7C","timestamp":"181988","payload":["19","DC","FA","EB","FA","EB","76","B0"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181992","payload":["0","0","48","2C","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"181996","payload":["FF","82","0","0","0","30","B8","C2"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182000","payload":["0","0","48","35","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182003","payload":["FF","82","0","0","0","30","B8","C2"]}}
    {"packet": {"status":"2","channel":"Bus 1","length":"8","id":"7C","timestamp":"182007","payload":["19","EB","FA","EB","FA","EB","76","B0"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182011","payload":["0","0","48","34","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182016","payload":["FF","82","0","0","0","30","B8","C2"]}}
    {"packet": {"status":"2","channel":"Bus 1","length":"8","id":"7C","timestamp":"182019","payload":["19","DC","FA","EB","FA","EB","76","B0"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182023","payload":["0","0","48","3A","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182027","payload":["FF","82","0","0","0","30","B8","C2"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182031","payload":["0","0","48","3A","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182034","payload":["1A","78","FA","EB","FA","EB","3B","E6"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182038","payload":["FF","82","0","0","0","30","B8","C2"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182042","payload":["0","0","48","38","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182046","payload":["FF","82","0","0","0","30","B8","C2"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182049","payload":["0","0","48","2E","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182053","payload":["1A","69","FA","EB","FA","EB","3B","E6"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182057","payload":["FF","82","0","0","0","30","B9","5A"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182062","payload":["0","0","48","2E","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182065","payload":["FF","82","0","0","0","30","B9","5A"]}}
    {"packet": {"status":"2","channel":"Bus 1","length":"8","id":"7C","timestamp":"182069","payload":["19","CC","FA","CC","FA","DC","76","A1"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182073","payload":["0","0","48","2F","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182077","payload":["FF","82","0","0","0","30","B9","5A"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182080","payload":["0","0","48","2F","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182084","payload":["FF","82","0","0","0","30","B9","5A"]}}
    {"packet": {"status":"2","channel":"Bus 1","length":"8","id":"7C","timestamp":"182088","payload":["19","DC","FA","EB","FA","EB","76","B0"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182092","payload":["0","0","48","2F","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182095","payload":["FF","82","0","0","0","30","B9","5A"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182099","payload":["0","0","48","2F","0","24","18","19"]}}
    {"packet": {"status":"3","channel":"Bus 1","length":"8","id":"7C","timestamp":"182104","payload":["1A","78","FA","EB","FA","EB","3B","E6"]}}

  • 0
  • OK, first you log everything without a filter. What I did was:

    • I imported the JSON data into excel
    • I copied the column "id" and removed duplicates. Now you can see how many different message ID's you have
    • then I started to use the filter and to filter the message ID 7C in your case above, the code should be:
      if (msg.frame_id==0x007C) ...
    • For each ID I tried if I could detect changes when pressing buttons.
      Is this any help to you?

  • 0
  • I figured out my issue. The ecu I am using is not passing the message id info, and or it is defaulting to 7c. So the data is all over the map because I don't have any identifier to filter on. I am making some adjustments to the cipset lib to see if I can get some more details. So if anyone else runs into issues with an AEM Infinity, hit me up :).

    Also to rule out the CBT, I am currently running a Uno+CanBus shield. Which generates the exact same data :).

  • 0
  • administrators

    Good info! :D

    I'm busting my but on the app to help make this easier. The wireshark pipe is integrated into the app and working really well also!

  • 0
  • No worries. I have been doing software for 15 years. So I know it takes time. Just started playing with arduino stuff recently. I also do C#, so I have to pick up a little C and C++.

    Thanks for all the hard work.

  • 26
    Posts
  • 13771
    Views
  • Log in to reply