MSB2 Firmware: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 31: | Line 31: | ||
|style="width:35px"| '!' || 0x21 || colspan="10" style="background:#ABCDEF;" | Command and arguments | |style="width:35px"| '!' || 0x21 || colspan="10" style="background:#ABCDEF;" | Command and arguments | ||
|} | |} | ||
<b>Note: '!' is a reserved character and may not be used as an argument for any command. In cases where '!' may be a possible arguments other means of | <b>Note: '!' is a reserved character and may not be used as an argument for any command. In cases where '!' may be a possible arguments other means of indicating this value have been added.</b> | ||
<br> | <br> | ||
</ul> | </ul> | ||
Line 37: | Line 37: | ||
=== Packet format (from the MSB Firmware) === | === Packet format (from the MSB Firmware) === | ||
<ul> | <ul> | ||
All MSB firmware responses will be sent back as packets that begin with 2 characters '#' followed by '|', then an identifier byte | All MSB firmware responses will be sent back as packets that begin with 2 characters '#' followed by '|', then an identifier byte describing what the packet is and how it should be interpreted. | ||
{| class="wikitable" style="text-align:center" | {| class="wikitable" style="text-align:center" | ||
!colspan="2" style="width:70px" | Byte 0 !! colspan="2" style="width:70px" | Byte 1 !! colspan="2" style="width:70px" | Byte 3 | !colspan="2" style="width:70px" | Byte 0 !! colspan="2" style="width:70px" | Byte 1 !! colspan="2" style="width:70px" | Byte 3 | ||
Line 47: | Line 47: | ||
=== Example Communication Sequence === | === Example Communication Sequence === | ||
<ul> | <ul> | ||
Here's an example of what a host computer would send to query the state of the LED and what it would | Here's an example of what a host computer would send to query the state of the LED and what it would receive from the MSB: | ||
<br><br> | <br><br> | ||
'''Host sends:''' '!query' + 0x10 [query command + 0x10 to indicate a LED query] | '''Host sends:''' '!query' + 0x10 [query command + 0x10 to indicate a LED query] |
Revision as of 01:06, 25 March 2007
Overview
The MSB2 and LSB both use the same firmware core with custom modifications to support the sensors and other subsystems specific to each platform. The goals of the firmware are:
- Encapsulate all low level functions in easily accessible commands
- Hides all startup/initialization routines
- Provide a variable sampling schedule (with some constraints) that automatically handles powering off unused sensors
- Provide commands for accessing calibration and other sensor metadata
- Sample and send data via a hi-speed binary uart interface
- Communicates with any embedded platform
- Communicates with any desktop/laptop/handheld/cell phone with a available uart port
State Diagram
The system has two main states, the default wait state and the running state. The other states are used for setting up various components of the system. Once everything is working; however, the user simply enters the running state and begins recording data.
Communication protocol
Communication with the MSB Firmware takes place over the first uart on the atmel, at 921,600 baud, with an option of having flow control.
Commands
-
Commands are 6-character sequences where '!' (hex 0x21) indicates the start of a command. If you make a mistake when sending a command you can send another '!' this resets the internal parser which will then wait for your 5-character command.
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|
'!' | 0x21 | Command and arguments |
Note: '!' is a reserved character and may not be used as an argument for any command. In cases where '!' may be a possible arguments other means of indicating this value have been added.
Packet format (from the MSB Firmware)
-
All MSB firmware responses will be sent back as packets that begin with 2 characters '#' followed by '|', then an identifier byte describing what the packet is and how it should be interpreted.
Byte 0 | Byte 1 | Byte 3 | |||
---|---|---|---|---|---|
'#' | 0x23 | '|' | 0x7C | ID |
Example Communication Sequence
-
Here's an example of what a host computer would send to query the state of the LED and what it would receive from the MSB:
Host sends: '!query' + 0x10 [query command + 0x10 to indicate a LED query]
Byte 0 | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
'!' | 0x21 | 'q' | 0x71 | 'u' | 0x75 | 'e' | 0x65 | 'r' | 0x72 | 'y' | 0x79 | 0x10 |
MSB Firmware responds with: ['#|' start header + 0x10 to indicate a LED packet and 0x00 the current state of the LEDs
Byte 0 | Byte 1 | Byte 2 | Byte 3 | ||||
---|---|---|---|---|---|---|---|
'#' | 0x23 | '|' | 0x7C | 0x10 | 0 | 0x00 |