XUD_GetBuffer Memory access exception Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
ejolson9
Member
Posts: 12
Joined: Mon Aug 10, 2015 8:55 pm

XUD_GetBuffer Memory access exception

Post by ejolson9 »

Hello,

I have added a USB interface to the "USB 2.0 Audio Device Software" available on this page : https://www.xmos.com/support/boards?pro ... 4&secure=1
It enumerates in Windows just fine, and I've installed a custom WinUSB driver for my particular interface. I can also successfully open this device through the WinUSB API and send a control transfer to the device.

I have added special handling code to endpoint0.c in module_usb_audio, which detects specific requests made. All I am currently attempting to do is read a byte sent with a control transfer, like so:

Code: Select all

result = XUD_GetBuffer(c_ep0_out, buffer, &length);
Which has worked fine in other projects, but not in the audio project. Here is the exact error, with some debugging prints beforehand:

Code: Select all

sp details:
sp.bRequestType: 0x0040
vend req type: 0x0040
sp.bRequest: 0x0050
sp.wValue: 0x0000
sp.wIndex: 0x0001
sp.wLength: 0x0001
in WRITE_COMMAND_REQUEST...
xrun: Program received signal ET_LOAD_STORE, Memory access exception.
      [Switching to tile[0] core[3] (dual issue)]
      XUD_GetData () at C:/Users/erolson/xu216work/module_xud/src/XUD_EpFuncs.S:280

      280	    ldw        r10, r0[9]                       // Check if we missed a reset
      Current language:  auto; currently asm
WRITE_COMMAND_REQUEST is a custom command sent from my WinUSB code. You can see some of the details of the setup packet.

Does anyone know why I am getting a memory access exception here? Is there another way to read usb data in endpoint0.c ?
View Solution
User avatar
Ross
Verified
XCore Legend
Posts: 1195
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Do you have a USB bus trace at all?
ejolson9
Member
Posts: 12
Joined: Mon Aug 10, 2015 8:55 pm

Post by ejolson9 »

I just started working on this again, and this was my own error.

c_ep0_out was a chanend, but should have been just ep0_out which was returned from a call to XUD_InitEp(...).

After changing this, the problem went away and I was able to correctly read a byte send from windows.
User avatar
Ross
Verified
XCore Legend
Posts: 1195
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Thanks for letting us know. Glad it's now working.