DFU with custom flash

Technical questions regarding the XTC tools and programming with XMOS.
MarcAntigny
Active Member
Posts: 61
Joined: Tue Feb 13, 2018 2:50 pm

DFU with custom flash

Post by MarcAntigny »

Hi all,

We are working with Xcore 200 (XU232) based on the Audio USB software reference. We use a SPI flash (ISSI IS25LP016D) adressed in quadSPI. We were using ISSI IS25LQ016B before, which is one of the flash supported in XMOS tools. We added the support to the new flash following this. However, the DFU doesn't work anymore (using Theysicon tools). Only the support to the new flash was added, the rest of the code is the same and before that the DFU worked fine.
Does anyone have any clue on the origin of the DFU fail ? Maybe something we need to add to the image .bin we use to do the DFU on the XU232 (to be correlated to the flash change) ?

I already read several topics on the subject (like this one https://www.xcore.com/viewtopic.php?t=6657) and I tried those solutions with no result.

Thanks a lot,
Marc


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

Post by mon2 »

Hi.

What is the output from the following?

Code: Select all

    dfucons info

Are you able to get the flash to be programmed using xflash / XMOS IDE tools? That is, can you use the IDE toolchain and flash this target device to store your code like a simple LED blinky? Then, does your custom board power up and run this simple LED blinky code?

Perhaps the QSPI bit is not yet enabled on your new flash device? Can you confirm this detail?

Also, when using the xflash command line tool, apply the -v (verbose) flag to note all the gory details of this process. Any errors? Post them here.

Also share the details of your .XN file for a review.



reference:
https://www.xmos.com/developer/publishe ... on=&page=2
MarcAntigny
Active Member
Posts: 61
Joined: Tue Feb 13, 2018 2:50 pm

Post by MarcAntigny »

Hi mon,
dfucons info brings us the following result

Code: Select all

Driver API DLL successfully loaded. API Version: 5.02
Available devices:
Index   VID     PID     REV     Serial         DFU supported    USB mode
00      0xXXXX  0xXXXX  0xXXXX  xxxxxxxxxxxx   yes              DFU

Driver Version: X.X.00
The VID, PID, REV and Serial are good, the driver version too. The device seems to be Ok for supporting DFU.
Are you able to get the flash to be programmed using xflash / XMOS IDE tools?
Yes the xflash command and the xflash menu in xTimeComposer work well to flash the XMOS using XTAG probe.

The problem is that the DFU doesn't work anymore, with no modification of our code (except the new flash management).
There is no issue with programming in QSPI the new flash, the issue is during DFU.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Can you review this thread?

https://www.xcore.com/viewtopic.php?f=26&t=6746

and post your custom definition of the new flash device (IS25LP016D) if still facing any issues.

What is the output from this DFU tool while using the new flash definition (ISSI flash p/n IS25LP016D)?

What is the output from this DFU tool while using the original but working ISSI flash p/n IS25LQ016B?

Please update your post after testing.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

MarcAntigny
Active Member
Posts: 61
Joined: Tue Feb 13, 2018 2:50 pm

Post by MarcAntigny »

I checked the threads you pointed out. In my case the error is not 0xEE000003 but 0xEF000004 which is linked with USB stall error.
I tried to fix it the same way than in your thread, by commenting -DFLASH_MAX_UPGRADE_SIZE (even I have less than 64kB of code).
However it doesn't changed anything, same error.
Here is my custom definition for the flash device :

Code: Select all

#define FL_QUADDEVICE_ISSI_IS25LP016D \
{ \
    ISSI_IS25LP016D, \
    256,                    /* page size */ \
    8192,                   /* num pages */ \
    3,                      /* address size */ \
    3,                      /* log2 clock divider */ \
    0x9f,                   /* SPI_RDID */ \
    0,                      /* id dummy bytes */ \
    3,                      /* id size in bytes */ \
    0x9d6015,               /* device id */ \
    0x20,                   /* SPI_SE */ \
    4096,                   /* Sector erase is always 4KB */ \
    0x06,                   /* SPI_WREN */ \
    0x04,                   /* SPI_WRDI */ \
    PROT_TYPE_NONE,         /* SR protection */ \
    {{0x0,0x0},{0x0,0}},      /* no values */\
    0x02,                   /* SPI_PP */ \
    0xeb,                   /* QSPI_READFAST */ \
    1,                      /* 1 read dummy byte */ \
    SECTOR_LAYOUT_REGULAR,  /* sane sectors */ \
    {4096,{0,{0}}},         /* regular sector size */ \
    0x05,                   /* SPI_RDSR */ \
    0x01,                   /* SPI_WRSR */ \
    0x01,                   /* SPI_WIP_BIT_MASK */ \
}
I tried doing a slow down of the SPI clock by putting the log2 clock divider to 4 but I got the same error.

Maybe I am forgetting something about where to use the file is25lp016d.h. I am currently flashing (xflash) with the --spi-spec option. I made the following changes in flashlib_user.c

Code: Select all

#include "is25lp016d.h"

#define DFU_FLASH_DEVICE FL_QUADDEVICE_ISSI_IS25LP016D

#ifdef DFU_FLASH_DEVICE
/* Using specified flash device rather than all supported in tools */
fl_QuadDeviceSpec flash_devices[] = {ISSI_IS25LQ032B, ISSI_IS25LP016D};
#endif
So flashing is ok. I get a binary image from my code using the tool in xTimeComposer (xflash with -o option). Then I use the Thesycon app to do the DFU on the unit with the binary. And got the error

Code: Select all

Download failed, completionStatus=0xEF000004
Do I need to add something to the command line according to the new flash when I make the binary file ? Or for the DFU ?

I will now compare the binaries from the flash and for the DFU (https://www.xcore.com/viewtopic.php?t=5051) but if you have any hint before, you will be welcome.
Thanks,
Marc
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Hi. I may be getting confused here but believe that the articles you are following are for STANDARD SPI flash definitions. Instead, you must define a custom QSPI flash device for your xcore-200 CPU. Specifically, your definition does not offer any details on how to enable the QSPI bit for your new device and that may be an issue.

SPI commands and QSPI commands are very different.

Review here:

https://www.xmos.com/developer/download ... API(A).pdf

here is an old but relevant thread:

https://www.xcore.com/viewtopic.php?t=4603

Summary: Track down where the definitions for the QSPI flash is stored and either alter the definition or extend for your custom device and then test again.
MarcAntigny
Active Member
Posts: 61
Joined: Tue Feb 13, 2018 2:50 pm

Post by MarcAntigny »

I think the management of flash is the same for QSPI only the commands of read/write is different (and very similar in ISSI product for SPI and QSPI). We adressed the IS25LQ016B in QSPI and for the new one (IS25LP016D) we followed the steps I mention. And it worked for flashing. So QSPI worked for flashing.
your definition does not offer any details on how to enable the QSPI bit for your new device
Maybe I wasn't clear but we didn't change from SPI to QSPI, we only used QSPI since the beginning.
MarcAntigny
Active Member
Posts: 61
Joined: Tue Feb 13, 2018 2:50 pm

Post by MarcAntigny »

Hi,
I found that the definition of ISSI_IS25LQ016B and other QSPI flash is done in the QuadSpecMacros.h and in QuadSpecEnum.h (XMOS files). It is explicitly written :

Code: Select all

/*
 * Generated file - do not edit.
 */
Just in case, I tried to add my definition of ISSI_IS25LP016D in both file. As before, I can flash the unit (with spi spec option). But I got the same DFU error (0xEF000004). Is there something to add elsewhere ? (more than the multi-field definition, the enum and the --spi-spec option)

For your information, the ISSI IS25LQ016B is end-of-life (last time buy date was March 31st 2019). So maybe an updgrade of the reference software could be appreciated.
Thanks,
Marc
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

When you apply with the xflash, what is the log output using the verbose flag? (--verbose)

Also post your exact and full command line usage of the xflash tool.

reference:
https://www.xmos.com/developer/add-supp ... sh-support


Update: Just emailed THESYCON for assistance with this thread and their DFU (closed source) product. Hoping they will offer some assistance. At the very least, the cryptic error code and root cause should be documented.
For your information, the ISSI IS25LQ016B is end-of-life (last time buy date was March 31st 2019).
Yes, we requested help from ISSI (USA) on this subject. See the full thread here:

https://www.xcore.com/viewtopic.php?f=7&t=6146

Update (again): Be sure to review the LAST post (bowerymarc) on the above thread and attempt to use it for your case - same flash device.

Please post your update.
Post Reply