This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Which is the true Serial Number returned from a BBC Micro:bit

I have nRF Connect v4.19.2 installed on a Samsung Note 8.0 (Android Tablet)

I have several BBC Micro:bits and I can get their Serial Numbers by three different methods:

Method 1. -------------------------------------------------------------------------------------------------------------

Using nRF Connect - I connect via Bluetooth to the Micro:bits and under the Device Information section, I can display the following:

    Serial Number String 

    UUID:022A25

    Properies: READ

    Value: 

OK, so the nRF Connect shows the Serial Number as: 5669918930

However, when I use two other methods, shown below, I get this different Serial Number: 1240653179

Both the 'C' and MicroPython code return the same Serial Number, but is different to the one returned by nRF Connect.

My questions are

       1) Which is the true Serial Number?

       2) Why are there two?

Regards, Martyn

Method 2: -------------------------------------------------------------------------------------------------------------

Using 'C' - Ref: https://os.mbed.com/questions/85156/I-want-to-get-the-serial-number-and-disp/

// Get Microbit Serial number and display via LEDs

#include "MicroBit.h"

MicroBit uBit;

int main()
{
    uBit.init();
    uBit.display.scroll(MicroBit.getSerial());
    while(true) {
    }

}

Method 3. -------------------------------------------------------------------------------------------------------------

Using MicroPython - Ref: https://support.microbit.org/support/solutions/articles/19000070728-how-to-read-the-device-serial-number

from microbit import *

display.show('S')

def get_serial_number(type=hex):
NRF_FICR_BASE = 0x10000000
DEVICEID_INDEX = 25 # deviceid[1]

@micropython.asm_thumb
def reg_read(r0):
ldr(r0, [r0, 0])
return type(reg_read(NRF_FICR_BASE + (DEVICEID_INDEX*4)))

while True:
if button_a.was_pressed():
display.scroll(get_serial_number())
sleep(1000)
display.show('S')

sleep(100)

Parents Reply Children
No Data
Related