Documentation for Firmware D, version 1.4.3 for UBW Boards
Back to main UBW page

Note 1: SparkFun is shipping Firmware D version 1.1 on their UBW boards.
This means that if you buy a UBW board from Spark Fun, you will get a board with Firmware D version 1.1 on it. If you want version 1.4.3 (described on this page) you will need to get the FW D v1.4.3 hex file here and then upgrade your UBW as described here. (It is a very easy procedure.)

Note 2: SparkFun has recently changed to shipping Firmware D version 1.4.1 on their UBW boards. I'm not exactly sure when this cutover happened, but you can always use the "V" command to find out which version your UBW has. If you look at the orange (yellow) LED, and it is blinking long-short-long-short-long then you have version 1.4.1 or higher.

Description:
Firmware version D is a more advanced (and more complicated) firmware version than Firmware C. Whereas C just allows you to write out 8 bits at a time to Port B, Firmware D allows you to use every one of the 19 I/O pins on the UBW Board as an input or an output, and to read the state of every one of those pins. In order to do this, it has an actual command structure that must be followed when communicating with it.

Version Notes:
Commands:
    Notes for ALL commands:

    The "C" Command:

    The "O" Command:
    The "I" Command
    The "V" Command
    The "R" Command
   The "T" Command
   The "A" Command
   The "MR" Command    The "MW" Command    The "PD" Command    The "PI" Command
   The "PO" Command     The "CU" Command
<Parameter>
<Value>
<Value> meaning
1
0 or 1
0 = Turn off "OK" packets
1 = Turn on "OK" packets (default)

    The "RC" Command     Binary Output Commands
      
The "BC", "BO" and "BS" commands all work together to allow for high speed parallel output to a hardware device like an LCD panel or other latched 8-bit parallel interface. The basic idea is to take a byte, write it out to PortB, set a strobe bit on PortA, wait a bit, then clear the strobe bit on PortA, then wait for a busy bit to go high (or low) on PortA, then wait for the busy bit to go low (or high) on PortA and then repeat for as many bytes as there are to send out PortB. So PortB is used as the output to the parallel bus and two bits on PortA are used as a strobe bit (output) and a busy bit (input).

       The BC command sets up all of the parameters, and then the BO or BS commands stream the data out PortB. Before this scheme will be very successful, make sure to set the direction bits on PortB and PortA properly.

    The "BC" Command
    The "BO" Command     The "BS" Command
NOTE: (09/18/08) Greg Corson has pointed out a serious bug in this command in Firmware D 1.4.3. If you send any <CR> or <LF> bytes in the binary data section of them command, they get eaten by the command processing fuctions, and don't make it out to the I/O pins! This will get fixed in a future version.
Errors Messages: (NOTE - New for version 1.4.0)

The error messages returned by version 1.4.0 and up are totally different from those in previous versions. One of the changes in 1.4.0 is that code within the UBW can now use printf() (and associated functions) to send bytes back to the PC. This makes complex error reporting _much_ easier.
   
There are two (or more) scenarios that one might use a UBW:
  1. By typing commands into a terminal emulator on a computer, to 'test out' commands and how the system is working.
  2. By writing a computer program that will automatically generate commands to send to a UBW.
The long error messages are very useful for debugging the system, and especially when using the UBW by hand from a terminal emulator. The long messages are not as useful when running under scenario 2) above, as the PC application has a much harder time parsing the long error messages.

To help make the error messages useful in both scenarios, each error message starts out with an exclamation mark "!" and then is immediately followed by an integer error number, then a space, and then the long text of the error message with a <CR><LF> at the end. This means that if your PC application wants to parse the error message, it can look in the data coming back from the UBW for the exclamation mark "!" and then read in the error number and ignore everything else until the next <CR><LF>.

Error Message List:
Latest Version (1.4.3) Files:
    ZIP file of all project and source files necessary to build 1.4.3 here.
    FW D v1.4.3 HEX here (for programming a UBW)
    Browse the FW D 1.4.3 build files here



Back to main UBW page
Questions? E-mail me at my e-mail address