DFU Hangs Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

DFU Hangs

Post by RitchRock »

Hello,

I would like to use DFU to upgrade the factory image. My firmware is based on the USB audio 6.15.2, but does include custom DSP (not running on USB tile). Using OSX terminal and following the instructions carefully, I can successfully create the firmware upgrade .bin file. Then I execute the following, however it just hangs on the last ...Download image line:

Code: Select all

bash-3.2$ ./xmosdfu --download firmware_upgrade.bin
VID = 0x5ac, PID = 0x8007, BCDDevice: 0x198
VID = 0xa5c, PID = 0x4500, BCDDevice: 0x100
VID = 0x5ac, PID = 0x828f, BCDDevice: 0x144
VID = 0x5e3, PID = 0x612, BCDDevice: 0x9020
VID = 0xb95, PID = 0x1790, BCDDevice: 0x100
VID = 0x5e3, PID = 0x610, BCDDevice: 0x9020
VID = 0x20b1, PID = 0x8, BCDDevice: 0x10
XMOS DFU application started - Interface 3 claimed
Detaching device from application mode.
Waiting for device to restart and enter DFU mode...
VID = 0x5ac, PID = 0x8007, BCDDevice: 0x198
VID = 0xa5c, PID = 0x4500, BCDDevice: 0x100
VID = 0x5ac, PID = 0x828f, BCDDevice: 0x144
VID = 0x5e3, PID = 0x612, BCDDevice: 0x9020
VID = 0xb95, PID = 0x1790, BCDDevice: 0x100
VID = 0x5e3, PID = 0x610, BCDDevice: 0x9020
VID = 0x20b1, PID = 0x8, BCDDevice: 0x10
... DFU firmware upgrade device opened
... Downloading image (firmware_upgrade.bin) to device
I'm not entirely sure where to start debugging this problem - looking forward to suggestions. Thanks!


View Solution
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Post by RitchRock »

To add a little bit more. If I unplug the device while it has hung on the "... downloading image " line. Suddenly it says

... Download complete
.. Returning to application mode

If I plug the device back in, OSX System Report still shows the version # for the factory image, not upgrade.
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Post by RitchRock »

When I attempt to use TUSBAudio Firmware Upgrade (Thesycon), I get:

Entering upgrade mode...
Upgrading firmware...
0 of 105728 bytes transferred.
TUSBAUDIO_GetDfuStatus: Function failed with error code 0xEE000003

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

Post by mon2 »

The same error code comes up on this URL:

https://github.com/Fuhua-Chen/ReSpeaker ... e/issues/4
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Post by RitchRock »

Thanks for the link, but It doesn't seem exactly the same. Perhaps that error code is a generalization.

Mine restarts in DFU mode OK and starts downloading, but for some reason hangs at that point.

Regardless, I did try both Windows, MAC and different USB port & cables without success.
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Post by RitchRock »

OK, I was able to see a console error. DFU was getting stuck in audio() due to some modifications I made. Fixed the problem and now DFU downloads the program successfully using Thesycon, but always restarts and shows the old (factory) firmware. So, DFU is still failing somewhere. Occasionally when I try to program via OSX command prompt I get a segmentation fault: 11
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Post by RitchRock »

Looks like I get the following on the terminal when the segmentation fault occurs:

Code: Select all

xrun: Program received signal ET_LOAD_STORE, Memory access exception.
      [Switching to tile[1] core[2] (dual issue)]
      handle_audio_request (c_mix_out=2147680514) at C:/.../module_usb_audio/usb_buffer/decouple.xc:343

      343	                    asm volatile("ldw %0, %1[%2]":"=r"(mult):"r"(p_multIn),"r"(i));
But I should note that the segmentation fault usually does not happen. Usually I get a download complete and the device restarts, but with the old firmware.
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Post by RitchRock »

Hoping that someone with DFU knowledge can chime in here, as I need to get this working. I'm now getting successful DFU firmware uploads, but upon restart it's always the old factory firmware image. Would that leave one to believe that the write is actually unsuccessful (even though it appears as if it is)? Where should I look? I'm using this flash: https://www.mouser.com/ProductDetail/IS ... Kuhw%3D%3D
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

No direct experience with this but...

What does dfucons info output report? Please post your output.

How was the image version defined for the upgrade image?

Have you attempted the factory version parm with xflash during the build of the upgrade image?

https://www.xmos.com/support/silicon?ve ... 441&page=1

Silly question but does the flash have enough density and free space to store both images?

Some similar topic chatter here:

http://www.diyaudio.com/forums/digital- ... e-144.html
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am
Contact:

Post by infiniteimprobability »

DFU can be tricky to debug if you are not sure what change you made broke it.

The key is to get visibility of what is going on. At each stage, try doing:-

Code: Select all

xflash --read-all --target-file <yourxnfile.xn> -o flash.bin
Then using a binary editor, have a look to see if you can see what's in the flash is what you expect. You can find the image format here http://www.xcore.com/viewtopic.php?t=5041

After a normal xflash (xflash <myxe.xe>) you will see the factory image. After DFU, you will see an uprade image after the factory. This will say whether it has actually written the update or not. The chip will fallback to factory if there is no upgrade or the CRC doesn't check out. Compare the upgrade image written to the raw binary (use xobjdump --strip <myxe.xe> to get the raw binary).

Then you can narrow down at what stage it fails to help narrow down the issue..
Post Reply