CCC Serial Interface
Introduction
This is a protocol to interface RS232 to an A6 D8 bus SLOWLY!
It is designed to be as lightweight as possible, so no extra commands
etc will be added.
Serial Port Settings
- 115200 BAUD, no parity, 1 stop bit, no flow control.
NOTE, the BAUD rate is derived from the clock, so using an external clock with a different frequency will change the BAUD rate!
Protocol
- Data arranged in 2 byte messages: 1 byte op-code, 1 byte data
- A message sent always generates a message reply : But keep in mind a message sent could reset the board and hence will not generate a reply
- No timeouts, but no error conditions either. A command works, or it doesn't, this code does not care.
Message Format
Bit |
Description |
Byte 0 |
7 |
0= Message, 1= Reply. All messages acknowledge with a reply |
6 |
Write/(not Read) to register |
5:0 |
Address of register |
Byte 1 |
7:0 |
Byte of data for writing, reply contains data read |
TX Message
|
Bit |
Byte |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
0 |
0 |
WR/nRD |
0 |
0 |
ADDR (3:0) |
1 |
DATA(7:0) |
RX Message
|
Bit |
Byte |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
0 |
1 |
Same as TX Message |
1 |
Data (as read, as sent or ack-code) |
e.g.
For a TX of 0x00,0x00 (TX, Read, 2b00, Addr=0, Data = [don't care])
We see RX of 0x80,0xA1 (RX, Read, 2b00, Addr=0, Data = 0xA1)
TX=0x49,0x45 (TX, Write, 2b00, Addr=9, Data = 0x45)
RX=0xC9,0xFF (RX, Write, 2b00 Addr=9, Data = 0xFF)
Test Software
Some Python code was used to test the system is
attached. [Note: the .txt at the end of the filename should be removed]. It uses a serial library from
pyserial.sourceforge.net.
Change Log:
17/11/08 |
This doc re-born from the ashes of SerIFace (serial interface for CERC) |
22/01/09 |
Wikirisation! Document moved here (from ~warren/ccc/docs/SerialInterface.txt) |
03/04/09 |
Updated register list to reflect current firmware |
06/04/09 |
Reduced address space to 4 bit |
07/04/09 |
Moved register list to CCCRegisterList |
09/12/09 |
Added Python test code |
--
MattWarren - 22 Jan 2009