Bootloader design - hardware

Bootloader design - software

Program flow

Bootloader detection

  • sensor_pullup_cmd pin is set low
  • delay
  • if sensor_sig voltage > 0.9*Vcc - enter bootloader

Supported commands

Command codes are selected to be hard to be mistaken if software UART reading is started in the middle of bit.

  • Erase (0x81)
    • Application flash, not bootloader
  • Write data (0x82)
    • In 128B chunks
    • CRC32
  • Get information (0x84)
    • 1024B block with CRC
    • Bootloader version
    • Application version (info block in application flash)
    • Chip ID
    • Other bytes reserved (logs?)
  • Run application (0x88)

Bootloader tests

Communication tests

Transmission from device via high side driver

Test is done using circuit below: First test with no serial and parallel resistors. Falling edge is slow and transistor turn off threshold voltage is too high.

  • CH1: HEATER
  • CH2: OUT Second test with Serial 220k and parallel 2k2 resistors.
  • CH1: HEATER
  • CH2: OUT
  • CH3: IN Rise and fall time are ~100us and ~150us. But according to datasheet, they can be as high as 500us.

Reception from USB-UART

Test is done using circuit below: