Dash2 Serial Datastream questions

DetroitAristo
Posts: 22
Joined: Sat Jan 07, 2017 1:55 am

Dash2 Serial Datastream questions

Postby DetroitAristo » Tue Jan 24, 2017 5:37 am

Hello.

I have a Dash2 and my intention is to use a microprocessor rather than the CAN Adapter (If I can't get the adapter working properly).

I am setting up the serial datastream to the Dash2, and the documentation is somewhat lacking.

This is a U-S legal vehicle, so I will need the odometer functional. I would like to use as few as possible analog inputs.

I would like to use the Serial stream for as much data as possible as I have a standalone ECU that provides most data I require. Things like Turn Signals, high beams, warning lights, and battery are connected properly (analog).

I have been scouring the serial stream information and I actually have the RPM and Speedometer working somewhat. My question is in regards to the f(x) when it comes to speed calculation.

I understand that ID 11 is for GPS speed. I will not be using a GPS. I am using the driven wheelspeed from the CAN datastream (It reads from the speed sensor in the transmission). ID11 is such that:

Code: Select all

Speed (m/s) = (Data1 * 2^24 + Data2 * 2^16 + Data3 * 2^8 + Data4)* 0.01
SpeedAcc (m/s) =( Data6 * 2^16 + Data7 * 2^8 + Data8)* 0.01

Data source = Data5
0 = raw GPS data
1 = non GPS speed


This being said, I have 8 unsigned bits, so a value of 0 to 256. I am trying to take that integer and convert it into a Race-Technologies-compatible serial stream.

Are those karats meant to be pow() operators? That is, would a packet of 0xB 0x01 0x00 0x00 0x00 0x01 0x00 0x00 0x0D output a speed of 167772.16 m/sec?

There used to be some sample code on the site somewhere (I've read mention of it), but I cannot find it anywhere.

Is there another VAR that I can use that will allow for an accurate odometer?

Support
Posts: 399
Joined: Mon Nov 21, 2005 4:09 pm

Re: Dash2 Serial Datastream questions

Postby Support » Thu Jan 26, 2017 9:05 am

There was some sample code but that was to decode the datastream, not to encode it. You are correct about the scaling of the speed value. It is an unsigned 32 bit value, stored MSB first, with a resolution of 0.01m/s. If your speed output is scaled from 0-255 as a single bit then you need to multiple your value by whatever factor is required to convert to the correct resolution

1mph = 0.44704m/s

So if you have a resolution of 1mph you need to multiply your incoming value by 44.7 before storing it.

I think that if you set it to appear as if it is GPS data and set your DASH2 to take the speed data from the RS232 then it will use this to drive both your speedometer and your odometer.

Martin
______________________________
Posted by Race Technology Support

DetroitAristo
Posts: 22
Joined: Sat Jan 07, 2017 1:55 am

Re: Dash2 Serial Datastream questions

Postby DetroitAristo » Tue Jan 31, 2017 2:53 am

Thanks Martin. I appreciate the response. This answers a lot of questions.

I will continue to work on the encode.

DetroitAristo
Posts: 22
Joined: Sat Jan 07, 2017 1:55 am

Re: Dash2 Serial Datastream questions

Postby DetroitAristo » Tue Apr 04, 2017 8:18 pm

Support wrote: If your speed output is scaled from 0-255 as a single bit then you

Martin


To go back to this now that it's spring and the car is in pieces. The statement quoted is logically impossible. A bit cannot represent an integer value of 255.

Are those karats meant to be pow() operators? That is, would a packet of 0xB 0x01 0x00 0x00 0x00 0x01 0x00 0x00 0x0D output a speed of 167772.16 m/sec?


If the speed is sent as 0000 0001 then it is 1 mile per hour. The encode to serial for the dash would be what?
If the speed is sent as 0000 1010 then it is 10 miles per hour. What would the serial encode be?

I simply cannot see a pattern here in regards to the formula for the serial encode posted for channel 11.
Speed (m/s) = (Data1 * 2^24 + Data2 * 2^16 + Data3 * 2^8 + Data4)* 0.01

Data being 8 bits means that the entirety of byte1 is multiplied by 16777216 (2^24) then added to the entirety of byte2 multiplied by 65536 (2^16) then added to the entirety of byte3 multiplied by 256 (2^8) then that giant number is multiplied by 0.01?

OR

Does this formula use bitwise operation? That is data1 IS bits 31 to 24, data2 is bits 23 to 16, data3 is bits 15 to 8, data4 is bits 7 to 1?

If 1mph is 0.45 (rounded for the 0.01 resolution) then would 1mph be 0000 0000 0000 0010 1101? (45 int)

If 10mph is 4.4704m/s how does that translate into a Dash2 readable stream? Would 10mph be 0000 0000 0000 1011 1111? (447 int)

The documentation is frustrating as there seems to be no real standard. There is mention of meters per second for the "speed data", then mention of km in the "processed speed data" identifier. What are the differences?

Also, what is the second half of that stream?
SpeedAcc (m/s) =( Data6 * 2^16 + Data7 * 2^8 + Data8)* 0.01


Is this the accuracy of the speed? Acceleration?


I have sent E-mails to US Support to no response. I am interested in getting either this encode working with a microcontroller reading from the CAN bus, or getting the Race Technology ECU CAN interface functional.

Colin105
Posts: 33
Joined: Mon Jan 28, 2013 4:56 am
Location: Australia

Re: Dash2 Serial Datastream questions

Postby Colin105 » Mon Apr 10, 2017 9:34 pm

Data being 8 bits means that the entirety of byte1 is multiplied by 16777216 (2^24) then added to the entirety of byte2 multiplied by 65536 (2^16) then added to the entirety of byte3 multiplied by 256 (2^8) then that giant number is multiplied by 0.01?


This is the correct interpretation the multiplication of 0.01 means that the raw value is really in cm/s.

I've got some working arduino code for this here but I've just realised how old it is so I'll update with my current code, I've also nearly finished a fully custom arduino driven full colour screen that reads the RT serial stream, I'll post details of that soon

https://github.com/colinbyrne105/RTArduino
You only need 2 things in your tool box, duct tape and WD40.
-if it moves and it shouldn't use the duct tape
-if it doesn't move and it should use the WD40

DetroitAristo
Posts: 22
Joined: Sat Jan 07, 2017 1:55 am

Re: Dash2 Serial Datastream questions

Postby DetroitAristo » Tue Apr 11, 2017 10:01 am

Cheers for that Colin. I appreciate it.

I am using a Teensy 3.6 as a CAN to Dash2 bridge. Running at 180mhz, I can log to SD as well as run the dash. I have some testing done, it was just the lack of consistency that was frustrating me. If I could get the official CAN ECU module working properly, I wouldn't have an issue, but it simply will not program.

I'll take what you have and get it ported into a visual studio solution and get to working on it. I use Visual Micro plugin for VS as it allows the use of intellisense and there's no guessing and a lot less frustration when dealing with external libraries.

DetroitAristo
Posts: 22
Joined: Sat Jan 07, 2017 1:55 am

Re: Dash2 Serial Datastream questions

Postby DetroitAristo » Tue Apr 11, 2017 10:12 am

Just to add,

Here is what I have currently. It is a cobbled-together mess as it stands. It does do some decode from the ProEFI, but I need to clean it up a lot. It's a work in progress and I am open to the idea of collaboration with anyone who is interested.

https://github.com/ChrisInRedford/CAN_Rx_Testing_ProEFI

DetroitAristo
Posts: 22
Joined: Sat Jan 07, 2017 1:55 am

Re: Dash2 Serial Datastream questions

Postby DetroitAristo » Tue Apr 11, 2017 10:51 am

Here is my partial encode:

Code: Select all

   double decode::getSpeedInMetersPerSecond(uint8_t id, uint8_t data1, uint8_t data2, uint8_t data3, uint8_t data4, uint8_t data5, uint8_t data6, uint8_t data7, uint8_t data8)
   {
      //Float_max is 4294967295 (4U)

      // 0x102 bits 40 - 47 are wheel speed in MPH.
      //f(y) = (Speed(m / s)) = (Data1 * 2 ^ 24 + Data2 * 2 ^ 16 + Data3 * 2 ^ 8 + Data4)* 0.01
      //f(x) = (Speed/Acc m/sec) = ((data6 * (2 ^ 16)) + (data7 * (2 ^ 8)) + (data8))* 0.01;
      // 1 MPH is .447 M/sec
      //  Serial (f(x)) *.01;
      // 10 MPH is 4.47m/sec
      // 20 MPH is 8.94m/sec
      // 30 MPH is 13.41m/sec
      // 40 MPH is 17.88m/sec
      // 50 MPH is 22.35m/sec
      // 60 MPH is 26.82m/sec

      // Test sends data[3] = 10 while data[3] > 60 each iteration += 5;

      //TODO: Fix this. The function should return the speed. NOT do all the serial writes.
      //TODO: Create a write function that does all the serial writing.
      uint32_t channel = id;
      uint32_t speedInMsec = 0;
      Serial.println(id);
      uint8_t checksum;
      uint8_t msg[10];
      if (id == 11) // Wheel speed data
      {
         checksum = (channel + data1 + data2 + data3 + data4 + data5 + data6 + data7 + data8) & 0xFF;
         msg[0] = (uint8_t)channel;
         msg[1] = data1;
         msg[2] = data2;
         msg[3] = data3;
         msg[4] = data4;
         msg[5] = data5;
         msg[6] = data6;
         msg[7] = data7;
         msg[8] = data8;
         msg[9] = checksum;
         uint8_t* ptr = &msg[0];
         Serial1.write(ptr, 10);
      }

I really wish this forum were more active. The Teensy is less than $30 and I could decode potentially any CAN-BUS message from any ECU which would make the Dash2 a more viable solution here in the states. It's relatively unknown and some of these logger dashboards are in excess of $2400US.

DetroitAristo
Posts: 22
Joined: Sat Jan 07, 2017 1:55 am

Re: Dash2 Serial Datastream questions

Postby DetroitAristo » Thu Apr 13, 2017 12:17 pm

Colin105 wrote:
Data being 8 bits means that the entirety of byte1 is multiplied by 16777216 (2^24) then added to the entirety of byte2 multiplied by 65536 (2^16) then added to the entirety of byte3 multiplied by 256 (2^8) then that giant number is multiplied by 0.01?


This is the correct interpretation the multiplication of 0.01 means that the raw value is really in cm/s.

I've got some working arduino code for this here but I've just realised how old it is so I'll update with my current code, I've also nearly finished a fully custom arduino driven full colour screen that reads the RT serial stream, I'll post details of that soon

https://github.com/colinbyrne105/RTArduino


A GIANT thank you to Colin.

This works perfectly to convert (encode) the ProEFI datastream to a proper serial stream for the Dash2:

Code: Select all

void decode::writeSpeedInMsec(uint32_t speedIn) //SpeedIn comes in CM/sec
{
   //Speed (m/s) = (Data1 * 2^24 + Data2 * 2^16 + Data3 * 2^8 + Data4)* 0.01

   uint8_t outgoingSerialMessage[10];
   uint8_t checksum = 0, byte1 = 0, byte2 = 0, byte3 = 0, byte4 = 0;

   
    //Copy the bits into the byte array for serial stream formatting
   byte1 = lowByte(speedIn >> 24);
   byte2 = lowByte(speedIn >> 16);
   byte3 = lowByte(speedIn >> 8);
   byte4 = lowByte(speedIn);

   //Build the Serial Message;
   outgoingSerialMessage[0] = 11;
   outgoingSerialMessage[1] = byte1;
   outgoingSerialMessage[2] = byte2;
   outgoingSerialMessage[3] = byte3;
   outgoingSerialMessage[4] = byte4;
   outgoingSerialMessage[5] = 0;
   outgoingSerialMessage[6] = 0;
   outgoingSerialMessage[7] = 0;
   outgoingSerialMessage[8] = 0;

   for (int i = 0; i < 9; i++)
   {
      checksum += outgoingSerialMessage[i];
   }
   outgoingSerialMessage[9] = checksum;

   //Send it
   Serial1.write(&outgoingSerialMessage[0], 10);
   
   return;
}

Colin105
Posts: 33
Joined: Mon Jan 28, 2013 4:56 am
Location: Australia

Re: Dash2 Serial Datastream questions

Postby Colin105 » Fri Apr 14, 2017 10:40 pm

No worries glad it helped
I'e just uploaded my latest version of the DLArduino code here
https://github.com/colinbyrne105/RTArduino

and have created a new repository for my screen project here
https://github.com/colinbyrne105/RTArduinoScreen

I'm planning on doing a little demo video soon but here's a sneak peak of what it looks like, not bad for a $13 screen and a $20 Arduino, The custom PCB was $80, but that was for 5 of them.

https://goo.gl/photos/2TpKUGVKu4cyJRVY6
You only need 2 things in your tool box, duct tape and WD40.
-if it moves and it shouldn't use the duct tape
-if it doesn't move and it should use the WD40

DetroitAristo
Posts: 22
Joined: Sat Jan 07, 2017 1:55 am

Re: Dash2 Serial Datastream questions

Postby DetroitAristo » Tue May 02, 2017 5:45 pm

It's fully functional now. I have the complete datastream encoding per the spec. I wish Race Technology implemented the 99 channel though. There are things unavailable that I'd like to see (like Ethanol %) that could be put into that channel and streamed from the ECU through the bridge into the Dash2.

I cannot thank you enough Colin. If you're ever around the Detroit Area, I owe you at least a beer.

Colin105
Posts: 33
Joined: Mon Jan 28, 2013 4:56 am
Location: Australia

Re: Dash2 Serial Datastream questions

Postby Colin105 » Thu May 04, 2017 11:13 pm

No problem at all, haven't been to Detroit yet, but work for a big OEM so you never know I might track that beer down one day
You only need 2 things in your tool box, duct tape and WD40.
-if it moves and it shouldn't use the duct tape
-if it doesn't move and it should use the WD40


Return to “General support questions”

Who is online

Users browsing this forum: Google [Bot] and 34 guests