This is the revision C version of the SerialHost1 module.
The SerialHost1 module connects to both a RoboBricks2 bus and host computer via a serial port.
There are two supported modes -- terminal mode and host mode. In terminal mode, it is anticipated that the user will be talking to the SerialHost1 module via a terminal emulator such as HyperTerminal on Windows® or MiniCom on Linux®. In host mode, it is expected that the use will be using a custom program that opens a serial connection to the SerialHost1 module.
All terminal mode programs have the most significant bit cleared (i.e. plain ASCII) and all of the host commands start with the most significant bit set. This is summarized in the table below:
Bit Mode 7 6 5 4 3 2 1 0 0 x x x x x x x Terminal Command 1 x x x x x x x Host Command
Both terminal mode and host mode are discussed in separate sections below.
Terminal Mode supports the following commands:
Command Response Description A ii nn rr Programm the module with an id of ii set the node address nn. The response code rr is printed. B rr rr (Does not do anything useful right now.) C Send the bus clear command out. This resets all of the modules on the bus into passive mode. (Currently, does nothing.) D rr Deselect the currently selected node. The response code rr is printed. F aa bb cc ... Flush any unprocessed bytes out of the receive buffer. I Indentification information Print out the identification for the currently selected node. J aaaa Jump into the code of the currently selected processor at aaaa. P pp aaaa: bbcc ddee ffgg ... Print page pp from the currently selected processor. R aaaa vv Read the byte at aaaa and print out as vv. (not implemented.) S nn rr Select node nn and print response rr. If no node responds, '@' is printed. T ?? Test mode. (Unclear what this does??!!) W aaaa vv aaaa vv Write vv to aaaa (Not working) X xx rr Transmit byte xx to the currently selected node. The response byte rr is printed. If no response is received, '@' is printed. Z Identification for all modules. Sweep the bus and identify all modules plugged into the bus. :xx... Program one line of Intel hex file into currently selected processor. (Not implemnted)
When the SerialHost1 module is in host mode it can either be in master mode or slave mode. In master mode, it is control of the bus, it can select and deselect modules, send command bytes, and receive response bytes. In slave mode, it basically just forwards command bytes to the host so it can respond.
Command
NameBit Direction When Description 7 6 5 4 3 2 1 0 High5 Set 1 0 0 h h h h h Send Always Set high order 5 bits of send byte to hhhhh. Low4 Send 1 0 1 0 l l l l Send Always Set low order 4 bits of send byte to llll and then send byte. Receive5 1 0 1 1 0 0 0 0 Send Always Read up to 5 bytes from receive buffer. vwxyz are the 9th bits of the 5 bytes. ccc is the count of the number of bytes being returned (i.e. a number between 0 and 5.) v aaaa aaaa, w bbbb bbbb, x cccc cccc, y dddd dddd, and z eeee eeee are the 5 returned bytes (including 9th bit.) v w x y z c c c Receive Always a a a a a a a a Receive ccc ≥ 1 b b b b b b b b Receive ccc ≥ 2 c c c c c c c c Receive ccc ≥ 3 d d d d d d d d Receive ccc ≥ 4 e e e e e e e e Receive ccc ≥ 5
There are two PIC16F688 microcontrollers on the SerialHost1 module. One microctonroller is called the host processor since it is permanently attached to the host computer via the MAX232 RS-232 voltage level conveter. The other microcontroller is permanently attached the to RoboBricks2 bus and is called the bus processor. There are seven wires that are connected between the processors This section documents the data communication protocol between the two processors.
The seven wires between the two processors are labeled P6 through P0 as summarized in the table below:
Since the bus microcontroller needs to be able to generate a reset signal on N2, RA2 is used this purpose. Since RA2 is not avaiable for the interprocessor communciation, RA3 is used instead. The problem with RA3 is that it is an input only pin.
Label Host Pin Bus Pin Use Direction P6 RA2 RA3 Handshake Host to Bus P5 RA1 RA1 Handshake Bus to Host P4 RA0 RA0 Strobe Host to Bus P3 RC3 RC3 Data Host to Bus P2 RC2 RC2 Data Host to Bus P1 RC1 RC1 Data Bus to Host P0 RC0 RC0 Data Bus to Host
The host processor is always in controlling the data exchanges between the two processors. Basically data is extanged between the two processors two bits at a time. P3:2 are used to send data from the host processor to the bus processor. P1:0 are used to send data from the bus processor to the host processor. P4 is used to indicate that a command needs to be processed. P6:5 are used for handshaking between the two processors to synchronize data transfer.
The handshaking works as follows:
Currently there are only three commands that the host processor can issue and they are summarized in the table below:
Host Sends Bus Returns Description 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 0 s s s s s s s s s Send s ssss ssss out to the bus 1 0 e r r r r r r r r r Receive r rrrr rrrr from bus. e is 1 if no receive byte is present. 1 1 Strobe reset line on N3.
The hardware consists of a circuit schematic and a printed circuit board.
The schematic for the SerialHost1 module is shown below:
The parts list kept in a separate file -- serialhost1.ptl.
The printed circuit board files are listed below:
- serialhost1_back.png
- The solder side layer.
- serialhost1_front.png
- The component side layer.
- serialhost1_artwork.png
- The artwork layer.
- serialhost1.gbl
- The RS-274X "Gerber" back (solder side) layer.
- serialhost1.gtl
- The RS-274X "Gerber" top (component side) layer.
- serialhost1.gal
- The RS-274X "Gerber" artwork layer.
- serialhost1.gml
- The RS-274X "Gerber" mask layer.
- serialhost1.drl
- The "Excellon" NC drill file.
- serialhost1.tol
- The "Excellon" tool rack file.
The cable information can be found in the DB9RJ11 Module.
There are two sets of firmware available for the SerialHost1 module.
The host firmware is available in the following files:
- host.ucl
- The µCL source code for the Host module.
- host.asm
- The Host module assembly code file.
- host.lst
- The Host module listing file.
- host.hex
- The µCL SerialHost1 Intel® Hex file.
The bus firmware is available in the following files:
- bus.ucl
- The µCL source code for the Bus module.
- bus.asm
- The Bus module assembly code file.
- bus.lst
- The Bus module listing file.
- bus.hex
- The µCL SerialHost1 Intel® Hex file.
Any issues that come are are to be listed below.