ESP8266 Developer Zone The Official ESP8266 Forum 2018-11-27T16:45:40+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=982 2018-11-27T16:45:40+08:00 2018-11-27T16:45:40+08:00 https://bbs.espressif.com:443/viewtopic.php?t=982&p=35650#p35650 <![CDATA[Re: SPI_FLASH_INSTRUCTION_CODE ( 0x4B ) for get the UID 64 Bit MAC of Winbond]]>

Statistics: Posted by adhopraz — Tue Nov 27, 2018 4:45 pm


]]>
2016-01-25T09:15:26+08:00 2016-01-25T09:15:26+08:00 https://bbs.espressif.com:443/viewtopic.php?t=982&p=5508#p5508 <![CDATA[Re: SPI_FLASH_INSTRUCTION_CODE ( 0x4B ) for get the UID 64 Bit MAC of Winbond]]>
UID = only in SPI MODE
JEDEC = SPI & QPI Mode

hope now is clear:
and why we have no SDK_API for the Quad connected Flash
if you want read the UID from Quad connected Flash
you must overlap a user SPI Mode. ( use bitbanged mode, its the easiest way for his )
search.php?keywords=overlap+spi


JEDEC_SPI_QPI.png


hope this helps

best wishes
rudi ;-)

Statistics: Posted by rudi — Mon Jan 25, 2016 9:15 am


]]>
2016-01-25T04:21:12+08:00 2016-01-25T04:21:12+08:00 https://bbs.espressif.com:443/viewtopic.php?t=982&p=5504#p5504 <![CDATA[Re: SPI_FLASH_INSTRUCTION_CODE ( 0x4B ) for get the UID 64 Bit MAC of Winbond]]>
lihwarlee wrote:
Do you have any sample code about reading Unique ID of W25Q32 ?

Pls send the SAMPLE CODE to me, E-mail: 64569224@qq.com

Thank you.


I have use your SPI driver to debug this, but it is NOT success.

void ReadFlashID(BYTE *pManuId, BYTE *pDevId)
{
BYTE tmp;

spi_master_init(0);

spi_mast_byte_write(0, 0x90);
//spi_byte_write_espslave(0, 0x90);
os_delay_us(200);
//SPI_REG8(PUB_SPICMD_WR_BYTE, 0x90);
spi_mast_byte_write(0, 0x00);
//spi_byte_write_espslave(0, 0x00);

os_delay_us(200);
//SPI_REG8(PUB_SPICMD_WR_BYTE, 0x00);
spi_mast_byte_write(0, 0x00);
//spi_byte_write_espslave(0, 0x00);
os_delay_us(200);
//SPI_REG8(PUB_SPICMD_WR_BYTE, 0x00);
spi_mast_byte_write(0, 0x00);
//spi_byte_write_espslave(0, 0x00);
os_delay_us(200);
//SPI_REG8(PUB_SPICMD_WR_BYTE, 0x00);

//spi_mast_byte_write(0, 0x00);
//spi_byte_write_espslave(0, 0x00);
os_delay_us(200);
//SPI_REG8(PUB_SPICMD_RD_BYTE, 0x00); //read the last byte
spi_byte_read_espslave(0, &tmp);
*pManuId = tmp;
os_delay_us(200);
spi_byte_read_espslave(0, &tmp);
//SPI_REG8(PUB_SPICMD_RD_LASTBYTE, 0x00); //read the last byte
*pDevId = tmp;
}


hi
how you have "connect" the spi_master_init(0); by pins to your flash chip ?
do you connect a second spi flash or will you read from boot flash as connected is Quad?
be sure you have read the datasheet, there are Standard, Dual and Quad Instructions.

uid_esp.png


try to read the modes are can used:
http://www.winbond-usa.com/resource-fil ... 202015.pdf

examples
side 61, 62, 63
and then you know how you must handle UID:
side 64
and jedec ( manufacturer )
side 65

btw, jedec is supported in last Flash Tool, the src is in the folder too.
viewtopic.php?f=5&t=433

Code:


..

 def get_flash_id(self):
   try:
       self.flash_begin(0,0)
       self.write_reg(self.ESP_DATA_ADDR, 0 , 0 , 0 )
       time.sleep(0.01)
       self.write_reg(self.ESP_CMD_ADDR , self.ESP_CMD_RDID , self.ESP_CMD_RDID , 0 )
       time.sleep(0.01)
       flash_id = self.read_reg(self.ESP_DATA_ADDR)
       print "get flash id : 0x%08x"%flash_id
       self.flash_manufacturer_id = flash_id&0xff
       self.flash_device_id = ((flash_id>>16)&0xff | (flash_id &( 0xff<<8)))
       print " manufacturer_id: 0x%x\r\n"%self.flash_manufacturer_id
       print " device_id: 0x%x\r\n"%self.flash_device_id
       return True
   except:
       print "get flash id error"
       return False
   
   #self.mp.textCtrl_BinPath3.AppendText("\r\nFLASH:\r\n")
   #self.mp.textCtrl_BinPath3.AppendText("manufacturer_id: %xh\r\n"%manufacturer_id)
   #self.mp.textCtrl_BinPath3.AppendText("device_id:%xh\r\n"%device_id)

..




best wishes
rudi ;-)

Statistics: Posted by rudi — Mon Jan 25, 2016 4:21 am


]]>
2016-01-16T09:15:48+08:00 2016-01-16T09:15:48+08:00 https://bbs.espressif.com:443/viewtopic.php?t=982&p=5390#p5390 <![CDATA[Re: SPI_FLASH_INSTRUCTION_CODE ( 0x4B ) for get the UID 64 Bit MAC of Winbond]]>
Pls send the SAMPLE CODE to me, E-mail: 64569224@qq.com

Thank you.


I have use your SPI driver to debug this, but it is NOT success.

void ReadFlashID(BYTE *pManuId, BYTE *pDevId)
{
BYTE tmp;

spi_master_init(0);

spi_mast_byte_write(0, 0x90);
//spi_byte_write_espslave(0, 0x90);
os_delay_us(200);
//SPI_REG8(PUB_SPICMD_WR_BYTE, 0x90);
spi_mast_byte_write(0, 0x00);
//spi_byte_write_espslave(0, 0x00);

os_delay_us(200);
//SPI_REG8(PUB_SPICMD_WR_BYTE, 0x00);
spi_mast_byte_write(0, 0x00);
//spi_byte_write_espslave(0, 0x00);
os_delay_us(200);
//SPI_REG8(PUB_SPICMD_WR_BYTE, 0x00);
spi_mast_byte_write(0, 0x00);
//spi_byte_write_espslave(0, 0x00);
os_delay_us(200);
//SPI_REG8(PUB_SPICMD_WR_BYTE, 0x00);

//spi_mast_byte_write(0, 0x00);
//spi_byte_write_espslave(0, 0x00);
os_delay_us(200);
//SPI_REG8(PUB_SPICMD_RD_BYTE, 0x00); //read the last byte
spi_byte_read_espslave(0, &tmp);
*pManuId = tmp;
os_delay_us(200);
spi_byte_read_espslave(0, &tmp);
//SPI_REG8(PUB_SPICMD_RD_LASTBYTE, 0x00); //read the last byte
*pDevId = tmp;
}

Statistics: Posted by lihwarlee — Sat Jan 16, 2016 9:15 am


]]>
2015-09-22T02:53:17+08:00 2015-09-22T02:53:17+08:00 https://bbs.espressif.com:443/viewtopic.php?t=982&p=3790#p3790 <![CDATA[Re: SPI_FLASH_INSTRUCTION_CODE ( 0x4B ) for get the UID 64 Bit MAC of Winbond]]> Solved and DONE

got my new flash ic's just in time- so i have a short try with this 32Mbit,
and runs like clockwork in my code - i solved this now- and can go next step to make fw better proteced.

if you can support this in your api too - would be fine step -

the UID number can be used in conjunction with user software methods
to help prevent copying or cloning of a system.


"Thanks for your interest in this...
bbs.png

ready ;-) .jpg

Statistics: Posted by rudi — Tue Sep 22, 2015 2:53 am


]]>
2015-09-20T10:55:40+08:00 2015-09-20T10:55:40+08:00 https://bbs.espressif.com:443/viewtopic.php?t=982&p=3774#p3774 <![CDATA[Re: SPI_FLASH_INSTRUCTION_CODE ( 0x4B ) for get the UID 64 Bit MAC of Winbond]]> Statistics: Posted by rudi — Sun Sep 20, 2015 10:55 am


]]>
2015-08-20T23:15:30+08:00 2015-08-20T23:15:30+08:00 https://bbs.espressif.com:443/viewtopic.php?t=982&p=3338#p3338 <![CDATA[SPI_FLASH_INSTRUCTION_CODE ( 0x4B ) for get the UID 64 Bit MAC of Winbond]]>
have we an official api for comunicate with the SPI_FLASH?
i mean not the read, write function to a SPI_FLASH to store or read bytes.

right, we have an api command to read the manufacturer id

spi_flash_get_id()

but i mean, is there an official api to send instruction code to the SPI FLASH
example :
to read the SPI_FLASH MAC ID - i mean the uinique id ( 64 Bit )

read Winbond - instruction code byte is : 0x4B


there is a unique 64bit MAC/ID at address 0X4B on the flash chip.
this could be very useful in uniquely identifying flash ic in a large manufacturer
and history database for firmware / updates.


the UID number can be used in conjunction with user software methods
to help prevent copying or cloning of a system.


linked to a pdf ( example the W25Q64CV )
because file is too big for upload.

Code:

 
https://www.winbond.com/resource-files/w25q64cv_revh_052214[2].pdf


please have a look to side 55
point : 7.2.3.4 Read Unique ID Number (4BH)

please support this as an api instruction.
please support to can send other instruction code too.

example: 7.2.39 Read Security Registers ( 48h )

there are more interesst instruction code

i have write/request this more as one time i know -


please support this in an api command official


thank you!
best wishes
rudi ;-)

Statistics: Posted by rudi — Thu Aug 20, 2015 11:15 pm


]]>