-->
Page 1 of 2

flashChipId not unique?

PostPosted: Fri Dec 11, 2015 11:35 am
by Daemach
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?

Re: flashChipId not unique?

PostPosted: Fri Dec 11, 2015 11:47 am
by martinayotte
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.

Re: flashChipId not unique?

PostPosted: Tue Dec 15, 2015 9:39 pm
by martinayotte
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;
}

Re: flashChipId not unique?

PostPosted: Wed Dec 16, 2015 3:22 am
by eduperez
MAC address should be unique.