Uniquely Identify My Mainboard?

anytime buddy :slight_smile:

please do keep us in the loop about your progress, we love to hear what you guys are doing :wink:

Cheers,
Jay.

1 Like

@ Jay Jay - Inching closer, they killed DeviceInfo.GetDeviceID() == DeviceID.FEZ_CERB in 4.3 from the looks of it, using your docs link I see an enumerator for DeviceType:

https://www.ghielectronics.com/downloads/man/Library_Documentation_v4.3/html/T_GHI_Processor_DeviceType.htm

But I can’t see where it is actually made available.

@ Squeebee - In your linked page it says: β€œTo get the system model type use Microsoft.SPOT.Hardware.SystemInfo.SystemID.Model” ::slight_smile:

@ iamin - Whoops, thanks!

@ Squeebee - as @ iamin said you would use it as follow:


if(Microsoft.SPOT.Hardware.SystemInfo.SystemID.Model == DeviceType.CerbFamily){
//create an empty byte array to hold the unique Deviceid of STM32F4
                  var deviceid = new byte[12];
                  //read the address where the unique id is burned.
 #if MF_FRAMEWORK_VERSION_V4_2
                  GHI.OSHW.Hardware.LowLevel.AddressSpace.Read((uint)0x1FFF7A10, deviceid, 0, 12);
 #else
//this is for framework 4.3 and higher
                 GHI.Processor.AddressSpace.Read((uint)0x1FFF7A10, deviceid, 0, 12);
 #endif
}

@ Jay Jay - I got mine working by with the following:

 getID()
        {
            //GET A MAC FOR THIS DEVICE, USED TO CORRELATE DATA IN THE DB

            //check if this is a Cerb Family board
            if ( Microsoft.SPOT.Hardware.SystemInfo.SystemID.Model == (byte)GHI.Processor.DeviceType.CerbFamily )
            {
                //create an empty byte array to hold the unique Deviceid of STM32F4
                var deviceid = new byte[12];
                //read the address where the unique id is burned.
                GHI.Processor.AddressSpace.Read((uint)0x1FFF7A10, deviceid, 0, 12);

                return GenerateUniqueMacAddr(deviceid);
            }
            return null;
        }

So would this also be an acceptable way to get a Guid (UUID) that uniquely identifies each board ?

        private string getID()
        {
            //GET A UUID FOR THIS DEVICE, USED TO CORRELATE DATA IN THE DB

            //check if this is a Cerb Family board
            if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.Model == (byte)GHI.Processor.DeviceType.CerbFamily)
            {
                //create an empty byte array to hold the unique Deviceid of STM32F4
                var deviceid = new byte[16];
                //read the address where the unique id is burned.
                GHI.Processor.AddressSpace.Read((uint)0x1FFF7A10, deviceid, 0, 16);

                return new Guid(deviceid).ToString();
            }
            return null;
        }

@ DanW - I like that! Works for me! I was even able to keep the AddressSpace.Read at 12 bytes instead of 16 and still got a GUID out of it.

@ DanW - Just to add to this, I tried the following on a new Panda III board, the G80 chip, and it seems to work on it too.


 if (SystemInfo.SystemID.Model == (byte)GHI.Processor.DeviceType.G80)
            {
                //create an empty byte array to hold the unique Deviceid of STM32F4
                var deviceid = new byte[16];
                //read the address where the unique id is burned.
                GHI.Processor.AddressSpace.Read((uint)0x1FFF7A10, deviceid, 0, 16);

                return new Guid(deviceid).ToString();
            }

That produces this output: Device UID: 004c001e-5113-3334-3436-3532c0fc00c0