Skip to content
UniversalScientificTechnologiesPublic

About

Shared parts between xDOS firmwares

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

xDOS-lib

Shared firmware code for the UST xDOS family of dosimeters (SPACEDOS, AIRDOS, LABDOS, …) running on ATmega1284P with the Arduino core (MightyCore).

The library is meant to hold everything the device firmwares would otherwise copy from each other:

part status
UART → I2C configuration bridge and config mode — lets dosview read and write the device EEPROM and RTC over the data serial line, see docs/CONFIG_BRIDGE.md done
EEPROM configuration record — reading over I2C, CRC check (the same CRC as dosview), format version handling, age of the RTC sync record done
Header of the xDOS data format v2.1 ($DATAFORMAT, $DOS, $ADC, $CALIB, $CHAN, …, $ERROR) from the EEPROM record done
Unix time from a calendar RTC done

The EEPROM record layout itself is not defined here but in xDOS-versions.

Using it in a firmware project

Add both repositories as sibling submodules and let PlatformIO link them:

git submodule add ../xDOS-lib      lib/xDOS-lib
git submodule add ../xDOS-versions lib/xDOS-versions
lib_deps =
  symlink://lib/xDOS-lib
  symlink://lib/xDOS-versions
#include <xdos.h>
#include <xdos_header.h>               // writeHeader(), LineSink
#include <arduino/xdos_eeprom_io.h>    // readRecord(), readSerialNumber()

writeHeader() emits the header line by line into a LineSink the firmware implements (write to the SD card, a serial port, a String, …); the firmware adds its own lines such as $RTCCHK and $TIME after it.

The library does not declare xDOS-versions as a dependency — the firmware project provides it, so both always come from the commits pinned by the firmware.

Command line client

tools/xdos_bridge.py (needs pyserial) switches a device into config mode and runs bridge commands, e.g. reading the EEPROM serial number at 0x5B:

tools/xdos_bridge.py /dev/ttyACM0 I2CWR,5B,0800,10

Tests

Pure logic is tested on the PC. xDOS-versions has to be checked out next to this repository (../xDOS-versions):

pio test -e native
python3 -m unittest discover -s tools

License

GPL-3.0, see LICENSE.

About

Shared parts between xDOS firmwares

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages