Haskino Protocol Definition - ku-fpg/haskino GitHub Wiki
Haskino Firmware Protocol Definition
General Frame Format
The Haskino Firmware protocol uses the following frame format for messages
between the host computer and the Arduino:
Frame Flag |
Command Type |
Command Bytes |
Checksum |
Frame Flag |
0x7E |
0xXX |
0xXX .. 0xXX |
0xXX |
0x7E |
The frame flag at the start of the frame is optional, but may be used on the
first frame to clear any partial frames that may have been left over from
a previous conection. The checksum used is a simple additive checksum over the
Command Type byte and the Command bytes (the entire frame except for the
frame flags and the checksum itself). The checksum is also calculated over
the original frame, and does not include escape characters. A checksum
calculation was chosen over a CRC due to limited storage and processing power
on the Arduino, and the low noise environment of the USB serial connection from
the host to the board. The checksum is mainly used to detect partial frames that
might be left over by an interrupted communications.
If the body of the frame contains any Frame Flag (0x7E) characters they are
escaped by transforming them into a Frame Escape character (0x7D) and the
Frame Flag xor'ed with 0x20 (which results in a two byte sequence of 0x7D 5E).
If the Frame Escape character appears in the body, it is also escape, replaced
with a Frame Escape followed by the Escape xor'ed with 0x20, resulting in a
two byte sequence of (0x7D 0x5D).
Command Type
Board Control Commands (0x2x)
https://github.com/ku-fpg/haskino/wiki/Board-Control-Commands
Command Type |
Command Name |
Command Description |
0x10 |
Set Pin Mode |
Set the Pin Mode (INPUT/OUTPUT/INPUT_PULLUP of a pin) |
0x11 |
Delay Milliseconds |
Delay by a number of milliseconds |
0x12 |
Delay Microseconds |
Delay by a number of microseconds |
0x13 |
System Reset |
Command a reset of the board |
Board Status Commands (0x2x)
https://github.com/ku-fpg/haskino/wiki/Board-Status-Commands
Command Type |
Command Name |
Command Description |
0x20 |
Request Version |
Request the Haskino Firmware version from the board |
0x21 |
Request Type |
Request the type of Arduino board from the board |
0x22 |
Request Micros |
Request the number of microseconds elapsed since reboot of the board |
0x23 |
Request Millis |
Request the number of milliseconds elapsed since reboot of the board |
0x28 |
Response Version |
Response from board with the Haskino Firmware version |
0x29 |
Response Type |
Response from board with the type of Arduino board |
0x2A |
Response Micros |
Response from board with the number of microseconds elapsed since reboot of the board |
0x2B |
Response Millis |
Response from board with the number of milliseconds elapsed since reboot of the board |
0x2C |
Response String |
Response from the board with a string (Useful for debuging of the firmware code |
Digital Commands (0x3x)
https://github.com/ku-fpg/haskino/wiki/Digital-Commands
Command Type |
Command Name |
Command Description |
0x30 |
Digital Read Pin |
Request a read of the digital pin |
0x31 |
Digital Write Pin |
Write a digital value to a pin |
0x32 |
Response Digital Read Pin |
Response with the digital value of a pin |
Analog Commands (0x4x)
https://github.com/ku-fpg/haskino/wiki/Analog-Commands
Command Type |
Command Name |
Command Description |
0x40 |
Analog Read |
Request a read of the digital pin |
0x41 |
Analog Write |
Write a digital value to a pin |
0x42 |
Tone |
Output a tone on a pin of specified frequency and optionally duration |
0x43 |
NoTone |
Stop tone output on a pin |
0x48 |
Response Analog Read |
Response with the analog value of a pin |
I2C Commands (0x5x)
https://github.com/ku-fpg/haskino/wiki/I2C-Commands
Command Type |
Command Name |
Command Description |
0x50 |
I2C Read |
Request a read of bytes from an I2C device |
0x51 |
I2C Write |
Write bytes to an I2C device |
0x58 |
Response I2C Read |
Response with the values from an I2C device |
One Wire Commands (0x6x)
Command Type |
Command Name |
Command Description |
0x6x |
TBD |
|
Servo Commands (0x8x)
Command Type |
Command Name |
Command Description |
0x8x |
TBD |
|
Stepper Commands (0x9x)
Command Type |
Command Name |
Command Description |
0x9x |
TBD |
|
Scheduler Commands (0xAx)
https://github.com/ku-fpg/haskino/wiki/Scheduler-Commands
Command Type |
Command Name |
Command Description |
0xA0 |
Create Task |
Create a scheduler task |
0xA1 |
Delete Task |
Delete a scheduler task |
0xA2 |
Add To Task |
Add commands to a scheduler task |
0xA3 |
Schedule Task |
Schedule a task for execution |
0xA4 |
Query Task |
Query a Task stats |
0xA5 |
Query All Tasks |
Query for a list of tasks |
0xA6 |
Reset Scheduler |
Reset scheduler, deleting all tasks |
0xA8 |
Response Query Task |
Response with status of a task |
0xA9 |
Response Query All Tasks |
Response with a list of tasks |