Debug

Jim

Debug

The lack of memory (32KB for the program) limits the debugging that can be added to the code and the long running of the device during a typical collection phase (over a week) limits how the device can be debugged and the amount of debug data that can be captured and sensibly filtered.
Currently the code uses a combination of LED colours (when in debug mode) and the output of simple string tokens via either serial communications or stored in the Nand flash along with the sample data.

The LED colours are configured with the following meanings:

  • fast flashing blue led – the Bioband is carrying out data transfer or data collection
  • flashing green led – the Bioband is in the configuration (receive action) state
  • flashing red led – the Bioband is awaiting for a connection to be established to the device
  • flashing purplish blue (red & blue LEDs) – the Bioband is in the standby for collect state
  • constant white light – the device has hit an exception, programming error

Through out the code, points of interest are logged using the following api:
writeStr(const char* dbg_txt)
writeHex8(uint8_t n)
writeHex16(uint16_t n)
writeHex32(uint32_t n)

The debug data is either transferred to a connected PC via serial or held in a circular buffer and later transferred to the debug field in the spare area of the Nand flash page.

The circular buffer is read and used to fill the debug field upon the current sample page being written to Nand flash. A circular buffer is used as there may be a difference between the rates of production and consumption. The circular buffer allows the flow to be controlled or in the extreme case, debug data to be ignored, if the buffer is full due to production outweighing consumption (a tilda ~ character is used to mark in the debug data when overflow has occurred).

The debug buffer is held in the processor's memory, as such it does not retain debug data across a processor reset. A useful future optimisation may be to store the debug codes to flash as they occur rather than when a page of samples is ready to be written.


Related

Home: Implementation