Page 1 of 2

Hello ad first problem

Posted: Mon Oct 09, 2017 11:04 am
by PaoloF
Hello,
my name is Paolo, I would like to try to understand something about the usb audio interfaces.

I bought an XK-AUDIO-216-MC-AB card, I spent some days to read a bit of documentation and I would like to start testing if the card works.
So I installed the evaluation drivers on the PC, powered the board (some LEDs lit up on the board) and I connected a USB 2.0 cable (I tried both jacks, first with micro then with type A) ... Problem: the pc does not see the usb device and does not install the drivers, there is no usb Audio device connected in the drivers control panel
What is missing?

Re: Hello ad first problem

Posted: Tue Oct 10, 2017 5:47 pm
by infiniteimprobability
Hi Paolo, welcome to xcore!

I'm pretty sure the answer to your question
What is missing?
is the firmware.

You will need to download and build it. You can get it from https://www.xmos.com/support/software/uac2

The design guide documentation available on that page will tell you how to build and download it.

Re: Hello ad first problem

Posted: Wed Oct 11, 2017 1:19 pm
by PaoloF
Hi,
thanks for answer, but I have already tried to flash firmware on the board: i have built for example app_usb_aud_xk_216_mc_2i10o10xxxxxx.xe

During the downloading process:
  - the LEDs on xTag-3 blink and switch from red to green;
  - some LEDs on the Multichannel Board have switched off and then on;
  - on xTime Composer console, I see before some warning messages, then many "write" and "verified' messages, the last one is "Site 0 is done successfully".

However at the end of the process, my PC does not see the board as a USB device.
I have also ligthed-off the board, detached xTag-3 and ligthed-on the board, nothing changed.

Re: Hello ad first problem

Posted: Wed Oct 11, 2017 1:42 pm
by infiniteimprobability
OK - apologies. That wasn't clear from the first post.

That really should work..

Try running rather than flashing. Preferably with debug on. What happens when you break - where is the code?

Also, do you see BCLK and LRCLK toggling? (That would indicate the code is running)

Re: Hello ad first problem

Posted: Wed Oct 11, 2017 6:51 pm
by PaoloF
Well, I tried running the program with debugging, but I apologize, I do not know the program well, and not even xTime Composer, so I'm not sure I did it correctly:
- I have connected the xTag-3 and board to the PC; then I switch-on the Board;
- clicking on app_usb_aud_xk_216_mc_2i10o10xxxxxx.xe, with rigth button, I have chosed 'Debug as' and 'Debug configuration';
- on main Tab i verified that Tharget was xTag-3, then I have cliked 'Debug'
- xTime has switched to debug perspective, and, in Debugger tab, I see:
- xCORE debugger
- tile[0] core[0] (Running)CDTDebugModelPresentation.12=signal
- tile[1] core[0] (Running)CDTDebugModelPresentation.12=signal
- xgdb
- C:\ .... \ app_usb_aud_xk_216_mc_2i10o10xxxxxx.xe

If I select xgdb line, in Console I see some messages, the lasts are:
Start address 0x40000, load size 25507
Transfer rate: 177 KB/sec, 1594 bytes/write.
info program
Program stopped at 0x40000.
It stopped with signal SIGTRAP, Trace/breakpoint trap.
Type "info stack" or "info registers" for more information.

Can you explain to me what I should do?
Thanks

Re: Hello ad first problem

Posted: Thu Oct 12, 2017 9:15 am
by infiniteimprobability
Could you answer my other question?
Also, do you see BCLK and LRCLK toggling? (That would indicate the code is running)
The I2S section should autonomously run and generate audio clocks even if USB is not connected. This will tell us if the program has loaded or not and hopefully start to pinpoint the issue.

Do you have a USB analyser? This can be very handy to see how far the enumeration process got.

xgdb is just gdb so it's the same commands as you would normally use for debugging.

I would say something like:

Code: Select all

xgdb <mybinary.xe>
connect
run
(wait a second or two)
ctrl-c to break
info threads
Please post what the output of info threads is

Alternatively you could:

Code: Select all

xrun <myinary.xe>
(wait a second or two)
xrun --dumpstate <myinary.xe>
This will give info threads plus also backtrace for each core and info registers..

Re: Hello ad first problem

Posted: Thu Oct 12, 2017 3:18 pm
by PaoloF
Sorry, but I don't know how (or where) I should see "BCLK and LRCLK toggling".
I don't have a USB analyzer.

I succeed to see threads anc backtrace:

C:\Users\User\Desktop>xgdb app_usb_aud_xk_216_mc_2i10o10xxxxxx.xe
GNU gdb (XGDB) Community_14.3.0 (build 16341, Apr-10-2017)
Copyright (C) 2007 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-mingw32 --target=xcore-elf".
For bug reporting instructions, please see: http://www.xmos.com/support.
..
(gdb) connect
0x00040000 in _start ()
(gdb) run
Loading setup image to XCore 0
Loading section .text, size 0x18c lma 0x40000
Loading section .cp.rodata, size 0x18 lma 0x4018c
Loading section .dp.data, size 0x1c lma 0x401a4
Start address 0x40000, load size 448
Transfer rate: 29 KB/sec, 149 bytes/write.
Loading setup image to XCore 1
Loading section .text, size 0x40 lma 0x40000
Loading section .cp.rodata, size 0x18 lma 0x40040
Loading section .dp.data, size 0x8 lma 0x40058
Start address 0x40000, load size 96
Transfer rate: 768 bits in <1 sec, 32 bytes/write.
First stage multi-node boot started
First stage multi-node boot completed
Loading application image to XCore 0
Loading section .crt, size 0xac lma 0x40000
Loading section .init, size 0x1a lma 0x400ac
Loading section .fini, size 0x2e lma 0x400c6
Loading section .text, size 0x3b2c lma 0x400f4
Loading section .eh_frame, size 0x24 lma 0x43c20
Loading section .cp.rodata, size 0x32 lma 0x43c44
Loading section .cp.rodata.4, size 0x2a0 lma 0x43c78
Loading section .cp.const4, size 0x3c lma 0x43f18
Loading section .cp.rodata.cst4, size 0x94 lma 0x43f54
Loading section .ctors, size 0x3c lma 0x43fe8
Loading section .dtors, size 0x3c lma 0x44024
Loading section .dp.data, size 0x508 lma 0x44060
Loading section .dp.data.4, size 0x30 lma 0x44568
Loading section .dp.rodata, size 0x20 lma 0x44598
Loading section .dp.rodata.4, size 0x40 lma 0x445b8
Start address 0x40000, load size 17910
Transfer rate: 141 KB/sec, 1194 bytes/write.
Loading application image to XCore 1
Loading section .crt, size 0xac lma 0x40000
Loading section .init, size 0x1a lma 0x400ac
Loading section .fini, size 0x2e lma 0x400c6
Loading section .text, size 0x572c lma 0x40100
Loading section .eh_frame, size 0x24 lma 0x45830
Loading section .cp.rodata, size 0x72 lma 0x45858
Loading section .cp.rodata.4, size 0x4c lma 0x458cc
Loading section .cp.const4, size 0x40 lma 0x45918
Loading section .cp.rodata.const4, size 0x4 lma 0x45958
Loading section .cp.rodata.cst4, size 0x78 lma 0x4595c
Loading section .cp.rodata.string, size 0xdd lma 0x459d4
Loading section .ctors, size 0x3c lma 0x45ab4
Loading section .dtors, size 0x3c lma 0x45af0
Loading section .dp.data, size 0x808 lma 0x45b30
Loading section .dp.data.4, size 0x4c lma 0x46338
Loading section .dp.rodata.4, size 0x3c lma 0x46384
Start address 0x40000, load size 25507
Transfer rate: 159 KB/sec, 1594 bytes/write.

Program received signal SIGINT, Interrupt.
deliver (divide=0, curSamFreq=0, c_out=<value optimized out>, c_spd_out=<value optimized out>, c_adc=<value optimized out>)
at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/audio.xc:727
727 asm volatile("in %0, res[%1]" : "=r"(sample) : "r"(p_i2s_adc[index++]));
(gdb) info threads
6 tile[1] core[3] 0x0004414e in XUD_Manager ()
5 tile[1] core[2] XUD_GetSetupData_Retry () at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_xud/src/XUD_EpFuncs.S:41
4 tile[1] core[1] (dual issue) buffer (c_aud_out=2147681794, c_aud_in=2147683330, c_sof=2147681282, c_aud_ctl=2147684098, p_off_mclk=<value optimized out>,
c_hid=2147682818) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/usb_buffer/usb_buffer.xc:732
3 tile[1] core[0] (dual issue) decouple (c_mix_out=2147680258) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/usb_buffer/decouple.xc:911
2 tile[0] core[1] (dual issue) mixer1 (c_host=2147614722, c_mix_ctl=2147614978, c_mixer2=2147615490)
at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/mixer/mixer.xc:363
* 1 tile[0] core[0] (dual issue) deliver (divide=0, curSamFreq=0, c_out=<value optimized out>, c_spd_out=<value optimized out>, c_adc=<value optimized out>)
at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/audio.xc:727
(gdb)

Re: Hello ad first problem

Posted: Thu Oct 12, 2017 3:30 pm
by PaoloF
With dump, I see that there is a error signaled in the first line:

C:\Users\User\Desktop>xrun app_usb_aud_xk_216_mc_2i10o10xxxxxx.xe

C:\Users\User\Desktop>xrun --dumpstate app_usb_aud_xk_216_mc_2i10o10xxxxxx.xe
Program received signal SIGBUS, Bus error.
[Switching to tile[1] core[0] (dual issue)]
0x000425ac in decouple (c_mix_out=2147680258) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/usb_buffer/decouple.xc:911
911 GET_SHARED_GLOBAL(tmp, g_aud_to_host_flag);

***** Active Cores *****
6 tile[1] core[3] 0x0004414e in XUD_Manager ()
5 tile[1] core[2] XUD_GetSetupData_Retry () at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_xud/src/XUD_EpFuncs.S:41
4 tile[1] core[1] (dual issue) buffer (c_aud_out=2147681794, c_aud_in=2147683330, c_sof=2147681282, c_aud_ctl=2147684098, p_off_mclk=<value optimized out>, c_hid=2147682818) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/usb_buffer/usb_buffer.xc:732
* 3 tile[1] core[0] (dual issue) 0x000425ac in decouple (c_mix_out=2147680258) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/usb_buffer/decouple.xc:911
2 tile[0] core[1] (dual issue) mixer1 (c_host=2147614722, c_mix_ctl=2147614978, c_mixer2=2147615490) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/mixer/mixer.xc:363
1 tile[0] core[0] (dual issue) deliver (divide=0, curSamFreq=0, c_out=<value optimized out>, c_spd_out=<value optimized out>, c_adc=<value optimized out>) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/audio.xc:626

Thread 6 (tile[1] core[3]):

***** Call Stack *****
#0 0x0004414e in XUD_Manager ()
#1 0x00040eb5 in _Susb_audio_core_0.task.XUD_Manager.0 (frame=<value optimized out>) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/main.xc:314
#2 0x00045490 in __start_core ()

***** Disassembly *****
0x4414e <XUD_Manager+978>: in (2r) r0, res[r9] *
0x44150 <XUD_Manager+980>: add (2rus) r0, r4, 0x0
0x44152 <XUD_Manager+982>: add (2rus) r1, r6, 0x0
0x44154 <XUD_Manager+984>: add (2rus) r2, r5, 0x0
0x44156 <XUD_Manager+986>: add (2rus) r3, r8, 0x0

***** Registers *****
r0 0xbe612d0f -1100927729
r1 0x9 9
r2 0x1 1
r3 0x1 1
r4 0x2 2
r5 0x14 20
r6 0x1 1
r7 0x20 32
r8 0x7f610 521744
r9 0x301 769
r10 0x4e20 20000
r11 0x80031102 -2147282686
cp 0x45858 284760
dp 0x45b30 285488
sp 0x7f580 521600
lr 0x448d6 280790 read_periph_word + 26
pc 0x4414e 278862 XUD_Manager + 978
sr 0x0 0
spc 0x0 0
ssr 0x0 0
et 0x0 0
ed 0x0 0
sed 0x0 0
kep 0x40080 262272
ksp 0x4414e 278862

Thread 5 (tile[1] core[2]):

***** Call Stack *****
#0 XUD_GetSetupData_Retry () at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_xud/src/XUD_EpFuncs.S:41
#1 0x00040b58 in XUD_GetSetupBuffer (ep_out=300472, buffer=@0x7fcb0, length=@0x7fcac) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_xud/src/XUD_EpFunctions.xc:24
#2 0xffffffff in ?? ()
Backtrace stopped: frame did not save the PC
Current language: auto; currently asm

***** Disassembly *****
0x436e0 <XUD_GetSetupData_Retry>: testct (2r) r11, res[r10] *
0x436e2 <XUD_GetSetupData_Retry+2>: bt (ru6) r11, 0x25
0x436e4 <XUD_GetSetupData_NoReq>: in (2r) r1, res[r10] *
0x436e6 <XUD_GetSetupData_NoReq+2>: testct (2r) r11, res[r10] *
0x436e8 <XUD_GetSetupData_NoReq+4>: bf (ru6) r11, 0xf

***** Registers *****
r0 0x495b8 300472
r1 0x7fcb0 523440
r2 0x7fcac 523436
r3 0x78 120
r4 0x494b8 300216
r5 0x80031002 -2147282942
r6 0x495b8 300472
r7 0x1 1
r8 0x49838 301112
r9 0x0 0
r10 0x80030802 -2147284990
r11 0x0 0
cp 0x45858 284760
dp 0x45b30 285488
sp 0x7fc90 523408
lr 0x40b58 265048 XUD_GetSetupBuffer + 8
pc 0x436e0 276192 XUD_GetSetupData_Retry + 0
sr 0x40 64
spc 0x0 0
ssr 0x0 0
et 0x0 0
ed 0x0 0
sed 0x0 0
kep 0x40080 262272
ksp 0x436e0 276192

Thread 4 (tile[1] core[1] (dual issue)):

***** Call Stack *****
#0 buffer (c_aud_out=2147681794, c_aud_in=2147683330, c_sof=2147681282, c_aud_ctl=2147684098, p_off_mclk=<value optimized out>, c_hid=2147682818) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/usb_buffer/usb_buffer.xc:732
#1 0x00040f11 in _Susb_audio_core_0.task.buffer.1 (frame=<value optimized out>) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/main.xc:340
#2 0x00045490 in __start_core ()
Current language: auto; currently c

***** Disassembly *****
0x428f4 <buffer+344>: waiteu (0r) *
0x428f6 <buffer+346>: nop (0r)
0x428f8 <buffer+348>: add (2rus) r0, r6, 0x0
0x428fa <buffer+350>: ldw (ru6) r1, sp[0xd]
0x428fc <buffer+352>: ldaw (ru6) r2, sp[0x13]

***** Registers *****
r0 0x0 0
r1 0x0 0
r2 0x0 0
r3 0x0 0
r4 0x80030f02 -2147283198
r5 0x80030402 -2147286014
r6 0x80030c02 -2147283966
r7 0x80030602 -2147285502
r8 0x80030a02 -2147284478
r9 0x49888 301192
r10 0x49400 300032
r11 0x42910 272656
cp 0x45858 284760
dp 0x45b30 285488
sp 0x7fe30 523824
lr 0x427d4 272340 buffer + 56
pc 0x428f4 272628 buffer + 344
sr 0x141 321
spc 0x0 0
ssr 0x0 0
et 0x0 0
ed 0x0 0
sed 0x0 0
kep 0x40080 262272
ksp 0x428f4 272628

Thread 3 (tile[1] core[0] (dual issue)):

***** Call Stack *****
#0 0x000425ac in decouple (c_mix_out=2147680258) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/usb_buffer/decouple.xc:911
#1 0x00040f71 in _Susb_audio_core_0.task.decouple.3 (frame=<value optimized out>) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/main.xc:389
#2 0x00044544 in __start_other_cores ()
#3 0x00040e35 in usb_audio_core (c_mix_out=2147680258, c_mix_ctl=<value optimized out>, dfuInterface=<value optimized out>) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/main.xc:294
#4 0x00040f8d in __main__main_tile_1 (formal.c_mix_out1=<value optimized out>, formal.c_mix_ctl2=<value optimized out>, formal.dfuInterface3=<value optimized out>) at <synthesized>:562
#5 0x00043c2c in main ()

***** Disassembly *****
0x425ac <decouple+976>: bf (lru6) r0, -0xa7
0x425b0 <decouple+980>: stw (lru6) r10, dp[0x1031]
0x425b4 <decouple+984>: ldw (lru6) r2, dp[0x210]
0x425b8 <decouple+988>: ldw (lru6) r1, dp[0x1041]
0x425bc <decouple+992>: ldw (lru6) r0, dp[0x1043]

***** Registers *****
r0 0x0 0
r1 0x0 0
r2 0x494bc 300220
r3 0x20000000 536870912
r4 0x80030002 -2147287038
r5 0xac44 44100
r6 0xfffffffc -4
r7 0x0 0
r8 0x0 0
r9 0x1 1
r10 0x0 0
r11 0x40884 264324
cp 0x45858 284760
dp 0x45b30 285488
sp 0x7fec8 523976
lr 0x40f70 266096 _Susb_audio_core_0.task.decouple.3 + 16
pc 0x425ac 271788 decouple + 976
sr 0x102 258
spc 0x42324 271140 decouple + 328
ssr 0x102 258
et 0x0 0
ed 0x0 0
sed 0x0 0
kep 0x40080 262272
ksp 0x425ac 271788

Thread 2 (tile[0] core[1] (dual issue)):

***** Call Stack *****
#0 mixer1 (c_host=2147614722, c_mix_ctl=2147614978, c_mixer2=2147615490) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/mixer/mixer.xc:363
#1 0x00041098 in mixer (c_mix_in=<value optimized out>, c_mix_out=<value optimized out>, c_mix_ctl=<value optimized out>) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/mixer/mixer.xc:829
#2 0x00040fb9 in _Susb_audio_io_0.task.mixer.0 (frame=<value optimized out>) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/main.xc:435
#3 0x000439b4 in __start_core ()

***** Disassembly *****
0x410d0 <mixer1+56>: in (2r) r6, res[r2] *
0x410d2 <mixer1+58>: nop (0r)
0x410d4 <mixer1+60>: out (r2r) res[r0], r6 *
0x410d6 <mixer1+62>: nop (0r)
0x410d8 <mixer1+64>: setsr (u6) 0x1

***** Registers *****
r0 0x80020002 -2147352574
r1 0x80020102 -2147352318
r2 0x80020302 -2147351806
r3 0x44648 280136
r4 0x44930 280880
r5 0x2 2
r6 0x0 0
r7 0x0 0
r8 0x0 0
r9 0x0 0
r10 0x0 0
r11 0x0 0
cp 0x43c44 277572
dp 0x44060 278624
sp 0x7fa70 522864
lr 0x41098 266392 mixer1 + 0
pc 0x410d0 266448 mixer1 + 56
sr 0x140 320
spc 0x0 0
ssr 0x0 0
et 0x0 0
ed 0x0 0
sed 0x0 0
kep 0x40080 262272
ksp 0x410d0 266448

Thread 1 (tile[0] core[0] (dual issue)):

***** Call Stack *****
#0 deliver (divide=0, curSamFreq=0, c_out=<value optimized out>, c_spd_out=<value optimized out>, c_adc=<value optimized out>) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/audio.xc:626
#1 0x00040df5 in audio.task.0 (frame=0x7fef4) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/audio.xc:1209
#2 0x00040cfd in audio (c_mix_out=2147615746, c_config=0, c=<value optimized out>, dfuInterface=<value optimized out>) at C:/Users/User/Desktop/XK-AUDIO-216-MC-AB/Prova/module_usb_audio/audio.xc:1036
#3 0x00040fd9 in __main__main_tile_0 (formal.c_mix_out4=2147615746, formal.c_mix_ctl5=1, formal.dfuInterface6=1)
Backtrace stopped: frame did not save the PC

***** Disassembly *****
0x408ec <deliver+452>: in (2r) r5, res[r3] *
0x408ee <deliver+454>: nop (0r)
0x408f0 <deliver+456>: bitrev (2r) r5, r5
0x408f2 <deliver+458>: nop (0r)
0x408f4 <deliver+460>: bf (lru6) r1, 0xb

***** Registers *****
r0 0x80020402 -2147351550
r1 0x1 1
r2 0x1 1
r3 0x10a00 68096
r4 0x10f00 69376
r5 0xffffe000 -8192
r6 0x0 0
r7 0x0 0
r8 0x10500 66816
r9 0x10900 67840
r10 0x10b00 68352
r11 0x10800 67584
cp 0x43c44 277572
dp 0x44060 278624
sp 0x7fe28 523816
lr 0x40df4 265716 audio.task.0 + 80
pc 0x408ec 264428 deliver + 452
sr 0x140 320
spc 0x0 0
ssr 0x0 0
et 0x0 0
ed 0x1 1
sed 0x0 0
kep 0x40080 262272
ksp 0x408ec 264428

C:\Users\User\Desktop>

Re: Hello ad first problem

Posted: Fri Oct 13, 2017 10:16 am
by infiniteimprobability
BCLK and LRCLK toggling
- there are two header pins in the middle of the board where you can attach a scope to monitor these signals.

From the dump, it looks to me as though the firmware has loaded and is running OK.

Code: Select all

1 tile[0] core[0] (dual issue) deliver
is the I2S task which looks OK but it would be useful to confirm this is looping by seeing the clocks toggling. Please confirm..

If they are (which I would guess they are), then it feels like a USB side issue..

Try this pre-built binary which is known working which is limited to USB audio class 1, stereo and so doesn't need a driver on windows..

Re: Hello ad first problem

Posted: Mon Oct 16, 2017 10:22 am
by PaoloF
Good morning,
I tried with pre-built bynary limited to USB audio class 1, but the result is the same: My pc dont't see the device.

I ordered a logical analyzer, in a few days, when I receive it I can answer the question on BLCK and LRCK.