Read Unique ID from Flash

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
RedDave
Experienced Member
Posts: 77
Joined: Fri Oct 05, 2018 4:26 pm

Read Unique ID from Flash

Post by RedDave »

The QPSI flash chip installed on the explorerKit has an unique ID that can be read by reading with instruction 48h.

Is there a standard library call for reading this through quadflash?
Is there otherwise a standard way to access the functions of the chip?
Any other advice on how to get to it?

Is the source code for quadflash available somewhere?
Quadflash is included using -lquadflash as an XCC_FLAGS, rather than USED_MODULES=lib_quadflash. Why is that?


User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Hi. QSPI flash should permit the use of the standard SPI commands including the reading of the flash ID.

Can you confirm that you are referencing the proper instruction # 48h? That appears to be a READ SECURITY command.

I believe you want to use command # 4Bh which is a STANDARD SPI command so the attached project should work fine.

Extracted from the IS25LQ080B datasheet:
IS25LQ080B_unique_ID.png
Please review the attached project and modify to suit. In short, this project is bit banging the SPI spec to R/W to the flash device. This project was written and worked well to take a QSPI featured flash (mated to the StartKit) and use standard SPI commands to enable the QSPI BIT. Also used to debug using other standard SPI flash commands.

Curious on your results. Please post back after testing.

Also, from our knowledge, the xflash / quadflash code is closed source.
workspace_spi_v2.rar
You do not have the required permissions to view the files attached to this post.
User avatar
RedDave
Experienced Member
Posts: 77
Joined: Fri Oct 05, 2018 4:26 pm

Post by RedDave »

48h was a typo (probably caused by the fact that it is on page 48 - Doh!).

I'll aim to look at the attached project early next week and I will report back.
Thanks for your help.
User avatar
RedDave
Experienced Member
Posts: 77
Joined: Fri Oct 05, 2018 4:26 pm

Post by RedDave »

Just had a quick sanity check of that code.

Code: Select all

in buffered port:32    p_miso  = on tile[0]: XS1_PORT_1A;
out buffered port:32   p_mosi  = on tile[0]: XS1_PORT_1D;
MISO and MOSI are one bit ports. On explorerKit (which we copied onto our dev board) and following the requirements of quadflash and boot from flash (I assume), MISO and MOSI are on a four bit port. I believe this makes it so the whole SPI library cannot be used as is.

The techniques used in the quadflash library are what is needed. Reading the RDUID would not be dissimilar to reading the RDID. An extra address is needed but the same bits are based.

Thoughts?
User avatar
akp
XCore Expert
Posts: 579
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

The -lquadflash code might be closed source but I wonder how close it is to the aborted code on xcore github? You might be able to add a new function based on that. Or not. https://github.com/xcore/sc_flash/blob/ ... i_flash.xc

Good luck