To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 2123
2122  |  2124
Subject: 
Re: Downloading Firmware to RCX
Newsgroups: 
lugnet.robotics
Date: 
Sat, 2 Jan 1999 03:05:55 GMT
Reply-To: 
lego-robotics@crynwr.[antispam]com
Viewed: 
1536 times
  
Peter Hesketh <lego-robotics@crynwr.com> wrote:
Is there a description anywhere of the RCX firmware download protocol in
plain English or in pseudocode?  I am trying to write a QBasic program
to do it.  I have looked at firmdl.txt and dltrace.txt but my knowledge
of C is not sufficient to work out what is required.

Does QBasic let you use spirit.ocx?  If so, that is by far the easiest way
to write code to download the firmware.  If not, here is an explantion of
the download process:

I assume you know the basic packet protocol.  If not, it was described by
Dave Baum, you can see his description here:

   http://graphics.stanford.edu/~kekoa/rcx/protocol.html

Step 1: Read in the s-record file

   See http://graphics.stanford.edu/~kekoa/rcx/s-record.txt for a
   description of the format that somebody else wrote up.

   After this, you should have an image with a starting address and an
   ending address.

   If you like, search from the ending address backward until you find the
   first non-zero byte, and make that the new ending address.  This is not
   entirely legal, because maybe that data was supposed to be set to zero,
   but it speeds downloading, and it works with the supplied Firm0309.lgo.

Step 2: Find the checksum of the image

   Add up the bytes between the starting and ending address.  You checksum
   should be an unsigned short.  A short has 16 bits.

Step 3: Send a delete firmware message

   In hex, the data in the message should be:

      65 01 03 05 07 0b

   You need to supply the header, complement, and checksum bytes.

Step 4: Send a start firmware download message

   In hex, the data in the message should be:

      75 00 80 cc dd 00

   cc is the most significant byte of the image checksum
   dd is the least significant byte of the image checksum

Step 5: Send the image data using transfer data messages

   Break up the image into 200 byte chunks.

   Loop over the chunks.  Compute the checksum for the current chunk by
   adding up the bytes of the current chunk.  This checksum should be a
   byte, not a short.

   For each chunk, send a message with the following data (in hex):

      xx aa bb cc dd databytes ee

   xx is the message opcode
   aa is the most significant byte of the index of this chunk
   bb is the least significant byte of the index of this chunk
   cc is the most significant byte of the size of this chunk
   dd is the least significant byte of the size of this chunk
   databytes are the data bytes in this chunk
   ee is the checksum byte of this chunk

   The opcode should alternate between 45 and 4d with every other chunk
   The index should start at 1 and increase by 1 with each successive chunk
   The last chunk should have an index of 0

Step 6: Send an unlock firmware message

   In hex, the data in the message should be:

      a5 4c 45 47 4f ae

That's it.

Sending messages is non-trivial.  First you have to configure the serial
port.  Then, when you send a message by writing data to the serial port,
you have to wait for a proper reply to make sure the rcx received it.  If
you do not receive a proper reply, send the exact same message again until
you do hear a proper reply.

For more information on messages and the serial protocol, see:

   http://graphics.stanford.edu/~kekoa/rcx/#Serial
   http://graphics.stanford.edu/~kekoa/rcx/opcodes.html

With all of this in mind, the following download trace should make sense:

   http://www.crynwr.com/lego-robotics/trace1.txt

A few things to note about the trace:

   - opcodes alternate between having the 0x08 bit set and clear
   - the apparent RCX echo is really the caused by the IR tower
   - the trace includes some extra commands (10,18) that aren't strictly needed

Hope this helps,

-Kekoa



Message has 4 Replies:
  Re: Downloading Firmware to RCX
 
In article <F4wwLv.DwC@lugnet.com>, Kekoa Proudfoot <lugnet.robotics@lugnet.com> writes (...) Unfortunately, Spirit.ocx needs Windows 95. It will not work with W3.1. let alone DOS, so QBasic (for DOS applications) cannot use it. (...) Thank you very (...) (26 years ago, 2-Jan-99, to lugnet.robotics)
  Re: Downloading Firmware to RCX
 
(...) Ooops. Switch most and least, above. (...) And again, twice. -Kekoa (26 years ago, 2-Jan-99, to lugnet.robotics)
  Re: Downloading Firmware to RCX
 
In article <F4wwLv.DwC@lugnet.com>, Kekoa Proudfoot <lugnet.robotics@lugnet.com> writes [snip] (...) [snip] Are you sure you have cc and dd the right way round? I have calculated the sumcheck to be &HC278, so your example above should read 75 00 80 (...) (26 years ago, 2-Jan-99, to lugnet.robotics)
  Re: Downloading Firmware to RCX
 
In article <F4wwLv.DwC@lugnet.com>, Kekoa Proudfoot <lugnet.robotics@lugnet.com> writes (...) way (...) of (...) [snip excellent description] At long last I have done it! While recovering from an illness I have managed to get it going - thanks for (...) (26 years ago, 14-Apr-99, to lugnet.robotics)

Message is in Reply To:
  Downloading Firmware to RCX
 
Is there a description anywhere of the RCX firmware download protocol in plain English or in pseudocode? I am trying to write a QBasic program to do it. I have looked at firmdl.txt and dltrace.txt but my knowledge of C is not sufficient to work out (...) (26 years ago, 2-Jan-99, to lugnet.robotics)

6 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR