Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 9 months ago.
I get different serial numbers and firmware revisions on same microbit
I want to get the serial number of BBC Microbits and have come across three methods.
Method 1. Uses the following MicroPython code, via https://python.microbit.org/v/1.1
from microbit import * def get_serial_number(): NRF_FICR_BASE = 0x10000000 DEVICEID_INDEX = 25 # deviceid[1] @micropython.asm_thumb def reg_read(r0): ldr(r0, [r0, 0]) return reg_read(NRF_FICR_BASE + (DEVICEID_INDEX*4)) while True: if button_a.was_pressed(): display.scroll(get_serial_number()) sleep(100)
Method 2. Uses C++, via https://ide.mbed.com/compiler/#nav:/;
#include "MicroBit.h" MicroBit uBit; int main() { uBit.init(); // Initialise the micro:bit runtime. uint32_t sn = microbit_serial_number(); char buffer[16]; int len = sprintf(buffer,"%d",sn); uBit.display.scroll(buffer); release_fiber(); }
Method 3. Uses the Android App: Micro:bit Blue, from https://play.google.com/store/apps/details?id=com.bluetooth.mwoolley.microbitbledemo
After pairing via Bluetooth, check the (I)nformation about your microbit and it shows the serial number and firmware version
I get the same result from the first two methods and a completely different result from the 3rd.
For example 212354362 (from methods 1 and 2) and 177223240 (from method 3)
It is the same story on all the microbits I have tested, and I cannot see any relationship between the numbers. In addition, although I have downloaded and installed the latest firmware (0250) from https://microbit.org/guide/firmware/, The Micro:bit Blue App reports firmware version 2.1.1-g
Can anyone explain these differences, and say which is the real serial number and firmware version?