diff options
author | hauptmech <hauptmech@gmail.com> | 2015-01-19 16:50:52 +1300 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-01-28 10:20:19 +0100 |
commit | 5444972347606333dd61206011263e4a2e5d83e8 (patch) | |
tree | d309fda7ba918708f5dfbff285cb29bd5ee1d08e /src/modules/systemlib/mcu_version.c | |
parent | 4dd06c4c7368e14ae0c5119321095236f7d13fd4 (diff) | |
download | px4-firmware-5444972347606333dd61206011263e4a2e5d83e8.tar.gz px4-firmware-5444972347606333dd61206011263e4a2e5d83e8.tar.bz2 px4-firmware-5444972347606333dd61206011263e4a2e5d83e8.zip |
Add call to access the mcu unique id. Expose via the 'ver' command.
This is prep for verifying calibration parameters against the hardware they were gathered on.
Diffstat (limited to 'src/modules/systemlib/mcu_version.c')
-rw-r--r-- | src/modules/systemlib/mcu_version.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/modules/systemlib/mcu_version.c b/src/modules/systemlib/mcu_version.c index 4bcf95784..24f4e4207 100644 --- a/src/modules/systemlib/mcu_version.c +++ b/src/modules/systemlib/mcu_version.c @@ -47,7 +47,8 @@ #ifdef CONFIG_ARCH_CHIP_STM32 #include <up_arch.h> -#define DBGMCU_IDCODE 0xE0042000 +#define DBGMCU_IDCODE 0xE0042000 //STM DocID018909 Rev 8 Sect 38.18 (MCU device ID code) +#define UNIQUE_ID 0x1FFF7A10 //STM DocID018909 Rev 8 Sect 39.1 (Unique device ID Register) #define STM32F40x_41x 0x413 #define STM32F42x_43x 0x419 @@ -57,7 +58,13 @@ #endif - +/** Copy the 96bit MCU Unique ID into the provided pointer */ +void mcu_unique_id(uint32_t *uid_96_bit) +{ + uid_96_bit[0] = getreg32(UNIQUE_ID); + uid_96_bit[1] = getreg32(UNIQUE_ID+4); + uid_96_bit[2] = getreg32(UNIQUE_ID+8); +} int mcu_version(char* rev, char** revstr) { |