Simple Logger

Developer topics relating to software that logs data from ECUs

Moderator: Freon

Postby Visceral » Sat Feb 05, 2005 9:03 am

Glad to see you're making some progress. Unfortunately, I haven't had any time to work on this. I was working on the code to make the parameters generic (attached below), but it requires a little work to complete. I didn't finish processing the result message in a generic fashion.

Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <termios.h>
#include <sys/select.h>
#include <time.h>
#include <getopt.h>

#define MAX_QUERY_MSG_LEN            64
#define MAX_RESPONSE_MSG_LEN      33

#define RPMH_OPT_IDX               0
#define RPML_OPT_IDX               1
#define MAPA_OPT_IDX               2
#define IGN_OPT_IDX                3
#define KCOR_OPT_IDX               4
#define MAFH_OPT_IDX               5
#define MAFL_OPT_IDX               6
#define INJ_OPT_IDX                7
#define MAX_OPTIONS                8

typedef struct ecu_t
{
  int connected;
  int fd;
};

typedef struct option_val_t
{
   bool on;
   u_int8_t value;
};
 
bool debug = false;

option_val_t options[] = {
   {false, 0x0E},                                   /* RPM High */
   {false, 0x0F},                                   /* RPM Low */
   {false, 0x0D},                                   /* MAP Absolute */
   {false, 0x11},                                   /* Ignition Timing */
   {false, 0x22},                                   /* Knock correction */
   {false, 0x13},                                   /* MAF High */
   {false, 0x14},                                   /* MAF Low */
   {false, 0x20}                                    /* Fuel Inj#1 Pulse Width */
};

typedef struct log_values_t
{
   unsigned int rpm;
   float mapa;
   unsigned int ign;
   unsigned int kcor;
   float maf;
   float inj;
};

int connect(ecu_t *e)
{
  struct termios options;

  e->connected = 0;                                /* reset in case we fail to connect */

  e->fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY);
  if (e->fd == -1)
    return 0;
  else
    fcntl(e->fd, F_SETFL, 0);

  tcgetattr(e->fd, &options);

  /* go to 4800 baud */
  cfsetispeed(&options, B4800);
  cfsetospeed(&options, B4800);

  options.c_lflag = 0;                             /* No local flags */
  options.c_oflag &= ~OPOST;                       /* No output processing */
  options.c_iflag &= ~(IXON | IXOFF | INPCK | PARMRK | BRKINT | INLCR | ICRNL |
                      IUCLC | IXANY);
  options.c_iflag |= IGNBRK;                       /* Ignore break conditions */
  options.c_cflag |= (CLOCAL | CREAD);             /* enable */
  options.c_cflag &= ~CRTSCTS;                     /* Turn off RTS/CTS */
  options.c_cflag &= ~PARENB;                      /* No parity */
  options.c_cflag &= ~CSTOPB;                      /* 1 stop bit */
  options.c_cflag &= ~CSIZE;
  options.c_cflag |= CS8;                          /* 8 bits */

  /* set all of the options */
  tcsetattr(e->fd, TCSANOW, &options);

  tcflush(e->fd, TCIOFLUSH);                       /* Flush input and output buffers */

  int status;
  ioctl(e->fd, TIOCMGET, &status);
  status |= TIOCM_DTR;                             /* Set DTR high */
  status &= ~TIOCM_RTS;                            /* Set RTS low  */
  ioctl(e->fd, TIOCMSET, &status);

  e->connected=1;
  return 1;
}

void getState(ecu_t *e)
{
  int status;
  ioctl(e->fd, TIOCMGET, &status);
  if (status & TIOCM_DTR)
    printf("DTR ON\n");
  else
    printf("DTR OFF\n");
  if (status & TIOCM_RTS)
    printf("RTS ON\n");
  else
    printf("RTS OFF\n");
  if (status & TIOCM_CTS)
    printf("CTS ON\n");
  else
    printf("CTS OFF\n");
  if (status & TIOCM_DSR)
    printf("DSR ON\n");
  else
    printf("DSR OFF\n");
}

void disconnect(ecu_t *e)
{
  tcflush(e->fd, TCIOFLUSH);
  if (!e->connected)
    return;
  close (e->fd);
}

void printMsg(u_int8_t* msg, int len)
{
  printf("Message: ");
  for (int i = 0; i < len; i++)
    printf("%X ", msg[i]);
  printf("\n");
}

int sendMsg(ecu_t *e, u_int8_t* msg, int len)
{
  int status;
  int writeLen = 0;

  tcflush(e->fd, TCIOFLUSH);                       /* Flush input and output buffers */

  writeLen = write(e->fd, msg, len);
  return writeLen;
}

int recvMsg(ecu_t *e, u_int8_t* msg, int len)
{
  struct termios oldtio, options;
  tcgetattr(e->fd, &oldtio);
   
  tcgetattr(e->fd, &options);
  options.c_lflag = 0;
  options.c_cc[VTIME] = 0;
  options.c_cc[VMIN] = len;
  //tcflush(e->fd, TCIFLUSH);
  tcsetattr(e->fd, TCSANOW, &options);
 
  int readLen = 0;
  readLen = read(e->fd, msg, len);
 
  tcsetattr(e->fd, TCSANOW, &oldtio);
 
  return readLen;
}

u_int8_t calcChecksum(u_int8_t* msg, int len)
{
  u_int8_t checksum = 0;
  for (int i = 0; i < len; i++)
    checksum += msg[i];
  return checksum;
}

int processResultString(u_int8_t rs[], int len, int qslen, log_values_t* values)
{
   int idx = qslen + 5;
   unsigned int rpmH = 0;
   unsigned int rpmL = 0;
   unsigned int mafH = 0;
   unsigned int mafL = 0;
   for (int i = 0; i < MAX_OPTIONS; i++)
   {
      if (idx >= len)
         return -1;

      if (options[i].on)
      {
         switch(i)
         {
            case RPMH_OPT_IDX:
               rpmH = rs[idx++];
               rpmH <<= 8;
              break;
            case RPML_OPT_IDX:
              rpmL = rs[idx++];
              break;
            case MAPA_OPT_IDX:
              values->mapa = (rs[idx++] * 37.0)/255;
              break;
            case IGN_OPT_IDX:
              values->ign = (rs[idx++] - 128)/2;
               break;
            case KCOR_OPT_IDX:
              values->kcor = (rs[idx++] - 128)/2;
               break;
            case MAFH_OPT_IDX:
              mafH = rs[idx++];
              mafH <<= 8;
               break;
            case MAFL_OPT_IDX:
              mafL = rs[idx++];
               break;
            case INJ_OPT_IDX:
              values->inj = rs[idx++] * 0.256;
               break;
         }
      }
   }
   
   if (rpmH > 0 || rpmL > 0)
      values->rpm = (rpmH + rpmL)/4;
   
  if (mafH > 0 || mafL > 0)
      values->maf = (mafH + mafL)/100.0;
      
   return 0;
}

int makeQueryString(u_int8_t qs[], int len)
{
   int idx = 0;
   int option_cnt = 0;
   
   /* String too short */
   if (len < 10)
     return -1;
    
   qs[idx++] = 0x80;
  qs[idx++] = 0x10;
  qs[idx++] = 0xF0;
  /* Set length to dummy value (0x00) initially */
  qs[idx++] = 0x00;
  qs[idx++] = 0xA8;
  qs[idx++] = 0x00;
  for (int i = 0; i < MAX_OPTIONS; i++)
  {
     if (options[i].on)
     {
        option_cnt++;
        qs[idx++] = 0x00;
        qs[idx++] = 0x00;
        qs[idx++] = options[i].value;
     }
  }
 
  /* Set length, each option is 3 bytes */
  qs[3] = (option_cnt * 3) + 2;
  return idx;
}

int getOptions(int argc, char** argv)
{
   int c;
   int option_index;
   bool log_option_set = false;
   static struct option long_options[] =
   {
      {"debug", 0, 0, 0},
      {"rpm", 0, 0, 0},
      {"mapa", 0, 0, 0},
      {"ign", 0, 0, 0},
      {"kcor", 0, 0, 0},
      {"maf", 0, 0, 0},
      {"inj", 0, 0, 0},
      {"help", 0, 0, 0},
      {0, 0, 0, 0}
   };

   while ((c = getopt_long(argc, argv, "", long_options, &option_index)) != EOF)
   {
      if (c == '?')
      {
      printf("Usage: %s [--debug] [--rpm] [--mapa] [--ign] [--kcor] [--maf] [--inj] [--help]\n", argv[0]);
        continue;
      }
      switch(option_index)
      {
         case 0:
           debug = true;
           printf("Debugging ON\n");
           break;
         case 1:
           options[RPMH_OPT_IDX].on = true;
           options[RPML_OPT_IDX].on = true;
           log_option_set = true;
           printf("RPM is ON\n");
           break;
         case 2:
           options[MAPA_OPT_IDX].on = true;
           log_option_set = true;
           printf("MAP (Manifold Absolute Pressure) in psig is ON\n");
           break;
         case 3:
           options[IGN_OPT_IDX].on = true;
           log_option_set = true;
           printf("IGN (Ignition Timing) in degrees is ON\n");
           break;
         case 4:
           options[KCOR_OPT_IDX].on = true;
           log_option_set = true;
           printf("KCOR (Knock Correction) in degrees is ON\n");
           break;
         case 5:
           options[MAFH_OPT_IDX].on = true;
           options[MAFL_OPT_IDX].on = true;
           log_option_set = true;
           printf("MAF (Mass Air Flow) in g/s is ON\n");
           break;
         case 6:
           options[INJ_OPT_IDX].on = true;
           log_option_set = true;
           printf("INJ (Injector Pulse Width) in ms is ON\n");
           break;
         case 7:
         default:
        printf("Usage: %s [--debug] [--rpm] [--mapa] [--ign] [--kcor] [--maf] [--inj] [--help]\n", argv[0]);
           break;
      }
   }
   return log_option_set;
}

int main(int argc, char** argv)
{
  ecu_t e;
  struct timeval hrTime;
  u_int8_t responseMsg[MAX_RESPONSE_MSG_LEN];
  int bytesRead;

  if (!getOptions(argc, argv))
  {
     printf("No options set for logging, exiting.\n");
     exit(0);
  }
 
  if (debug)
    printf("Opening serial port\n");
  if (!connect(&e))
  {
    perror("Could not open port");
    exit(-1);
  }
  else
  {
    if (debug)
      printf("Port opened\n");
  }

  if (debug)
    getState(&e);

  u_int8_t queryMsg[MAX_QUERY_MSG_LEN];
  int queryLen = makeQueryString(queryMsg, MAX_QUERY_MSG_LEN);
  queryMsg[queryLen++] = calcChecksum(queryMsg, queryLen);
  if (queryLen > 0)
  {
    printMsg(queryMsg, queryLen);
  }
  else
  {
    printf("Error generating query string\n");
    exit(-1);
  }

  // sleep(1);
 
  while(1)
  {
    if (debug)
      printMsg(queryMsg, queryLen);

    if (sendMsg(&e, queryMsg, queryLen) == -1)
    {
      perror("Could not write");
      exit(-1);
    }

    memset(responseMsg, 0, MAX_RESPONSE_MSG_LEN);
    /* Response message length = queryLen + 6 + (queryLen - 7)/3 */
    bytesRead = recvMsg(&e, responseMsg, MAX_RESPONSE_MSG_LEN);
    if (debug)
      printMsg(responseMsg, MAX_RESPONSE_MSG_LEN);
    /* 80 F0 10 05 E8 MAP RPMH RPML IGN KCOR CKSUM */
    if (debug)
      printf("RPMH: %X, RPML: %X, MAPA: %X IGN: %X\n", responseMsg[27],
                                                       responseMsg[28],
                                                       responseMsg[29],
                                                       responseMsg[30]);

    unsigned int rpmH = responseMsg[27];
    unsigned int rpmL = responseMsg[28];
    rpmH <<= 8;
    unsigned int rpm = (rpmH + rpmL)/4;
    float map = (responseMsg[29] * 37.0)/255;
    int ign   = (responseMsg[30] - 128)/2;
    int kcor   = (responseMsg[31] - 128)/2;
    /* 50ms for one parameter */
    gettimeofday(&hrTime, NULL);
    printf("%ld.%ld RPM: %i MAP: %.0f IGN: %i KCOR: %i\n", hrTime.tv_sec,
                                                           hrTime.tv_usec/1000,
                                                           rpm,
                                                           map,
                                                           ign,
                                                           kcor);
  }

  disconnect(&e);

  return 0;
}
Visceral
 
Posts: 23
Joined: Thu Dec 30, 2004 10:21 am

Postby WolfPlayer » Mon Feb 07, 2005 2:01 pm

crazymikie,

I now have cygwin installed. I just don't know what to do with it given that I am not a linux guy. If you can walk me through then that would be great. I see that you are on AOLIM. I added you to my buddy's list. My AIM is WolfPlayerSTI.

t
WolfPlayer
 
Posts: 16
Joined: Wed Feb 02, 2005 1:48 pm

Postby crazymikie » Mon Feb 07, 2005 2:34 pm

Cool.

I added you to my AIM list too.

I'll try to catch up to you later. I can walk you through it I think.


Thanks!
Mike
crazymikie
 
Posts: 105
Joined: Mon Jan 03, 2005 6:45 pm
Location: Watertown, MA

The quick how-to

Postby Visceral » Sat Feb 12, 2005 1:10 pm

Download and install Cygwin.
(You need to also install gcc/g++ which is not selected by default).

Copy-paste code into notepad and save as "logger.cpp".

Copy "logger.cpp" to the default directory for Cygwin (usually C:\cygwin\home\<username>).

Launch the Cygwin shell.

Make sure the file is there, either "ls" or "dir" will give you a directory listing.

Enter "gcc -o logger logger.cpp" to compile the code into an executeable.

Enter "./logger" to run.
Visceral
 
Posts: 23
Joined: Thu Dec 30, 2004 10:21 am

Postby crazymikie » Sun Feb 13, 2005 7:33 pm

Hey all-

I've posted some stuff up here:

http://mikeschear.com/SSM/

In there is:

ssm data.xls - this is a spreadsheet of all of the data that Mumbles posted, but cleaned up a bit and I've added some cars and what parameters they support. Anything highlighted in yellow means that I guessed at the address. I started filling thing in to see if I could figure out how to address some of the parameters that are listed as being supported but not documented (look at the first sheet- the initalization command says that some bytes are supported, but the documentation doesn't say what they are or how to address them).

logger_DEVEL3.c - this is the latest version of the program I've been playing with. It's based off the original version Visceral posted, but I've made it easier to add/remove parameters.

logger_PROBE2.c - pretty much the same with the exception that I've set it up to take an array of unknown parameters and log them against a set of known ones. I am trying to figure out what some of the undocumented addresses are. I'm working through the list of addresses > 0x000 and < 0x12F that don't return FF all the time. I believe 0x000 - 0x004 are switches of some sort since they do not every seem to change on my car.

The biggest thing I cannot find right now is how to read engine load. It is listed as 0x007 I believe, however, none of the cars I looked at support 0x007. I'm guessing it's somewhere else, unless it just needs to be calculated from TPS, MAF, MRP and whatever else....

I'll post more data up as I come across it. If anyone has any questions, please let me know. Again, I'm not trying to create a logger at this point- more just trying to understand how to access all of the available info. If anyone has any ideas, please let me know.

Thanks
Mike
crazymikie
 
Posts: 105
Joined: Mon Jan 03, 2005 6:45 pm
Location: Watertown, MA

Postby higB_0x05 » Wed Feb 23, 2005 10:36 am

Hey Mike,

I just took the car for a quick spin using your code and the Andy Whittaker hardware.... (this is aaronwrx)

It worked:

Code: Select all
Message: 80 10 F0 1 BF 40
Message: 6 10 F0 1 BF 40 80 F0 10 39 FF A2 10 11 3D 12 59 40 6 73 FA CB A6 2B 81 FE A8 0
 80 0 0 0 0 0 0 0 DC 0 0 75 1E 30 C0 F0 22 0 0 43 FB 0 F1 0 0 0 0 0 0 0 F0 B8
TIME     RPM     MRP     IGN     AFR     KNK     SPEED   TPS     MAF     EGT     LIT
0.397    721     -10.0   16      14.59   0.0     0.0     1.18    2.99    392     63.5
0.536    720     -10.0   16      14.59   0.0     0.0     1.18    3.03    392     63.5
0.673    712     -10.0   16      14.59   0.0     0.0     1.18    3.03    392     63.5
0.811    702     -10.0   17      14.59   0.0     0.0     1.18    3.03    392     63.5
0.949    700     -9.9    17      14.70   0.0     0.0     1.18    3.06    392     63.5
1.87     703     -9.9    17      14.59   0.0     0.0     1.18    3.03    392     63.5
1.225    706     -9.9    17      14.59   0.0     0.0     1.18    3.01    392     63.5
1.363    709     -9.9    17      14.70   0.0     0.0     1.18    3.03    392     63.5
1.502    720     -9.9    16      14.59   0.0     0.0     1.18    3.06    392     63.5
1.639    721     -9.9    16      14.59   0.0     0.0     1.18    3.03    392     63.5
1.778    710     -10.0   17      14.59   0.0     0.0     1.18    3.06    392     63.5
1.916    718     -10.0   16      14.59   0.0     0.0     1.18    3.03    392     63.5
2.53     689     -10.0   18      14.59   0.0     0.0     1.18    3.03    392     63.5
2.192    704     -9.9    17      14.70   0.0     0.0     1.18    3.01    392     63.5
2.329    700     -9.9    17      14.59   0.0     0.0     1.18    3.06    392     63.5
2.468    701     -9.9    17      14.70   0.0     0.0     1.18    3.01    392     63.5
2.606    714     -9.9    16      14.70   0.0     0.0     1.18    3.06    392     63.5
2.744    707     -9.9    17      14.70   0.0     0.0     1.18    3.01    392     63.5
2.882    706     -9.9    16      14.59   0.0     0.0     1.18    3.03    392     63.5
3.19     710     -10.0   17      14.59   0.0     0.0     1.18    3.03    392     63.5
3.158    708     -9.9    17      14.59   0.0     0.0     1.18    3.06    392     63.5
3.296    719     -10.0   16      14.59   0.0     0.0     1.18    3.03    392     63.5
3.434    706     -9.9    17      14.47   0.0     0.0     1.18    3.03    392     63.5
3.572    712     -10.0   16      14.59   0.0     0.0     1.18    3.03    392     63.5
3.711    714     -9.9    16      14.59   0.0     0.0     1.18    3.03    392     63.5
3.848    705     -9.9    17      14.59   0.0     0.0     1.18    3.03    392     63.5
3.987    721     -9.9    16      14.59   0.0     0.0     1.18    2.99    392     63.5
4.124    709     -9.9    17      14.59   0.0     0.0     1.18    3.03    392     63.5
4.262    693     -10.0   17      14.59   0.0     0.0     1.18    3.01    392     63.5
4.400    699     -9.9    17      14.59   0.0     0.0     1.18    3.03    392     63.5
4.538    699     -9.9    17      14.59   0.0     0.0     1.18    3.01    392     63.5
4.677    690     -9.9    17      14.59   0.0     0.0     1.18    3.03    392     63.5
4.814    709     -9.9    16      14.70   0.0     0.0     1.18    2.99    392     63.5
4.953    699     -9.9    17      14.70   0.0     0.0     1.18    3.06    392     63.5
5.90     703     -9.9    16      14.70   0.0     0.0     1.18    3.01    392     63.5
5.229    690     -9.9    17      14.70   0.0     0.0     1.18    3.03    392     63.5
5.367    686     -9.9    17      14.70   0.0     0.0     1.18    3.06    392     63.5
5.504    701     -9.9    17      14.70   0.0     0.0     1.18    3.08    392     63.5
5.643    693     -9.9    17      14.70   0.0     0.0     1.18    3.08    392     63.5
5.781    696     -9.9    17      14.70   0.0     0.0     1.18    3.08    392     63.5
5.919    703     -9.9    17      14.59   0.0     0.0     1.18    3.08    392     63.5
6.57     706     -9.9    16      14.59   0.0     0.0     1.18    3.08    392     63.5
6.195    712     -9.9    16      14.59   0.0     0.0     1.18    3.06    392     63.5
6.333    711     -9.9    17      14.59   0.0     0.0     1.18    3.08    392     63.5
6.472    704     -9.9    17      14.59   0.0     0.0     1.18    3.06    392     63.5
6.609    715     -9.9    16      14.59   0.0     0.0     1.18    3.08    392     63.5
6.747    694     -9.9    17      14.59   0.0     0.0     1.18    3.08    392     63.5
6.885    677     -9.9    18      14.59   0.0     0.0     1.18    3.03    392     63.5
<snip>
57.307   915     -9.9    18      13.78   0.0     6.8     1.96    4.29    392     63.5
57.445   946     -9.9    16      13.78   0.0     6.8     2.35    4.26    392     63.5
57.583   977     -10.0   14      13.67   0.0     4.3     2.35    4.29    392     63.5
57.721   992     -10.0   13      13.55   0.0     4.3     2.35    4.26    392     63.5
57.858   999     -10.0   18      13.55   0.0     4.3     2.75    4.29    392     63.5
57.997   992     -9.7    17      13.55   -2.0    3.1     3.53    5.76    392     63.5

58.135   950     -9.4    18      13.78   -2.0    3.1     3.53    5.93    392     63.5
58.273   932     -9.0    18      13.90   -2.0    3.1     3.53    5.86    392     63.5
58.411   922     -8.9    18      13.78   -2.0    3.1     3.53    5.77    392     63.5
58.549   900     -8.9    18      13.44   -2.0    1.2     3.53    5.77    392     63.5
58.687   874     -8.7    19      13.55   -2.0    1.2     3.53    5.67    392     63.5
58.826   857     -8.6    19      13.55   -2.0    1.2     3.14    5.45    392     63.5
58.963   840     -8.6    18      13.78   -2.0    0.6     3.14    5.29    392     63.5
59.101   822     -8.6    18      13.90   -2.0    0.6     3.14    5.20    392     63.5
59.239   802     -8.4    19      13.90   -2.0    0.6     3.14    5.26    392     63.5
59.377   799     -8.3    19      14.01   -2.0    0.6     3.14    5.26    392     63.5
59.516   794     -8.3    19      14.13   -2.0    0.0     3.14    5.20    392     63.5
59.653   797     -8.3    19      14.36   -2.0    0.0     3.14    5.20    392     63.5
59.792   787     -8.3    19      14.47   -2.0    0.0     3.14    5.20    392     63.5
59.930   790     -8.3    19      14.47   -2.0    0.6     3.14    5.20    392     63.5
60.67    791     -8.1    19      14.47   -2.0    0.6     3.14    5.23    392     63.5
60.206   797     -8.3    19      14.47   -2.0    0.6     3.14    5.11    392     63.5
60.343   798     -8.3    19      14.36   -2.0    0.6     3.14    5.20    392     63.5
60.482   798     -8.3    19      14.24   -2.0    0.6     3.14    5.24    392     63.5
60.619   787     -8.3    19      14.24   -2.0    0.6     3.14    5.15    392     63.5
60.758   781     -8.3    19      14.13   -2.0    0.6     3.14    5.18    392     63.5
60.896   782     -8.1    19      14.13   -2.0    0.6     3.14    5.21    392     63.5
61.34    779     -8.1    19      14.13   -2.0    0.6     3.14    5.18    392     63.5
61.172   777     -8.1    19      14.13   -2.0    0.6     3.14    5.18    392     63.5
61.309   774     -8.1    19      14.24   -2.0    0.0     3.14    5.18    392     63.5
61.448   782     -8.1    19      14.13   -2.0    0.0     3.14    5.18    392     63.5
61.586   789     -8.0    19      14.13   -2.0    0.0     4.31    5.98    392     63.5
61.724   797     -7.5    21      14.13   -2.0    0.0     5.49    7.15    392     63.5
61.862   850     -6.2    24      14.36   -2.0    0.0     8.63    10.04   392     63.5
62.0     980     -4.4    26      14.47   2.5     0.0     12.16   16.16   392     63.5
62.138   1291    -3.0    26      13.32   1.5     0.0     13.33   18.07   392     63.5
62.277   1432    -3.3    28      12.86   -0.5    0.6     12.94   17.68   392     63.5
62.414   1340    -3.3    26      13.67   0.5     0.6     14.12   20.00   392     63.5
62.552   1288    -2.9    24      13.44   1.0     0.6     13.73   18.61   392     63.5
62.691   1305    -2.8    24      13.09   1.0     0.6     13.73   19.08   392     63.5
62.828   1338    -2.9    24      13.78   1.0     1.2     13.73   19.09   392     63.5
62.967   1393    -3.2    25      13.90   0.5     1.2     11.76   18.39   392     63.5
63.104   1409    -4.1    27      13.55   -0.5    1.2     11.37   16.99   392     63.5
63.243   1386    -4.1    27      13.67   0.0     3.1     11.76   18.16   392     63.5
63.381   1363    -4.1    27      13.90   0.0     3.1     11.37   17.85   392     63.5
63.518   1400    -4.2    27      13.67   -0.5    3.1     11.37   17.79   392     63.5
63.657   1501    -4.8    30      13.55   -2.0    3.1     10.20   16.61   392     63.5
63.794   1647    -5.7    31      13.90   -4.0    4.3     10.59   17.14   392     63.5



p.s. im aaronwrx@nasioc[/code]
higB_0x05
 
Posts: 11
Joined: Thu Jan 20, 2005 1:52 pm
Location: Northern VA

Postby crazymikie » Wed Feb 23, 2005 7:53 pm

Awesome! I'm working on finding engine load right now. I've foudn it on a few different ECUs, however, it's at a different address on each type, so it's going to take some time.

I'd like to get a simple Win exe together that people could run that would get the data so I could quickly collect it. I've been working on it, but I haven't had a lot of time. Hopefully, I'll have something after this weekend.


Thanks!
Mike
crazymikie
 
Posts: 105
Joined: Mon Jan 03, 2005 6:45 pm
Location: Watertown, MA

Postby higB_0x05 » Thu Feb 24, 2005 11:26 am

I was looking through the source of scantool108 (Which doesnt work with my interface BTW)

http://www.scantool.net/software/scanto ... source.htm

From serial.c
Code: Select all
#include <string.h>
#include <ctype.h>
#include "globals.h"
#include <allegro/internal/aintern.h>
#ifdef ALLEGRO_WINDOWS
   #include <winalleg.h>
#else
   #include <dzcomm.h>
#endif
#include "serial.h"

#ifdef ALLEGRO_WINDOWS
   static HANDLE com_port;
#else
   static comm_port *com_port;
#endif


and setting up the comport:
Code: Select all
#ifdef ALLEGRO_WINDOWS
      sprintf(temp_str, "COM%i", comport.number + 1);
      com_port = CreateFile(temp_str, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
      if (com_port == INVALID_HANDLE_VALUE)
      {
         comport.status = NOT_OPEN; //port was not open
         return -1; // return error
      }

      GetCommState(com_port, &dcb);
      dcb.BaudRate = 9600;
      dcb.ByteSize = 8;
      dcb.StopBits = ONESTOPBIT;
      dcb.fParity = FALSE;
      dcb.Parity = NOPARITY;
      dcb.fOutxCtsFlow = FALSE;
      dcb.fOutxDsrFlow = FALSE;
      dcb.fOutX = FALSE;
      dcb.fInX = FALSE;
      dcb.fDtrControl = DTR_CONTROL_ENABLE;
      dcb.fRtsControl = RTS_CONTROL_ENABLE;
      dcb.fDsrSensitivity = FALSE;
      dcb.fErrorChar = FALSE;
      dcb.fAbortOnError = FALSE;
      SetCommState(com_port, &dcb);
     
      timeouts.ReadIntervalTimeout = MAXWORD;
      timeouts.ReadTotalTimeoutMultiplier = 0;
      timeouts.ReadTotalTimeoutConstant = 0;
      timeouts.WriteTotalTimeoutMultiplier = 0;
      timeouts.WriteTotalTimeoutConstant = 0;
      SetCommTimeouts(com_port, &timeouts);
   #else
      com_port = comm_port_init(comport.number);
      comm_port_set_baud_rate(com_port, _9600);
      comm_port_set_parity(com_port, NO_PARITY);
      comm_port_set_data_bits(com_port, BITS_8);
      comm_port_set_stop_bits(com_port, STOP_1);
      comm_port_set_flow_control(com_port, NO_CONTROL);
      if (comm_port_install_handler(com_port) != 1)
      {
         comport.status = NOT_OPEN; //port was not open
         return -1; // return error
      }
   #endif
   serial_time_out = FALSE;
   comport.status = READY;
   
   return 0; // everything is okay
}


I cant find this library: is it free?
#include <allegro/internal/aintern.h>
#ifdef ALLEGRO_WINDOWS :?:
higB_0x05
 
Posts: 11
Joined: Thu Jan 20, 2005 1:52 pm
Location: Northern VA

Postby bofh » Wed Mar 09, 2005 12:20 pm

crazymikie wrote:Awesome! I'm working on finding engine load right now. I've foudn it on a few different ECUs, however, it's at a different address on each type, so it's going to take some time.

I'd like to get a simple Win exe together that people could run that would get the data so I could quickly collect it. I've been working on it, but I haven't had a lot of time. Hopefully, I'll have something after this weekend.


Thanks!
Mike


Did you ever get anywhere with this? Got some time now and was going to play, but I wanted to see if you had the exe first.
bofh
 
Posts: 50
Joined: Thu Dec 30, 2004 1:59 pm
Location: Houston, TX

Postby crazymikie » Thu Mar 10, 2005 2:03 pm

Yup :)

Now I need to collect a bunch of data from different ECU types.

higB_0x05 was trying to get some info on how to convert a cygwin program into a native windows one. Once that's done, if people can get their hands on an HW interface (simple ISO version of an OBD2->serial will work fine- plans are available on the internet), we can collect data from different ecu types that I need.

I've been a little tied up too, so I haven't had a lot of time to devote to this.

Mike
crazymikie
 
Posts: 105
Joined: Mon Jan 03, 2005 6:45 pm
Location: Watertown, MA

Postby cdvma » Mon Mar 14, 2005 5:38 pm

Aaaaaa I need some free time!!!! I've already got a solid Java platform for this stuff and I wish I could integrate it.

What I would DIE for is an ECU that I can power up and give sensor input from outside the car. Anyone care to loan me a wiring harness, signal generator, and a power supply that doesn't suck? Please? :D

Oh and Mike I remember that ECUTek calculated load. I used to have the equation...let me try and dig it up since it appears they took it down from their site.
cdvma
 
Posts: 86
Joined: Tue Jan 04, 2005 9:18 pm
Location: Roch. Inst. of Tech.

Postby domsub » Sat Mar 19, 2005 5:48 am

Hi,
If you try :
0x00, 0x02, 0x01, 0x24 you have IAM value...
domsub
 
Posts: 7
Joined: Sat Mar 19, 2005 4:40 am

Postby crazymikie » Mon Mar 21, 2005 8:37 am

domsub- Sweet!

What ECU type do you have?

I have the values for an 05 aj890 (both load and IAM). I will need to add a section to the spreadsheet for this data.


Thanks!
Mike
crazymikie
 
Posts: 105
Joined: Mon Jan 03, 2005 6:45 pm
Location: Watertown, MA

Postby domsub » Tue Mar 22, 2005 4:48 pm

ECU AH990 5512
domsub
 
Posts: 7
Joined: Sat Mar 19, 2005 4:40 am

Postby higB_0x05 » Wed Apr 06, 2005 2:27 pm

Fuel trims would be nice... I don't have delta dash.

ST + LT
higB_0x05
 
Posts: 11
Joined: Thu Jan 20, 2005 1:52 pm
Location: Northern VA

PreviousNext

Return to Data Logging Software

Who is online

Users browsing this forum: No registered users and 7 guests