[Coladam] Reversing AdamNET

Dale Wick dmwick at yahoo.com
Thu Sep 22 02:12:02 CEST 2011


// Here is the sketch.  It is basically C++ code.  
// It depends on a recent version of the NewSoftSerial file from
// http://arduiniana.org/libraries/newsoftserial/

// I made a cable which is hooked up to 
// Arduino pin 5 (reset line)
// Arduino pin 2 (AdamNET serial data line)
// Arduino pin 3 isn't used yet -- since AdamNET requires half-duplex
// Arduino ground (AdamNET ground) on the Arduino Uno.
// to see the output start up the Arduino application, 
// click on "Serial Monitor" and choose the speed 115200.

#include <NewSoftSerial.h>

NewSoftSerial mySerial(2, 3, true);

int resetLine=HIGH;

void setup()  
{
  Serial.begin(115200);
  Serial.println("Goodnight moon!");

  // set the data rate for the NewSoftSerial port
  mySerial.begin(62500);
  mySerial.println("Hello, world?");
  pinMode(5, INPUT);
}

unsigned char recent[2];
int quiet=0;

void loop()                     // run over and over again
{
  int newResetLine=digitalRead(5);
  if( newResetLine!=resetLine ) {
     resetLine=newResetLine;
     Serial.print("AdamNET ");
     Serial.println((int)resetLine);
  }
  
  if (mySerial.available()) {
      static int wrap=0;
      unsigned char curr=mySerial.read();
      if( curr!=recent[0] && curr!=recent[1]) {
        if( quiet) {
          recent[0]=recent[1];
          recent[1]=curr;
        } else {
          recent[0]=255;
          recent[1]=255; 
        }
        Serial.print(curr,HEX);
        Serial.print(" ");
        wrap=(wrap+1)%16;
        if(wrap==0) Serial.println("");
      }
  }
  if (Serial.available()) {
      //mySerial.print((char)Serial.read());
      int ch=Serial.read();
      if( ch==0x30) {
        Serial.println("Quiet mode");
        quiet=1; 
      } else if(ch==0x31) {
        Serial.println("Noisy mode");
        quiet=0;
      } 
  }
}



________________________________
From: geoffrey oltmans <oltmansg at bellsouth.net>
To: Dale Wick <dalemwick at hotmail.com>; dmwick at yahoo.com; coladam at adamcon.org
Sent: Wednesday, September 21, 2011 6:09:20 PM
Subject: Re: [Coladam] Reversing AdamNET


Cool deal! I'd love to see it. I can send you an archive of all the sources I have when I get home this evening.





________________________________
From: Dale Wick <dalemwick at hotmail.com>
To: Geoff Oltmans <oltmansg at bellsouth.net>; dmwick at yahoo.com; coladam at adamcon.org
Sent: Wed, September 21, 2011 5:07:33 PM
Subject: RE: [Coladam] Reversing AdamNET

 
I do not have the 6801 source code.  When it was going around I wasn't interested. I don't really know who has it now.

I did read a data sheet for a 6801 family microcontroller and I did find it helpful for the first part of my reversing work, but since I'm using a different microcontroller (the ATMEL ATMega328) it wasn't useful after that.  And at the moment I'm not using the serial device in that chip either, but instead I have a software serial function running on some I/O pins that don't have a UART built in.  The advantage is that it gives me more control, but the disadvantage is that it keeps the microcontroller CPU busy while sending or receiving.

I will be posting my sketch for the Uno to listen in on the AdamNET soon, plus some transcripts of what is going on and who is saying it.

Dale


> Date: Wed, 21 Sep 2011 14:20:52 -0700
> From: oltmansg at bellsouth.net
> To: dmwick at yahoo.com;
 coladam at adamcon.org
> Subject: Re: [Coladam] Reversing AdamNET
> 
> Have you had a look at the 6801 MCU source code? Also the 6801 MCU datasheet is 
> fairly illuminating about the SCI interface that's used to implement AdamNET. I 
> had thought to do the same type of project for interfacing with the emulator, 
> but never seem to have enough time. ;)
> 
> 
> 
> ________________________________
> From: Dale Wick <dmwick at yahoo.com>
> To: Coleco AdamMailing List <coladam at adamcon.org>
> Sent: Wed, September 21, 2011 4:09:24 PM
> Subject: [Coladam] Reversing AdamNET
> 
> Hi,
> 
> Since AdamCon I've felt inspired to start reversing the AdamNET protocol.  The 
> only documents I have on the protocol are from the various versions of the Adam 
> Technical Manual.  So I used that as a starting point.
> 
> The protocol is
 based on a 62.5k baud serial half duplex protocol.  So in the 6 
> wire modular cable, there are 4 wires used:
> 1 (white). +5V power
> 2 (black). ground (logic)
> 
> 3 (green). ground
> 
> 4 (red). ground
> 
> 5 (yellow). AdamNET reset (active low)
> 
> 6 (blue). AdamNET bidirectional serial(inverted from TTL serial)
> 
> So when the AdamNET is reset, the pin 5 goes low briefly, then remains high the 
> rest of the time. 
> 
> 
> 
> The strange thing about this is that although the ATM document mentions the 
> signals several times, it never actually shows the pinout for the AdamNET 
> connector.  I reverse engineered the pin out by taking apart one of my AdamNET 
> keyboards to trace out what the keyboard logic board was up to.  And once I 
> hooked it up to an oscilloscope I found what it was doing exactly.  It is 
> actually pretty similar to i2c 4 wire protocol that I use at work, except that 
> it runs at a fixed baud rate (and is inverted).
> 
> 
> I've been working away on using an Arduino Uno to help be debug the parts of the 
> protocol that are documented and are not documented.  Basically when the Adam 
> boots up, it does a reset, then does a roll call on all of the 15 peripheral 
> IDs, and the ones which respond are set up in EOS for use.
> 
> I'll post more details of the protocol in my next post.  But I have an Arduino 
> Uno "sketch" (small program) that is build on the NewSoftSerial library for 
> listening in on the AdamNET chatter.  It works fairly well, and all of the data 
> shown corresponds perfectly to the spec from the Adam Technical Manual except 
> for the checksum byte at the end of the extended packets.
> 
> I am currently working on a test
 of my understanding by creating a sketch that 
> replaces the AdamNET keyboard, to see if I understand things correctly.  If I 
> get that working, then I'll be one step closer to my goal of an AdamNET/USB 
> gateway device.  It uses an enhanced version of NewSoftSerial that adds the 
> ability to support half-duplex protocols.
> 
> 
> Dale
> _______________________________________________
> Coladam mailing list
> Coladam at adamcon.org
> http://adamcon.org/cgi-bin/mailman/listinfo/coladam
> _______________________________________________
> Coladam mailing list
> Coladam at adamcon.org
> http://adamcon.org/cgi-bin/mailman/listinfo/coladam


More information about the Coladam mailing list