Moderator: igrr
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.
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 :
#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;
}