HyKim CommsProtocol v2

From Tribotix Wiki

Jump to: navigation, search

[edit] Protocol

HyInt communicates with the Data Acquisition Modules using a 2-wire asynchronous serial channel, the parameters for this serial channel are as follows:

  • Baud Rate: 115200Kb/s,
  • Number of Data bits: 8,
  • Parity: NO,
  • Stop Bits: 1.


The network established between HyInt and the Data Acquisition Modules is a MASTER - SLAVE topology, i.e. all commands are initiated by the MASTER, HyInt, whilst the SLAVE simply responds to these commands. For all commands issued by the MASTER, the Data Acquisition Modules will respond with an ID that is equal to the OPCODE. Please note that the Data Acquisition Modules will not respond to any illegal or corrupt packets.


The packet structure used for commands and responses is shown in the tables below:


Command Packet Structure

Length Value Description
1 <SOH> Packet Start byte
1 <ID> Device ID
2 <LEN> Data length (Not including <OPCODE>, <CRC> and <LEN>)
1 <OPCODE> Operation code
0-1024 <DATA> Data
2 <CRC16 > Two bytes CRC16 checksum


Response Packet Structure

Length Value Description
1 <SOH> Packet Start byte
1 <ID> Device ID (reserved for future usage)
2 <LEN> Data length
1 <Answer ID> Operation code
0-1024 <DATA> Data
2 <CRC16 > Two bytes CRC16 checksum


Definitions:


  • <SOH> = Start byte. (0xFF)
  • <CRC16> is the same which is used by Xmodem/Ymodem, Formula: CRC16 = x^16 + x^12 + x^5 + 1


Example:


Here is an example of the data flow, e.g. sending a ‘Get Distance’ command to head board:

SENDER: <soh> 0x02 0x01 0x00 0x00 – CRC(High) – CRC(Low)
RECEIVER: <soh> 0x02 0x01 0x00 0x04 - data(4bytes)- CRC(High) - CRC(Low)

[edit] Commands

The commands used between HyInt and HySense are very similar to HyKim CommsProtocol v1, but they are slighty different as the number and types of sensors used in v2 of the electronic system differ. This section will be completed very soon.

[edit] Debugging Tips

There is a second Uart port which is used for debug. In normal mode, you can only to see debug information through this Uart. You can also switch it to communication port, by simply type “PC” then Enter in Hyper Terminal. After that you can send command listed in the previous section to the board and even update the firmware image.

Personal tools