getting VSS data over the CAN Bus to MS2 for data logging

A forum for discussing applications and implementations of the MegaShift transmission controller code for the GPIO from B&G. This can control up to 8-speeds and 6 shift solenoids (plus a 16x9 table for controlling a PWM line pressure valve). It has manual and fully automatic modes (16x9 load x speed table), with under and over rev-limit protection, and full data logging of all inputs and outputs (among many other abilities). A TransStim to test your completed board is also available.
Post Reply
ca434sbc4
Posts: 8
Joined: Sun Sep 14, 2008 8:43 pm

getting VSS data over the CAN Bus to MS2 for data logging

Post by ca434sbc4 »

Lance,

How can I get the vehicle speed sent over the CAN-Bus into the MS2 and then out the MS2 serial port in order to datalog speed along with the engine parameters?

Marc
Bernard Fife
Posts: 1696
Joined: Fri Apr 04, 2008 1:28 pm

Re: getting VSS data over the CAN Bus to MS2 for data loggin

Post by Bernard Fife »

Marc,

To do it that way, you would need custom MS-II code. The better way is to enable all the MS-II variables in the trans code, then datalog them along with the MShift data (speed, gear, etc.) from the GPIO serial port. Several of the MS-II variables (fuel pulse width, rpm, load, tps, advance, and battery voltage) are already there, the rest are trivial to add (but need recompiled code). The relevant section is:

Code: Select all

  // outpc.seconds        = *(int *)(msvar + 0);   // 2 bytes (int) at offset 0 in msvar[]
  outpc.pulsewidth1= *(int *)(msvar + 2);   // 2 bytes (int) at offset 2 in msvar[]
  // outpc.pw2            = *(int *)(msvar + 4);   // 2 bytes (int) at offset 4 in msvar[]
  outpc.engine_rpm = *(int *)(msvar + 6);   // rpm is 2 bytes (int) at offset 6 in msvar[]
  outpc.adv_deg    = *(int *)(msvar + 8);   // 2 bytes (int) at offset 8 in msvar[]
  // outpc.squirt         = *(char *)(msvar + 10); // 1 byte (char) at offset 10 in msvar[]
  // outpc.engine         = *(char *)(msvar + 11); // 1 byte (char) at offset 11 in msvar[]
  // outpc.afrtgt1        = *(char *)(msvar + 12); // 1 byte (char) at offset 12 in msvar[]
  // outpc.afrtgt1        = *(char *)(msvar + 13); // 1 byte (char) at offset 13 in msvar[]
  // outpc.wbo2_en1       = *(char *)(msvar + 14); // 1 byte (char) at offset 14 in msvar[]
  // outpc.wbo2_en2       = *(char *)(msvar + 15); // 1 byte (char) at offset 15 in msvar[]
  // outpc.barometer      = *(int *)(msvar + 16);  // 2 bytes (int) at offset 16 in msvar[]
  outpc.LOAD       = *(int *)(msvar + 18);  // kPa is 2 bytes (int) at offset 18 in msvar[]
  // outpc.mat            = *(int *)(msvar + 20);  // 2 bytes (int) at offset 20 in msvar[]
  // outpc.coolant        = *(int *)(msvar + 22);  // 2 bytes (int) at offset 22 in msvar[]
  outpc.tps        = *(int *)(msvar + 24);  // 2 bytes (int) at offset 24 in msvar[]
  outpc.vBatt      = *(int *)(msvar + 26);  // 2 bytes (int) at offset 26 in msvar[]
  // outpc.afr1           = *(int *)(msvar + 28);  // 2 bytes (int) at offset 28 in msvar[]
  // outpc.afr2           = *(int *)(msvar + 30);  // 2 bytes (int) at offset 30 in msvar[]
  // outpc.knock          = *(int *)(msvar + 32);  // 2 bytes (int) at offset 32 in msvar[]
  // outpc.egoCorrection1 = *(int *)(msvar + 34);  // 2 bytes (int) at offset 34 in msvar[]
  // outpc.egoCorrection1 = *(int *)(msvar + 36);  // 2 bytes (int) at offset 36 in msvar[]
  // outpc.airCorrection  = *(int *)(msvar + 38);  // 2 bytes (int) at offset 38 in msvar[]
  // outpc.warmupEnrich   = *(int *)(msvar + 40);  // 2 bytes (int) at offset 40 in msvar[]
  // outpc.accelEnrich    = *(int *)(msvar + 42);  // 2 bytes (int) at offset 42 in msvar[]
  // outpc.tpsfuelcut     = *(int *)(msvar + 44);  // 2 bytes (int) at offset 44 in msvar[]
  // outpc.baroCorrection = *(int *)(msvar + 46);  // 2 bytes (int) at offset 46 in msvar[]
  // outpc.gammaEnrich    = *(int *)(msvar + 48);  // 2 bytes (int) at offset 48 in msvar[]
  // outpc.veCurr1        = *(int *)(msvar + 50);  // 2 bytes (int) at offset 50 in msvar[]
  // outpc.veCurr2        = *(int *)(msvar + 52);  // 2 bytes (int) at offset 52 in msvar[]
  // outpc.iacstep        = *(int *)(msvar + 54);  // 2 bytes (int) at offset 54 in msvar[]
  // outpc.coldAdvDeg     = *(int *)(msvar + 56);  // 2 bytes (int) at offset 56 in msvar[]
  // outpc.tpsDOT         = *(int *)(msvar + 58);  // 2 bytes (int) at offset 58 in msvar[]
  // outpc.mapDOT         = *(int *)(msvar + 60);  // 2 bytes (int) at offset 60 in msvar[]
  // outpc.dwell          = *(int *)(msvar + 62);  // 2 bytes (int) at offset 62 in msvar[]
  // outpc.maf            = *(int *)(msvar + 64);  // 2 bytes (int) at offset 64 in msvar[]
  // outpc.calcMAP        = *(int *)(msvar + 66);  // 2 bytes (int) at offset 66 in msvar[]
  // outpc.fuelCorrection = *(int *)(msvar + 68);  // 2 bytes (int) at offset 68 in msvar[]
  // outpc.portStatus     = *(char *)(msvar + 70); // 1 byte (char) at offset 70 in msvar[]
  // outpc.knockRetard    = *(char *)(msvar + 71); // 1 byte (char) at offset 71 in msvar[]
  // outpc.xTauFuelCorr1  = *(int *)(msvar + 72);  // 2 bytes (int) at offset 72 in msvar[]
  // outpc.egoV1          = *(int *)(msvar + 74);  // 2 bytes (int) at offset 74 in msvar[]
  // outpc.egoV2          = *(int *)(msvar + 76);  // 2 bytes (int) at offset 76 in msvar[]
  // outpc.amcUpdates     = *(int *)(msvar + 78);  // 2 bytes (int) at offset 78 in msvar[]
  // outpc.aux_voltsix    = *(int *)(msvar + 80);  // 2 bytes (int) at offset 80 in msvar[]
  // outpc.xTauFuelCorr2  = *(int *)(msvar + 82);  // 2 bytes (int) at offset 82 in msvar[]
  // outpc.spare1         = *(int *)(msvar + 84);  // 2 bytes (int) at offset 84 in msvar[]
  // outpc.spare2         = *(int *)(msvar + 86);  // 2 bytes (int) at offset 86 in msvar[]
  // outpc.spare3         = *(int *)(msvar + 88);  // 2 bytes (int) at offset 88 in msvar[]
  // outpc.spare4         = *(int *)(msvar + 90);  // 2 bytes (int) at offset 90 in msvar[]
  // outpc.spare5         = *(int *)(msvar + 92);  // 2 bytes (int) at offset 92 in msvar[]
  // outpc.spare6         = *(int *)(msvar + 94);  // 2 bytes (int) at offset 94 in msvar[]
  // outpc.spare7         = *(int *)(msvar + 96);  // 2 bytes (int) at offset 96 in msvar[]
  // outpc.spare8         = *(int *)(msvar + 98);  // 2 bytes (int) at offset 98 in msvar[]
  // outpc.spare9         = *(int *)(msvar + 100); // 2 bytes (int) at offset 100 in msvar[]
  // outpc.spare10        = *(int *)(msvar + 102); // 2 bytes (int) at offset 102 in msvar[]
  // outpc.spare11        = *(int *)(msvar + 104); // 2 bytes (int) at offset 104 in msvar[]
  // outpc.ospare         = *(char *)(msvar + 106);// 1 byte (cahr) at offset 106 in msvar[]
  // outpc.chksum         = *(char *)(msvar + 107);// 1 byte (char) at offset 107 in msvar[]
  // outpc.deltaT         = *(long *)(msvar + 108);// 4 bytes (long) at offset 108 in msvar[]
The commented lines would need to be uncommented (// removed) and these variables would need to be added to the outpc structure and the INI.

If there is enough interest in this, I will do the code mods and test it, then release it here. Otherwise you could wait for the CAN pass through modes to be added (after the current code is tested or you could do it yourself, of course).

Lance.
"Never wrestle with pigs. You both get dirty and the pig likes it." - George Bernard Shaw
Post Reply