usb audio and hid

Technical questions regarding the XTC tools and programming with XMOS.
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

usb audio and hid

Post by genap »

Hello,
in my design (based on dj reference design) I use HID to exchange commands and statuses between the board and pc.
It works fine, there is no interruption of audio stream.
Nevertheless, the levels of all input audio signals drop 8 dB when HID is enabled, even if
I don't send/receive messages. I tried to increase bInterval in HID descriptors from 8 to 100 - result is still the same.

What could be a reason for such behavior ?
Is there way around it ?

Gennady


User avatar
Ross
XCore Expert
Posts: 972
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

The host isn't setting the volume via the HID endpoint is it?
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

Post by genap »

No. HID terminal is not even on.
User avatar
Ross
XCore Expert
Posts: 972
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

HID terminal?

Windows etc will recognise the play/pause/vol etc controls in the default design. If the device sends a HID volume control change msg to the host, the host could send a volume control to the usb audio device...
Also, have you got the ADC example code enabled?

Simple test. Mod the void Vendor_ReadHidButtons() to look like:

Code: Select all

void Vendor_ReadHIDButtons(unsigned char hidData[])
{
    hidData[0] = 0;
}
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

Post by genap »

I am using HID terminal to test message exchange.
No volume change messages are supposed to be sent over hid endpoint.
HID_CONTROLS in a reference design is undefined.
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

Post by genap »

Ross wrote:
Simple test. Mod the void Vendor_ReadHidButtons() to look like:

Code: Select all

void Vendor_ReadHIDButtons(unsigned char hidData[])
{
    hidData[0] = 0;
}
That is how it looks like.
User avatar
Ross
XCore Expert
Posts: 972
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

What about ADC_VOL_CONTROL?

Apart from this I have no other ideas. HID shouldn't affect the audio.
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

Post by genap »

Undefined
User avatar
Ross
XCore Expert
Posts: 972
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

how have you enabled hid then?
genap
Experienced Member
Posts: 99
Joined: Sat Aug 31, 2013 11:23 pm

Post by genap »

I created my own hid descriptors.

Enabled case GET_DESCRIPTOR in endpoint0().
Created hid routine for my application (now it just sends back f/w version on any received message):

Code: Select all

void Front_control(chanend chan_ep_from_host, chanend chan_ep_to_host)
{

  union Data
  {
	int host_transfer_buf[BUFFER_SIZE];
	unsigned char ubuf[BUFFER_SIZE*4];
  } data;

  int host_transfer_length = 0;

  XUD_ep ep_from_host = XUD_Init_Ep(chan_ep_from_host);
  XUD_ep ep_to_host = XUD_Init_Ep(chan_ep_to_host);

  Init_peripherals();

  while (1)
  {

    /* Receive a buffer (512-bytes) of data from the host */
    host_transfer_length = XUD_GetBuffer(ep_from_host, (data.host_transfer_buf, 
                           char[BUFFER_SIZE * 4]));
    if (host_transfer_length < 0) {
        XUD_ResetEndpoint(ep_from_host, ep_to_host);
        continue;
    }

    data.ubuf[0] = fver[0];
    data.ubuf[1] = fver[1];
    data.ubuf[2] = fver[2];
    data.ubuf[3] = fver[3];
    data.ubuf[4] = fver[4];

    /* Send the modified buffer back to the host */
    host_transfer_length = XUD_SetBuffer(ep_to_host, (data.host_transfer_buf,   
                           char[BUFFER_SIZE * 4]), host_transfer_length);
    if(host_transfer_length < 0)
        XUD_ResetEndpoint(ep_from_host, ep_to_host);

    Delay_us(10000);	// 10 ms

  }
}