XE216-512-TQ128 HID Play, Stop Volume...

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
Post Reply
yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

XE216-512-TQ128 HID Play, Stop Volume...

Post by yes2i2s »

Hello guys

I am designing a board using the XE216-512-TQ128, based on the multichannel dev board design. First prototype I've had assembled is working fine.

With the next board I want to use buttons on the device to control the media player on the host computer/device.

Please can someone tell me the software changes I need to make to enable this, I read it was one parameter that needs setting to '1' to enable, is that all?

And importantly, which hardware pins on the chip are used in this firmware to control the HID device the XMOS passes to the host device? Where do I connect the push buttons, are these active-low, and do they need a capacitor de-bounce?

Thanks!


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

Post by mon2 »

yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

Post by yes2i2s »

I read that the following is required to tell the firmware that you want this functionality:



This functionality is enabled by setting the HID_CONTROLS define to 1. Setting to 0
disables this feature.

When turned on the following items are enabled:

1. HID descriptors are enabled in the Configuration Descriptor informing the host
that the device has HID interface
2. A Get Report Descriptor request is enabled in endpoint0.
3. Endpoint data handling is enabled in the buffer core
The Get Descriptor Request enabled in endpoint 0 returns the report descriptor for
the HID device. This details the format of the HID reports returned from the device
to the host. It maps a bit in the report to a function such as play/pause.

The USB Audio Framework implements a report descriptor that should fit most basic
audio device controls. If further controls are neccisary the HID Report Descriptor
in descriptors_2.h should be modified. The default report size is 1 byte with the

format as follows:

Bit Function

0 Play/Pause
1 Scan Next Track
2 Scan Prev Track
3 Volume Up
4 Volume Down
5 Mute
6-7 Unused
yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

Post by yes2i2s »

But nowhere can I find which pins on the XE216-512-TQ128 these bit's will be mapped to, and what electrical state they need to be in to activate. Or are these mappings not even present?

Basically in this product I want an available SPDIF input (I made another thread for that one), and host media player control using buttons. If I can't have these then that's a massive downer on market appeal, but I'd have to live with it.

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

Post by mon2 »

I think the push button details you are after can be found inside the hardware manual for the XCORE-200 Audio Platform:

https://www.xmos.com/jp/support/boards? ... nent=18687

See chapter 11


Review the document and search for the keyword button - they have 3 such buttons which are active low (respectively have local pull-ups to park the button to a HIGH when open). The debouncing will be handled by the XMOS IP. The same 3 buttons are being mapped to 2 tiles to allow for your code to be flexible to use on either tile.


Image



The same buttons are mapped to:

Tile # 1

X1D04 (BUTTON_1)
X1D05 (BUTTON_2)
X1D06 (BUTTON_3)
X1D07 (SWITCH_1)


Tile # 0

X0D16 (BUTTON_1)
X0D17 (BUTTON_2)
X0D18 (BUTTON_3)
X0D19 (SWITCH_1)

For quick and painless testing, use the same port pins so you can apply the XMOS IP with their definitions as-is otherwise it should not be too difficult to alter the pins to suit your target.
Image


If you are looking for quality push buttons at very competitive costs, here is a supplier we have used (also for our USB connectors with high tension fit):

SHEN ZHEN HOMYET PARTS ELECTRONICS CO.,LTD
Seven Zhang /+86 15112386375
Tel:+86-755-83676824 29768399
Fax:+86-755-83676835 27888655
Add:306,E Building ,HuaChuangDa Industrial Park,Bao'an 42 District,Shenzhen , Guangdong Province,CHINA
Mail: seven@homyet.com; 2355400604@qq.com
Web:www.homyet.com
QQ: 2355400604
skype: sevenzhang07@hotmail.com
WhatsApp:+86 15112386375
yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

Post by yes2i2s »

Thanks for the links and information.

So for:

0 Play/Pause
1 Scan Next Track
2 Scan Prev Track
3 Volume Up
4 Volume Down
5 Mute

I need 6 push buttons, I could edit that code and add buttons, but how do I assign them to the said bit functions of those HID controls?

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

Post by mon2 »

Share the exact details of where you will map these buttons. That is, which ports will you use?

Also review this article..

https://notes.iopush.net/custom-usb-hid ... -keyboard/
yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

Post by yes2i2s »

Okay so I am using the XMOS dev board, but designing my own PCB based on that reference design, so pin wise I can use any available I/O's

I can't say I actually know any more. From the documentation, it gave the impression that the media controls are already configured, you just need to set the HID_CONTROLS define to '1' to enable it.

What I wanted to know is when you do this, does this map those controls to pins on the processor or do you need to do that, and if the latter then how / where do the code edits need to go?

Regarding the existing buttons, there are only 3 and I need 6, I expect once I've worked out how to link these buttons to the media controls, I can work out how to add the rest of the buttons. It's just the code edits required to get from the HID functions, to the required physical pins I need help with.

Thanks!
Post Reply