11 years, 3 months ago.

Can a program retrieve MBED serial number?

Need a unique identifier for each device. Hoping to use the mbed serial number, but can't find any reference to retrieving it.

Can anyone help?

3 Answers

8 years, 2 months ago.

Try the sample at https://developer.mbed.org/users/joeata2wh/code/frdm_print_unique_serial_number/ It uses the CPU ID which should always be available rather than the MAC address which may not be available on custom PCB.

11 years, 3 months ago.

Hi you could try reading the mac address for a unique number to do that try this bit of code

extern "C" mbed_mac_address(char *);
 
int main() {
    char mac[6];
    mbed_mac_address(mac);
}

I think the mac address is derived from the serial number or the otherway round

Hope this helps

Chris

11 years, 3 months ago.

The code for the mac address should work. Simon Ford posted a message on reading the UID topic a long time ago:

You can read the full UID of the mbed (from which the MAC is extracted) using a semihost call to the mbed interface. Here is the outline code:

#define USR_UID 0x101

int semihost_uid(char *uid) {
  int32_t args[2];
  args[0] = (uint32_t)uid;
  args[1] = 33;
  return __semihost(USR_UID, &args);
}