Megasquirt 3

thokes82
Posts: 38
Joined: Wed Oct 24, 2012 4:11 pm

Megasquirt 3

Postby thokes82 » Fri Aug 16, 2013 9:08 am

Hi there,
I bought a DL1 plus Dash2 plus MS2 ECU Interface. Now I want to get it to run with my MS3. The Stream length is different from MS2 however The Position of data within the Streams is remaining the same. Who can help me with an upgrade of my interface?

Please make it run. It would just be too cool.

Here the data section:

Code: Select all


[OutputChannels]
   deadValue        = { 0 } ; Convenient unchanging value.

#if CAN_COMMANDS
;full version that works anywhere - be sure to change the no. bytes requested
   ochGetCommand    = "r\x00\x07\x00\x00\x01\xaa"
#else
; fast get via serial
   ochGetCommand       = "A"
#endif
   ochBlockSize     = 426 ;oi! change ochGetCommand as well ; SIZEOFTXBUF

   seconds          = scalar, U16,    0, "s",   1.000, 0.0
   secl = { seconds % 256 }, "s" ; For runtime screen.
#if PW_4X
   pulseWidth1      = scalar, U16,    2, "ms",   0.004, 0.0
   pulseWidth2      = scalar, U16,    4, "ms",   0.004, 0.0
#else
   pulseWidth1      = scalar, U16,    2, "ms",   0.001, 0.0
   pulseWidth2      = scalar, U16,    4, "ms",   0.001, 0.0
#endif
   pulseWidth       = { pulseWidth1 }, "ms" ; For runtime screen.

   rpm              = scalar, U16,    6, "RPM", 1.000, 0.0
   advance          = scalar, S16,    8, "deg", 0.100, 0.0
...................
--------
CUT

Last edited by thokes82 on Wed Sep 18, 2013 3:10 pm, edited 1 time in total.

Support

Support

Postby Support » Fri Aug 16, 2013 3:06 pm

Hello,

It will require some new firmware from us for the ECU interface that expects the extra message so the check sum calculates correctly.

I have forward this post to the engineer that is responsible for this. He is currently on holiday for 2 weeks but as soon as i have a reply i will give you an update.

Kind regards,
Support

thokes82
Posts: 38
Joined: Wed Oct 24, 2012 4:11 pm

Postby thokes82 » Fri Aug 16, 2013 3:59 pm

Can you perhaps tell me what version of MS 2 is the adapter for? Maybe I could make my MS3 talk "MS2".
Even if not, I am a good Hobby developer and can certainly help your engineer. You are probably using PIC or Atmel controller to make the translation.

Regards, Thomas

Support

Postby Support » Thu Aug 22, 2013 10:16 am

If you reduce the length of the data stream so that it finishes after the second AFR reading and then has the checksum then it should work with the MS2 reader.

Martin

thokes82
Posts: 38
Joined: Wed Oct 24, 2012 4:11 pm

Postby thokes82 » Fri Aug 23, 2013 2:58 pm

Thanks for the answer, Martin.
But seriously after afr2? That means 32 byte length plus 1 byte checksum? This has never been in MS2 that way, has it? Which command do you use for getting data: "a" or "A" ?
Or do you mean the AFR2 reading at position 253 (having 255 byte in total)? Does your buffer have that limit? Could be. I give it a try. But I really need to know whether you use "a" or "A".

edit:
I communicate using my arduino with the following setup. I don't want to make my MS3 communicating in a different way. I'd rather have my arduino telling the RT Dash2 what to display. My Arduino is used to send live data to an SQL Database via gprs (telemetry). It has all MS3 data anyways.
I don't know yet, if I am ending up with no need for the ECU interface, when I would learn more about your serial format. Would you allow btw if i'd keep posting code in that case?

The 112 byte is the so called Megaview standard. That way you do not need to adapt firmware every time if there is a new release. It comes with:
sending the "a" command. All MS3 use it. Everybody who kept updating his Megasquirt is ending up with this format.

Code: Select all

#define MS_TABLE_SIZE 112

//! Queries the MS3ECU for a dump of all registers
//! @param table An array of MS_TABLE_SIZE bytes which is populated with the register data
/*

   Offset   Size         Description
   0      16      seconds
   2      16      pulsewidth1
   4      16      pulswidth 2
   6      16      rpm
   8      16      advance
   10      8      engine
   11      8      TK3ECU
   12      8      AFR Target 1
   13      8      AFR Target 2
   14      8      wb02 1
   15      8      wb02 2
   16      16      barometer
   18      16      map
   20      16      mat
   22      16      coolant
   24      16      tps
   26      16      battery voltage
   28      16      afr1
   30      16      afr2
   32      16      knock
   34      16      egoCorrection1
   36      16      EgoCorrection2
   38      16      airCorrection
   40      16      Warmup Enrichment
   42      16      accelEnrich
   44      16      tpsfuelcut
   46      16      baroCorrection
   48      16      gammaEnrich
   50      16      veCurr1
   52      16      veCurr2
   54      16      iacstep
   56      16      idleDC   
   56      16      coldAdvDeg
   58      16      tpsDOT   
   60      16      mapDOT   
   62      16      dwell     
   64      16      maf         
   66      16      calcMAP     
   68      16      fuelCorrection
   70      8      portStatus
   71      8      knockRetard     
   72      16      xTauFuelCorr1   
   74      16      egoV1         
   76      16      egoV2         
   78      16      amcUpdates   
   80      16      kpaix       
   82      16      xTauFuelCorr2
   84      16      spare1     
   86      16      spare2     
   88      16      trig_fix 
   90      16      spare4   
   92      16      spare5 
   94      16      spare6
   96      16      spare7
   98      16      spare8
   100      16      spare9
   102      16      spare10
   104      16      tachCount
   106      8      ospare
   107      8      cksum
   108      32      deltaT
*/
byte TK3ECU::getData(byte table[])
{
   byte status;
   byte cmd[3];
   cmd[0]='a';
   cmd[1]=byte(0);
   cmd[2]=byte(6);
    Serial.println("Getting data from command a");
   status=runCommand(cmd,3, table,MS_TABLE_LENGTH);
   return status;
}


regards, Thomas

Support

Postby Support » Wed Aug 28, 2013 10:10 am

The request is sent by sending 'A', there is no specific length or reply required, but the maximum buffer size is 256 so keeping well under this is good. AFR2 is the last message we actually use, so any length longer than this will be OK.


The Megasquirt ECUs have easily been the most difficult ECUs for us to work with, the lack of any sensible standards and what appears to be a complete lack of any documentation make it something of a headache :(

Martin

thokes82
Posts: 38
Joined: Wed Oct 24, 2012 4:11 pm

Postby thokes82 » Mon Sep 02, 2013 9:54 am

Made my Arduino doing the conversion from MS3 to RT Dash 2. That way I can also use more channels and do some unit conversion where needed.

I found a "bug" in the RT Manual though. On this page:
http://www.race-technology.com/wiki/ind ... uleChannel

It is decribed, that the scaling bytes for times and pressures come second. However they come third (after the Source selection). Am I right?

Support

Postby Support » Mon Sep 02, 2013 10:32 am

Yes that was a mistake, I've corrected it now. Thanks.

Martin


Return to “General software support”

Who is online

Users browsing this forum: No registered users and 20 guests