DFU always fail with xu232

Discussions about USB Audio on XMOS devices
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Hi. Please review and test the solution posted here:

https://www.xcore.com/viewtopic.php?f=37&t=6053

Please post your updates and results.


TonyXiao
Active Member
Posts: 44
Joined: Fri Mar 29, 2019 3:58 am

Post by TonyXiao »

hi, all

with our fae suppurt, now add a 24M clock to PORT_MCLK_IN, now single XUF232 DFU function works.
for our requirements, we don't need play any audio, only need usb midi device, and another problem comes can i delete all the audio ports and dfu still working? so far for usb midi device, i didn't use any of the audio ports, and it indeed works. but i am not sure for the DFU.

and dfu function failed when i xlinked XU208, the program stuck in reboot.xc below sentence:
write_sswitch_reg_no_ack(tileId, 6, pllVal);

After the two XMOS chips are xlinked, should there be some special processing during operate the two XMOS resets?
Instead of simply resetting each tile in turn as one XMOS?
any advice are appreciated.

BR,
Tony
User avatar
fabriceo
XCore Addict
Posts: 181
Joined: Mon Jan 08, 2018 4:14 pm

Post by fabriceo »

Hi,
I m also experiencing lot of pain with dfu upgrade (xu216). I got it to work some time ago, but now it doesn't work anymore again.
I have identified that this is because tile1 don't want to reboot.
the device_reboot() in reboot.xc seems to work fine for rebooting tile 0 but tile1 doesn't...
any experience welcome
User avatar
fabriceo
XCore Addict
Posts: 181
Joined: Mon Jan 08, 2018 4:14 pm

Post by fabriceo »

Hi
I tried the run --dump-state as explained here:
https://www.xcore.com/viewtopic.php?t=4060
I saw a couple of problem with my application as the dfuhandler was distributed on another task than audio() and also the boot was stuck in ffff04c8 which meant that the xtag/jtag was the problem. finally, doing things step by step and removing the xtag after a cold boot solved it.
my reboot code is simply this one now and looks fine:

Code: Select all

    read_sswitch_reg(get_local_tile_id(), 6, pllVal);
    pllVal &=0xFFFF;
    write_sswitch_reg_no_ack(get_local_tile_id()^1, 6, pllVal);
    write_sswitch_reg_no_ack(get_local_tile_id(),   6, pllVal);
hope this helps
TonyXiao
Active Member
Posts: 44
Joined: Fri Mar 29, 2019 3:58 am

Post by TonyXiao »

Hi

DFU reboot soft reset, the principle is realized by writing the PLL register to reset the PLL; first reset the PLL where the non-localtile is located, and then reset the PLL where the localtile is located.
as to 216 there is one PLL,that is to say you only need reset once, either reset tile0 or tile1 should be ok.

now i am trying to delete the audio ports, but dfu failed when i just delete a few of them.
Function_Block_Diagram.jpg
(29.27 KiB) Not downloaded yet
Function_Block_Diagram.jpg
(29.27 KiB) Not downloaded yet
as the function block diagram upside, the function in red circle is what we need, it seems the dfu function should be ok when i delete all the other parts. but dfu failed when i just delete just a few of audio ports.
any ideas?
TonyXiao
Active Member
Posts: 44
Joined: Fri Mar 29, 2019 3:58 am

Post by TonyXiao »

Hi all

Now the audio ports only left the PORT_I2S_BCLK can not be deleted.
<!-Audio Ports->
<Port Location = "XS1_PORT_1H" Name = "PORT_I2S_BCLK" />

as long as the following p_bclk is commented out, the DFU function fails.
firmware stuck in such if inside sentences:
/* If running in application mode stop audio */
/* Don't interupt audio for save and restore cmds */
if ((DFU_IF == INTERFACE_NUMBER_DFU) && (sp.bRequest != XMOS_DFU_SAVESTATE) &&
(sp.bRequest != XMOS_DFU_RESTORESTATE))
{
printstrln("runs to here 0");
// Stop audio
outuint(c_audioControl, SET_SAMPLE_FREQ);
outuint(c_audioControl, AUDIO_STOP_FOR_DFU);
// Handshake
chkct(c_audioControl, XS1_CT_END);
}
User avatar
gamefunc
New User
Posts: 2
Joined: Wed Jun 28, 2023 10:25 am

Post by gamefunc »

xu208 dfu also not work;

env: win 10 22H2; dfu win driver: Zadig, WinUSB(v6.1.7600....);

# win program(simple):
err = libusb_init(nullptr);
err = find_xmos_device_set_device_handle_and_dfu_interface_num(my_xmos_device_pid);
err = libusb_claim_interface(
XMOS_DEVICE_HANDLE, XMOS_DFU_INTERFACE_NUM);
let_xmos_reset_into_dfu_mode():
int nread = libusb_control_transfer(
XMOS_DEVICE_HANDLE,
DFU_REQUEST_TO_DEV, XMOS_DFU_RESETINTODFU,
0, XMOS_DFU_INTERFACE_NUM,
NULL, 0, 0);


I drew a development pcb board myself, without xtag, I lighted the LEDs in the following places,
Does not light up after chkct(c_audioControl, XS1_CT_END);


# xmos:
if (interfaceNum == DFU_IF) {
int reset = 0;

if ((DFU_IF == INTERFACE_NUMBER_DFU) &&
(sp.bRequest != XMOS_DFU_SAVESTATE) &&
(sp.bRequest != XMOS_DFU_RESTORESTATE)){

// light:
port_enable(led_0);
port_out(led_0, 1);

// Stop audio
outuint(c_audioControl, SET_SAMPLE_FREQ);
outuint(c_audioControl, AUDIO_STOP_FOR_DFU);

// light:
port_enable(led_1);
port_out(led_1, 1);

// Handshake
chkct(c_audioControl, XS1_CT_END);

// not light
port_enable(led_2);
port_out(led_2, 1);
}// if DFU_IF == ...

result = DFUDeviceRequests(
ep0_out, &ep0_in, &sp, null,
g_interfaceAlt[sp.wIndex],
dfuInterface, &reset);
......
User avatar
gamefunc
New User
Posts: 2
Joined: Wed Jun 28, 2023 10:25 am

Post by gamefunc »

Image
Image

ok, test upgrade final. 710 -> 711;
just delete if ((DFU_IF == INTERFACE_NUMBER_DFU) && xxx {};
let it not run chkct(c_audioControl, XS1_CT_END);

dfu ok, but the audio no,
I think the problem is in the window usb driver;
edit it later;
Last edited by gamefunc on Wed Jun 28, 2023 1:22 pm, edited 2 times in total.
User avatar
Ross
XCore Expert
Posts: 962
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

gamefunc wrote: Wed Jun 28, 2023 10:40 am xu208 dfu also not work;
...
This is a very old thread, I'd probably start a new one..
User avatar
gamefunc
New User
Posts: 2
Joined: Wed Jun 28, 2023 10:25 am

Post by gamefunc »

Ross wrote: Wed Jun 28, 2023 3:57 pm
gamefunc wrote: Wed Jun 28, 2023 10:40 am xu208 dfu also not work;
...
This is a very old thread, I'd probably start a new one..
ok ,can you give me the link
Post Reply