xCore-200 MC returning 0 bytes on DFU

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
Zed1970
Member++
Posts: 26
Joined: Tue Oct 15, 2019 10:36 am

xCore-200 MC returning 0 bytes on DFU

Postby Zed1970 » Tue Feb 18, 2020 9:10 pm

Hi,

Using the stock app_usb_aud_xk_216_mc project ( 2i10o10xsxxxx.xe ) on the xcore-200 MC I get 0 bytes returned using DFU. My xk-audio-216-mc.xn file contains S25FL116K which matches the physical device on-board and I can prove this is fine because I have no problems flashing the board using the xflash utility. The problem appears to be in this section of code in dfu.xc line 235 onwards.

if (!subPagesLeft)
{
cmd_data[0] = !firstRead;

// Read whole (256bytes) page from the image on the flash
flash_cmd_read_page((cmd_data, unsigned char[64]));
subPagesLeft = 4;

// If address out of range, terminate!
if (cmd_data[0] == 1) <============================== Here
{
subPagesLeft = 0;
// Back to idle state, upload complete
DFU_state = STATE_DFU_IDLE;
return 0;
}
}

The code fails every time on the first run after the flash_cmd_read_page() returns cmd_data[0] == 1. Comment out this block or fudge cmd_data[0] to something other than one I do get data back to the xmosdfu application. It's garbage data but it proves the reset of the DFU is OK. I also check the return of DFU_OpenFlash() on line 212 above this block and that's 0 suggesting that there's at least access to the SPI flash.

IDE is 14.4.1.

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

Postby mon2 » Thu Feb 20, 2020 1:00 pm

Can you remove the extra brackets on

Code: Select all

flash_cmd_read_page
And test again? Please post your results.
Zed1970
Member++
Posts: 26
Joined: Tue Oct 15, 2019 10:36 am

Postby Zed1970 » Fri Feb 28, 2020 9:12 am

Hi Mon2, I get:
parse error before "unsigned" dfu.xc /module_dfu/src line 244 C/C++ Problem

That being => flash_cmd_read_page(cmd_data, unsigned char[64]); as you suggested.

Thanks.
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm

Postby johned » Wed Mar 04, 2020 4:10 pm

Hi,

This procedure worked for me, recently.

The following procedure works fine :

xflash --boot-partition-size 0x30000 --factory app_usb_aud_xk_216_mc_2i16o16xxxxx_tdm8.xe
xflash --boot-partition-size 0x30000 --upgrade 1 app_usb_aud_xk_216_mc_2i32o32xxxxx_tdm8.xe -o app_usb_aud_xk_216_mc_2i32o32xxxxx_tdm8.bin --factory-version 14.3 --no-compression
Push DFU update to MultiChannel board using Thesycon Windows host app.

Note - it is important to ensure -DFLASH_MAX_UPGRADE_SIZE=192*1024 is used.

Best regards,
John
Zed1970
Member++
Posts: 26
Joined: Tue Oct 15, 2019 10:36 am

Postby Zed1970 » Wed Mar 04, 2020 4:57 pm

Hi John,

So this is probably where being unfamiliar with DFU is leading me down the wrong path. I had figured that DFU was a simple USB reflash but here it looks like your formatting the flash somewhat and having a back image?

Using a fresh untouched build I did the following and got this output :

xflash --boot-partition-size 0x30000 --factory app_usb_aud_xk_216_mc_2i10o10xsxxxx.xe

Warning: F03098 Factory image and boot loader cannot be write-protected on flash device on node 0
xflash: Warning: F03148 --quad-spi-clock not given, using default 15.62MHz
xflash: Warning: F03149 QE_REGISTER and/or QE_BIT locations not found in XN file for this flash device. Using default flash_qe_location_status_reg_0 and flash_qe_bit_6.
Warning: F03150 The use of libquadflash will be deprecated from XFLASH in xTIMEcomposer 15.0.0.
Please add the PageSize, SectorSize and NumPages attributes to your External Device definitions in your target XN file to enable the use of lib_flash.
Site 0 has finished successfully.

xflash --boot-partition-size 0x30000 --upgrade 1 app_usb_aud_xk_216_mc_2i10o10xsxxxx.xe -o app_usb_aud_xk_216_mc_2i10o10xsxxxx.bin --factory-version 14.3 --no-compression
Warning: F03102
Node id: 0 - Cannot check boot partition size for sector alignment. The
boot partition should contain a whole number of sectors but
this cannot be checked when the inquirer is disabled

Are these warning alright? The bin was still produced.
Is there any reason why I cannot use the app_usb_aud_xk_216_mc_2i10o10xsxxxx.xe build for both parts as a test?
The binary (*.bin) that the last command produces is what the Thesycon Windows host app uses out in the field?

Thanks.
Zed1970
Member++
Posts: 26
Joined: Tue Oct 15, 2019 10:36 am

Postby Zed1970 » Wed Mar 04, 2020 5:23 pm

Hi John,

Building the DFU in module_dfu I get the following:

sudo ./xmosdfu --upload app_usb_aud_xk_216_mc_2i10o10xsxxxx.bin
VID = 0x1d6b, PID = 0x3, BCDDevice: 0x415
VID = 0x458, PID = 0x6001, BCDDevice: 0x1001
VID = 0x20b1, PID = 0x8, BCDDevice: 0x6f2
XMOS DFU application started - Interface 3 claimed
Detaching device from application mode.
Waiting for device to restart and enter DFU mode...
VID = 0x20b1, PID = 0x8, BCDDevice: 0x6f2
... DFU firmware upgrade device opened
... Uploading image (app_usb_aud_xk_216_mc_2i10o10xsxxxx.bin) from device
... Returning device to application mode

Am I safe to assume if DFU'd OK?
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm

Postby johned » Wed Mar 04, 2020 5:23 pm

Yes, these warnings are for information.
This documentation may help : https://www.xmos.com/file/dfu-user-guide/
Best,
John
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm

Postby johned » Wed Mar 04, 2020 5:24 pm

Yes, that looks good.
John

Who is online

Users browsing this forum: No registered users and 4 guests