Page 1 of 1

Problem with DFU and custom flash

Posted: Wed Apr 18, 2018 8:46 am
by osch
Hi! Sorry if this is posted in the wrong section, i was a bit unsure where it would be best..

We have a custom board with a non-standard flash chip that we want to be able to upgrade via DFU. Based on this thread: http://www.xcore.com/viewtopic.php?f=26&t=6448
i edited the record for a existing flash chip in xtimecomposer (Program Files (x86)\XMOS\xTIMEcomposer\Community_14.3.2\target\include\QuadSpecMacros.h) to my own specification but did not change its name. This worked great when flashing the board in xtimecomposer, i did not need to specify a spi-spec file anymore...

When i tried to upgrade firmware via DFU it just failed. I tried this on a board with a default-supported flash chip (IS25LQ080B) and it worked just fine.

I tracked down the issue to this piece of code in module_usb_audio/flashlib_user.c (reference version 6.15)
----------------------
#ifdef DFU_FLASH_DEVICE
result = fl_connectToDevice(&p_qflash, flash_devices, 1);
#else
/* Use default flash list */
#ifdef QUAD_SPI_FLASH
result = fl_connect(&p_qflash);
#else
----------------------


DFU_FLASH_DEVICE was not set, so it ran "result = fl_connect(&p_qflash);" which failed. I could not find out where the function fl_connect was defined so I tried to find a workaround by setting DFU_FLASH_DEVICE to the name of the flash like this and it works fine:

#define DFU_FLASH_DEVICE FL_QUADDEVICE_SPANSION_S25FL164K

My question is, why do i have to specify this? I know it is in the list of supported devices because with this DFU_FLASH_DEVICE defined it works so i dont quite get why DFU cannot detect it automatically. I have tried do do clean builds and there is no change. I have attached the QuadspecMacros.h file here if it is of any interest. Any help would be appreciated :)