A region of non-volatile memory (doesn't get rewritten when power is removed) is reserved for various status-bytes.

The NVM bit map provides a concise way of storing important information. This is useful for quick & low power radio transmissions conveying state of health info (for example). Using the NVM bits is purely optional. Don't worry about using/maintaining the NVM bit map until you're comfortable with your flight software and ready to start optimizing.

Remember that a byte is made up of 8 bits. Each NVM register holds one byte.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ac65ed6a-ab48-4cf8-8c8a-8b428aa6eb62/bitbyte.png

The decimal number 30 can be represented in hexadecimal as 0x1E and in binary as 00011110. Decimal values great than 255 require two bytes, greater than 65536 require three bytes, etc...


🚩 Flags

A single bit can be used as a "flag" representing a true/flash condition of something. For example, a low battery flag could represent whether or not the spacecraft is low power mode.

🔢 Counters

You can use multiple bits as a compact/concise counter for something you don't want to consume an entire byte.


Manual Operation

To read these status bytes manually from CircuitPython:

from pycubed import cubesat

LOCATION = 0 #-status byte location

VALUE_READ = cubesat.microcontroller.nvm[LOCATION]

To write a status-byte manually from CircuitPython:

from pycubed import cubesat

LOCATION = 0 # status-byte location
VALUE_WRITE = 4 # status-byte value. Must be 0-255

cubesat.microcontroller.nvm[LOCATION] = VALUE_WRITE

There are also built-in methods of retrieving common status-bytes: