I am trying to use the serial number to identify multiple wixels communicating via RF. According to the SDK, it is defined as uint8 CODE serialNumber [4]. I use the following code to display this ID via the serial port:
For 3 wixels tested, serialNumber[0] seems to return the correct first byte (and it corresponds to the first byte displayed in the wixel configuarion utility), but [1], [2] and [3] always returns 0, 0, 0x18 and this does not correspond to the last 3 bytes in the wixel configuration utility.
What is the correct way of successfully reading all 4 bytes of the Wixel’s internal serial Number?
;; The USB device descriptor of the bootloader is stored at this address:
_bootloaderDeviceDescriptor = 0x03CC
;; The four bytes of the serial number are stored in the bootloader at this address: _serialNumber = 0x03E3
;; The Serial Number String Descriptor is stored in the bootloader at this address: _serialNumberStringDescriptor = 0x03E6
the two entries in bold are unusual
if the serialNumber is indded 4 bytes, surely it would occupy 0x3E3 to 0x3E6 inclusive
but serialNumberDescriptor start at 0x3E6
maybe that explains why we keep getting 0x16, maybe serialNumberDescriptor is a pointer!
I suspect that serialNumber may be somewhere else
hmm wonder if it’s big-endian and finishes at 0x3E3?
haven’t worked out how to read bootloader memory (yet!)
You’re definitely on to something with the Big/Small endian! I managed to get the right serial number, going the other way in memory
This is what I’ve done:
Hello. Thank you for uncovering a bug in the Wixel SDK!
The line that defines the address of the serial number in fixed.s was wrong. It should be 0x3E0 because that is the start address of the serial number. That address is documented in the “The Wixel USB Bootloader” section of the Wixel User’s Guide. You can download the latest version of the Wixel SDK from github to get a fixed version of that file, or just fix it yourself.
I agree that the way the serial number is stored might seem “backwards” if you think of it as an array of four 8-bit bytes. It might help to think of it as a single little-endian 32-bit number instead, so that byte 3 contains the most significant 8 bits and byte 0 contains the least significant 8 bits. In retrospect, it might have made more sense for us to define serialNumber as a uint32 instead of a uint8 array.
I only mention it as I guess most people (ok me) would expect
wixelID[0] to wixelID[3] to show the ID rather than
wixelID[3] to wixelID[0]
not a big deal, the info is there - that’s what matters
I’ve updated my SDK document
cheers