Warning: This site is under construction, most links will be broken.

Open formats -> MICROSE (Microcontroller Serial Bootloader) protocol

Last modified on Fri, 4th Dec 2009 at 22:27 GMT by zipplet

MICROSE (Microcontroller Serial Bootloader) protocol, v1.1
----------------------------------------------------------

Copyright (c) Michael Nixon (Zipplet) 2009.

web: http://www.zipplet.co.uk/, http://www.zipplet.org/
email: zipplet@zipplet.co.uk

1. Introduction
---------------

MICROSE is a packet-oriented communication protocol designed to be implemented
in a bootloader on a PIC microcontroller. The bootloader needs to fit into the
512 byte (256 instruction words) boot block on the microcontroller. This
requirement puts constraints on the complexity of the protocol.

MICROSE uses the concept of packets but at a very simple level. All
communication between the host and device occurs as packets. No out-of-band
communication is supported. No error detection or correction is performed.

2. Packet format
----------------

+--------+----------+--------+-------------------------------------------------+
| Offset | Type     | Length | Description                                     |
+--------+----------+--------+-------------------------------------------------+
|      0 | Byte     | 1      | Command                                         |
|      1 | Byte     | 0+     | Parameter bytes / payload                       |
+--------+----------+--------+-------------------------------------------------+

Payload data can be any size from 0 to 255 bytes. This is determined by the
command. This differs to MISE, where the payload size is transmitted before
the payload allowing an arbitary payload size with any command.

3. Hello command (special case)
-------------------------------

The hello packet is a special case. $FF+$EE is transmitted before the packet
but NOT expected on the reply.

5. Commands
-----------

--------------------------------------------------------------------------------
$A5, MICROSE_HELLO - Bootloader 'hello'
Parameters: None
The device sends this to the host when the bootloader starts. The bootloader
then waits 500ms for an identical ($00) response command. If the bootloader does
not receive an identical response, it will time out and start user code.

--------------------------------------------------------------------------------
$01, MICROSE_DEVICESIZE - Device->Host, device size
Parameters: Unsigned Word=Device size in blocks, Byte=Version major, Byte=Version minor
Data size in blocks and bootloader version. Sent after a successful HELLO exchange

--------------------------------------------------------------------------------
$03, MICROSE_ERASEBLOCK - Host->Device, erase flash block
Parameters: Unsigned 24 bit=address
The address must be a multiple of 64 bytes and not before address 512.
Tells the device to erase a 64-byte block of flash memory. You must wait for an
acknowledgement packet (MICROSE_ERASEBLOCKDONE) before sending any more bytes
to the device.

--------------------------------------------------------------------------------
$04, MICROSE_ERASEBLOCKDONE - Device->Host, erase flash block complete
Parameters: None
Tells the host that the last MICROSE_ERASEBLOCK command has completed.

--------------------------------------------------------------------------------
$05, MICROSE_WRITEBLOCK - Host->Device, write flash block
Parameters: Unsigned 24 bit=address, 64 bytes=Data to write
The address must be a multiple of 64 bytes and not before address 512.
Tells the device to write a 64-byte block of flash memory. You must wait for an
acknowledgement packet (MICROSE_WRITEBLOCKDONE) before sending any more bytes
to the device.

--------------------------------------------------------------------------------
$06, MICROSE_WRITEBLOCKDONE - Device->Host, write flash block complete
Parameters: None
Tells the host that the last MICROSE_WRITEBLOCK command has completed.

--------------------------------------------------------------------------------
$07, MICROSE_READBLOCK - Host->Device, read flash block
Parameters: Unsigned 24 bit=address
The address must be a multiple of 64 bytes and not before address 512.
Tells the device to read a 64-byte block of flash memory. You must wait for an
acknowledgement packet (MICROSE_READBLOCKDATA) before sending any more bytes
to the device.

--------------------------------------------------------------------------------
$08, MICROSE_READBLOCKDATA - Device->Host, read flash block data
Parameters: 64 bytes=Data read
The data that was read in response to a MICROSE_READBLOCK command

--------------------------------------------------------------------------------
$09, MICROSE_ERASEEEPROM - Host->Device, erase data EEPROM
Parameters: None
Causes the device to erase the data EEPROM (changes it all to $FF).
You must wait for an acknowledgement packet (MICROSE_ERASEEEPROMDONE) before
sending any more bytes to the device.

--------------------------------------------------------------------------------
$0A, MICROSE_ERASEEEPROMDONE - Device->Host, erase data EEPROM complete
Parameters: None
Tells the host that the last MICROSE_ERASEEEPROM command has completed.

--------------------------------------------------------------------------------
$0B, MICROSE_USERCODE - Jump to user code
Parameters: None
Tells the device to exit bootloader mode and start executing user code.