read/write flash on XUF216 chip Topic is solved

If you have a simple question and just want an answer.
Experienced Member
Posts: 75
Joined: Thu Nov 17, 2016 11:24 pm

read/write flash on XUF216 chip

Postby woodsb » Sat Nov 25, 2017 9:24 pm

Hello All,

My questions regard reading and writing to the internal flash of an XUF216 chip. I am a complete noob in the flash realm and in its usage by XMOS, so I hope you'll put up with my very naive questions.

I want to run a program in the field that derives statistics from its operating environment and stores those statistics in flash. I then want to read the statistics back in the lab using XTIMECOMPOSER or another program.

I read app note AN00154, the only XMOS app note I could find on flash usage, but am unsure if it pertains to the flash in the XUF216 chip because the XUF216 flash part (IS25LQ016B from the XUF216 data sheet) is not listed in AN00154, nor are the XUF216 flash SPI signals.

From AN00154, however, I expect I will need to connect to the flash device using something like
fl_connectToDevice(ports, deviceSpecs, sizeof(deviceSpecs)/sizeof(fl_DeviceSpec))

and read and write data using something like
fl_readData(offset, numReadBytes, readBuffer)
fl_writeData(offset, numWriteBytes, writeBuffer, scratchBuffer)

and finally disconnect from the device using fl_disconnect().

My specific questions are:
1. Is my general outline of the procedure correct?
2. If general outline is correct, how exactly should I define "ports", and "deviceSpecs", as in AN00154 or some other way?
3. If my general outline is incorrect, what should it be?
4. How many times can I write or read before the flash begins to fail?
5. Can I write and read arbitrary numbers of bytes?
6. Can XTIMECOMPOSER be used to easily dump the flash contents to a file? If so, where can I find out how to do this?

Any pointers would be greatly appreciated!

embedded sys noob
View Solution
User avatar
XCore Legend
Posts: 1319
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Sat Nov 25, 2017 11:20 pm

Hi Bill. Happy Saturday to you.

Yes, you have the correct idea. Another appnote is more suitable for your use with the XCORE-200 series processor and that is AN00188: ... rc1%29.pdf

This note details how to use the QSPI interface present inside the XUF / XEF series CPU and the density you noted.

To dump to a file, suggest for you to use the xflash tool from xmos. This tool is available when you enter the CONSOLE (aka DOSSHELL) mode of the xtimecomposer. Once you shell to this DOS style (CLI = command line interface), type in xflash <ENTER>. If the toolchain complains about missing parameters then you know you are getting warmer.

Using xflash, you can perform low level flash access including erasing the entire flash, reading out the flash and writing to a target file, writing from your bin file to the flash, etc.

Read up on the xflash CLI tool but here are some parameters (from memory :) we used recently to dump / erase / write to the IS25LQ016B flash on our StartKit (older kit from XMOS):

; erase the entire flash (spi spec file offers the geometry of the flash memory device)
; fairly quick to process
xflash --erase-all --spi-spec IS25LQ016B --target startkit<ENTER> ; XMOS offers some canned predefines for the hardware tools (ie. startkit informs this toolchain that the SPI flash is mapped to a,b,c, etc. pins)

; read out the flash contents and copy to a binary file on the hard drive
; warning - this process takes a few light years to complete so be patient
xflash --read-all -o my_flash_dump.bin --spi-spec IS25LQ016B --target startkit<ENTER> ; not the single hyphen prefix for the -o filename.bin

; write the flash contents from a binary file and copy to the target flash device
; takes less time to complete than the above read process
xflash --write-all my_flash_dump_to_write_into_chip.bin --spi-spec IS25LQ016B --target startkit<ENTER>


Forgot to note that the details of how the QSPI is wired up inside your specific CPU are posted inside the datasheet for your CPU -> see figure 8 ... .14%29.pdf

Experienced Member
Posts: 75
Joined: Thu Nov 17, 2016 11:24 pm

Postby woodsb » Sun Nov 26, 2017 2:45 pm

Great! Not sure how I missed that other app note, but ready to press on. Will give it a shot and come back with any questions, or to mark it solved.


Who is online

Users browsing this forum: No registered users and 85 guests