Read Unique ID from Flash

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
Active Member
Posts: 53
Joined: Fri Oct 05, 2018 4:26 pm

Read Unique ID from Flash

Postby RedDave » Thu Mar 21, 2019 1:19 pm

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
XCore Legend
Posts: 1434
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Thu Mar 21, 2019 3:54 pm

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:
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.
You do not have the required permissions to view the files attached to this post.
Active Member
Posts: 53
Joined: Fri Oct 05, 2018 4:26 pm

Postby RedDave » Thu Mar 21, 2019 4:00 pm

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.
Active Member
Posts: 53
Joined: Fri Oct 05, 2018 4:26 pm

Postby RedDave » Thu Mar 21, 2019 4:17 pm

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.

User avatar
Respected Member
Posts: 282
Joined: Thu Nov 26, 2015 11:47 pm

Postby akp » Fri Mar 22, 2019 9:14 pm

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. ... i_flash.xc

Good luck

Who is online

Users browsing this forum: Tanjaddaniel and 1 guest