Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Daemach
#36229 i'm trying to create a unique serial number for each of my devices. The esp chip id is unique, but the flash chip id doesn't appear to be. Is this normal behavior? If so, how is this useful, for curiosities sake?
User avatar
By martinayotte
#36230 Completely normal !
The flashChipId is not a serial number but a model number, it is used to identify the manufacturer and the size of the external Flash chip, so for the same chips, the Ids will be the same.
So, if you need uniqueness, better stick with ESP unique Id.

EDIT : BTW, looking to details while working with STM32, Flash chips have also a Unique Id, unrelated to FlashID, it is FlashUID, but Expressif SDK doesn't expose that yet. I don't know if there is a way to read it by bypassing the SDK.
User avatar
By martinayotte
#36538 BTW, I'm able to do readUniqueId() using LowPowerLab SPIFlash library under STM32. It is an 8 bytes UID.
So, I don't know if ArduinoESP core can't talk to Flash directly thru SPI without getting side-effect with SDK, if it can, then all we need is to do something similar to :

Code: Select all#define SPIFLASH_MACREAD          0x4B        // read unique ID number (MAC)

uint8_t* SPIFlash::readUniqueId()
{
  static uint8_t UNIQUEID[8];
  command(SPIFLASH_MACREAD);
  SPI.transfer(0);
  SPI.transfer(0);
  SPI.transfer(0);
  SPI.transfer(0);
  for (uint8_t i=0;i<8;i++)
    UNIQUEID[i] = SPI.transfer(0);
  unselect();
  return UNIQUEID;
}