Skip to content

mysensors/MySensorsBootloaderRF24

Repository files navigation

MYSBootloader 1.3.0-rc.1

MySensors bootloader supporting over-the-air firmware updates

Technical details to write your own controller

All initialization the bootloader does (finding parent / requesting nodeId on first start) uses the same packets as a normal MySensors sketch. There is no need for the controller to distinguish between packets from the bootloader and packets from normal sketch execution. The controller only needs to care about two additional request/response communications. All communication is binary.

FirmwareConfig

  • the bootloader sends a RequestFirmwareConfig packet to the gateway to request information about the firmware it should execute:

    typedef struct {
     uint16_t type;
     uint16_t version;
     uint16_t blocks;
     uint16_t crc;
     uint16_t BLVersion;
    } RequestFirmwareConfig;

  • the gateway (the controller) responds with a NodeFirmwareConfig including details about the firmware the sensor should execute:

    typedef struct {
     uint16_t type;
     uint16_t version;
     uint16_t blocks;
     uint16_t crc;
    } NodeFirmwareConfig;

Firmware

  • the bootloader sends a RequestFirmwareBlock packet to the gateway to request a specific subset (block) of the compiled firmware:

    typedef struct {
     uint16_t type;
     uint16_t version;
     uint16_t block;
    } RequestFirmwareBlock;

  • the gateway (the controller) responds with a ResponseFirmwareBlock including the specific block of the compiled firmware:

    typedef struct {
     uint16_t type;
     uint16_t version;
     uint16_t block;
     uint8_t data[FIRMWARE_BLOCK_SIZE];
    } ResponseFirmwareBlock;