Project

General

Profile

Reprogram
This page explains how to use the network programming tool to reprogram a toolbox. This can usually be done remotely, but requires the toolbox in question to have a working bootloader.

Note: the dollar signs in the code formatted stuff below just represent the bash prompt. Don't actually type $ before your commands

Figure out why you need to repgoram

There are two different kinds of reprogramming. The normal and intended use can be done remotely and is used if you want to change the code on a working toolbox for any reason (change the timeouts, new features, bufixes to toolbox code, etc). This can be done using the steps bellow, without steps 7 and 8.

If you have a problem where all 3 lights are on, this means that something with the flash is screwy and the board is constantly resetting. In this case, you can force it to enter bootloader mode using step 7.

If there is a bug in the code or something that makes the toolbox get in a "stuck" state (no lights on, or maybe some lights but no response to ping), you can force the bootloader to accept a program with step 8. This will work as long as the bootloader itself is not corrupt.

Procedure

  1. Log in to the server
    $ssh rc99@doom.frc.ri.cmu.edu
    password i...
  2. $cd officers/tooltron/trunk/cardbox
  3. Edit main.c and check that the defines near the top match the ones on the Machines page (type nano main.c if you don't have a preferred command line editor)
  4. Save main.c and compile by typing $make clean all
  5. $cd ../programmer
  6. Use netprog to program the toolbox:
    usage: netprog.py /path/to/bus/device toolnum binaryfile
    • The path to bus device is best found by typing /dev/ttyU and pressing tab a bunch of times (it should be /dev/ttyUSB0 or /dev/ttyUSB1). If that fails, do @$ls /dev/ttyU*$ and see which one shows up (1 or 2) then type that one manually
    • The toolnum is the internal tool id number, listed several places including the Machines page. Note that this is NOT the keypad number (i.e. 1-6)
    • binaryfile is ../toolbox/main.hex which is the file you just compiled
    • For example, if you were reprogramming tool 13 and the usb device was /dev/ttyUSB0, you would type:
      $./netprog /dev/ttyUSB0 13 ../main.hex
  7. (In case of 3 light problem, see above) hold both buttons on the toolbox immediately after running the above command. This puts the toolbox in bootloader mode in case it has a bad program flash and is resetting
  8. (In case of other problem) hold both buttons with the plug removed. Then run the above command, with the buttons held, and immediately plug in the plug. This forces the bootloader into the mode where it will accept a new program

At this point you should see a ton of text with lots of numbers fly by. If you do, you should be ready to go (test using Manualtron). If you don't see that, either the bootloader or the EEPROM is bad, which means you should run the Ping_Test