From 0c2361bbd0a113414c9323f70a3088963aea11a7 Mon Sep 17 00:00:00 2001 From: ryanpdx Date: Sun, 26 Nov 2023 15:17:02 -0800 Subject: [PATCH] add doc about setting the node ids --- doc/setting_node_ids.md | 145 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 doc/setting_node_ids.md diff --git a/doc/setting_node_ids.md b/doc/setting_node_ids.md new file mode 100644 index 00000000..f057ff0c --- /dev/null +++ b/doc/setting_node_ids.md @@ -0,0 +1,145 @@ +# Manually Setting Node IDs + +## Background + +This references the [STM32F09x Reference Manual]. + +In the code, in `oresat-firmware/common/oresat.c`, is: + +```c +node_id = ((FLASH->OBR & FLASH_OBR_DATA0_Msk) >> FLASH_OBR_DATA0_Pos) +``` + +We store the Node IDs in the "Flash Option Byte Register" (See RM00091 Reference +Manual - 3.5.7 Flash Option byte register (FLASH_OBR)). + +According to "2.2.2 Memory map and register boundary addresses": the base +address for the FLASH registers is 0x40022000 - 0x400223FF (1 KB) = FLASH +interface + +According to "3.5.9 Flash register map", FLASH_OBR is offset 0x1C which is the +Option Byte Register. +Inside that 32 bit word, we want the 3rd byte which is "DATA0". + +In `oresat-firmware/ext/ChibiOS/os/common/ext/ST/STM32F0xx/stm32f091xc.h` are +these definitions: + +```c +__IO uint32_t OBR; /*!