-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ESP.getChipId() to take new OTP bytes into account #2309
Comments
For this purpose I use the complete macadress as an id (with the separators removed). For now all have been unique. |
Yes ... you really MUST use the entire MAC address to ensure uniqueness. It's quite common that a vendor ID (the first three bytes) might run out ... it's only good for 16,777,215 unique IDs or less. A vendor will then go obtain a new vendor ID to use. |
There are now more OTP bytes used to set MAC address because we have run out of space with three bytes. getChipID doesn't take these new bytes into account, it has to be updated. Edit: using MAC address as unique ID a good approach for now. |
This is a two years old thread tagged with milestone 2.5.0. |
Ok but I wonder if at this point it would be best if we had backward compatibility on this, so maybe a bool flag that maybe defaults to the 32 bit version would be good? |
Is there any reason that we could not just add one that returns a 64 bit value? There is a register for chipid, but it doesn't seem to be used for the It would be nice to get a few samples from people who run the following simple sketch and copy their captured serial data. From my esp8266, I can see no relationship between the unmodified mac address upper bytes and any of these registers. @igrr I also wonder why the chipid register is not used for the actual chipid?
|
mac0 and chipid seem to not have much "entropy"
Mac Address is hardcoded and can only be changed at runtime right ?
|
The current Mac address is composed of parts of MAC0 & MAC1 (lower three bytes) and some magic numbers for the upper three bytes. The upper three bytes seem be to be one of a small set of static values (0x18fe34, 0xacd074, 0x600194, 0x5ccf7f, ?) across all esp8266. mac address lower three bytes = ((MAC1 & 0x0000ffff) << 8) | (MAC0 & 0xFF000000) >>24) There seems to be at least one byte in MAC0 that is unique but not used, I have seen code that uses the third byte Looks like the chipid register isn't very unique.
|
So what about
|
esp8266 core v2.5.2 ESP-12F another ESP-12F if that is still needed. |
I think this requires further discussion and thought. |
A step further in this discussion
There are three paths, let's 😄 for the first, 🎉 for the second, ❤️ for the third and 👎 if disagree with all of them.
edit:
|
what about |
Vote message updated, voters are needed :) @dirkmueller |
@d-a-v in all esp8266 that I have available, chipid is simply the serial portion triplet of the STA mac address (not the vendor portion which are the first 3 bytes). So it fits into 24 bit, and there are 8 bit still available for deduplication. So we can do something like xor or crc32 over the first triplet of the mac |
What you call |
As explained in the first comments, the MAC address is 6 bytes (48bits) long, and its default value is unique. It is made up of 3 bytes ID assigned to a vendor (a vendor can have multiple of these), and 3 bytes for individual devices manufactured, unique for a particular ID. My view on this is to change the return type of ESPClass::getChipId() to be uint64, return the default MAC, and put this issue to rest. That would be a breaking change due to the type change, so target for v3. Side Note: the code that generates the default SSID of |
@devyte in general it is not possible to fit 48 bits into 32 bits without some small chance of collision. However here we're talking about esp8266 which is produced by a single vendor which has a very limited number of vendor prefixes assigned. Unless that number of prefixes assigned exceeds 8 bit, it is possible to generate a unique id in 32 bit. Your suggestion is basically just 'stop using this, use the Mac' which users can do already today right now. For the unfortunate group of users that used the chipid for something meaningful and that was stored in 32 bit fields in e.g. databases before it might be a good idea to offer a transition to a newer format that does not extend data store requirements. My suggestion allows for that, a way to map from old to new format (that is reasonable collision safe given the limited number of vendor prefixes that can occur) and not extend storage requirements. |
@dirkmueller @devyte @d-a-v For me the best would be to mark |
I agree with the fact that MAC address is our universal unique ID. |
Using a mac addresses to get a world-wide unique identifier is quite universal these day. In case of 32 bits unique identifier is absolutely needed, |
I have been using an ESP8266TrueRandom Library, it generates a UUID on first boot and saves to eeprom. |
I read in #921: "ESP sets its MAC address as a concatenation of 3 fixed bytes and 3 unique bytes." I think you mean that the 1st 3 bytes of the MAC address are the same between all 8266s. However, looking at the MAC addresses of my 12Es, some have 1st 3 bytes 18:FE:34 and some have first 3 bytes are 5C:CF:7F. Moreover I just purchased a 12F and its 1st 3 bytes are 60:01:94.
I'm concerned about this because I have been using getChipId as a unique identifier for all my 8266s. But now that I see that the 1st 3 bytes of the MAC address are perhaps not fixed after all, I wonder if it is possible that the last 3 bytes may not be unique between different runs of 12Es or between the 12E and 12F.
The text was updated successfully, but these errors were encountered: