Reply
Posts: 9
Registered: ‎07-28-2017

CP2615 GPIO debounce duration

It is mentioned in CP2615 data sheet (Rev 1.1, section 3.4.2.1 HID Media Buttons) that

" The CP2615 can be configured to report common consumer control buttons through the HID interface. These active low inputs are debounced by the CP2615 and are used to generate the HID reports on both the leading and trailing edges of a button push."

 

My questions are :

1. What is the button debouncing period?

2. What is the estimated latency at the time when a button is pressed to the time a notification report message is sent out by CP2615 on USB interface?

 

Please advice.

Thanks.

Posts: 233
Registered: ‎08-19-2015

Re: CP2615 GPIO debounce duration

Hi @paulkuan,

 

Thank you for your inquiry into the GPIO debounce period and latency of the CP2615.  I have the following information about this:

 

1. What is the button debouncing period?

>> The button debouncing period is 40 ms.

 

2. What is the estimated latency at the time when a button is pressed to the time a notification report message is sent out by CP2615 on USB interface?

 

>>  We have not completely characterized this data. After the debounce is satisfied the data will be reported over USB with little delay. GPIO state information is conveyed from the CP2615 to the host over a USB HID (interrupt) endpoint, which has a regular IN packet/frame period of 1 ms.  The total latency of a GPIO event notification arriving at host software would be equal to the GPIO debounce period in the device + the HID report latency (up to 1 ms over the physical interface) + any latency or delay in the host operating system.  We have not measured host operating system internal delay before it can be reported to the application.  

 

I hope this information helps.

 

Regards,

Mitch

 

 

Posts: 488
Registered: ‎02-21-2014

Re: CP2615 GPIO debounce duration

[ Edited ]

Edit: It looks like Mitch beat me to the punch! I would take his response more as gospel than mine.

 

From what I can tell, the buttons are sampled every 20 ms, and it takes two concurrent samples of the same value to report a change in state. So, I believe the buttons are debounced for 20 ms to 40 ms (that is, if the edge occurred immediately before the sample, it would take very slightly more than 20 ms to result in a button press. If the edge occurred immediately after the sample, it would take very slightly less than 40 ms to register a press).

 

I'm not sure of the additional HID latency. With USB, of course, you can expect this to be up to 1 ms from the time the HID report is loaded in the FIFO and the time the report is actually transmitted (in case the HID report is transmitted on the next USB frame). The HID interface also appears to be polled on 20 ms intervals, but I'm not sure if those are synced with the GPIO polling. If they're not, I'm assuming there could be up to an additional 20 ms before the HID report gets shot up to the host.

 

So, just as an estimate, the GPIO latency from press to HID report should be 20-61 ms. I don't see how it could be less than 20 ms, or more than 61 ms.

Posts: 9
Registered: ‎07-28-2017

Re: CP2615 GPIO debounce duration

Thanks Brian and Mitch for the answers. 

If 24 bit audio recording is being performed,  how much will this latency be affected ?

Please advice further.

Thanks.

Posts: 488
Registered: ‎02-21-2014

Re: CP2615 GPIO debounce duration

[ Edited ]

Well, it shouldn't be any. The audio endpoints are Isochronous type, which effectively means that they are high-bandwidth, but it's okay for USB to drop some of the packets. The HID endpoints are Interrupt type, which mean they are guaranteed to get at least one slot in a USB frame (if requested) - effectively guaranteed latency.

 

So, even when streaming audio both ways, the HID reports should make it out on-time (i.e. with, at most, one frame (1ms) of latency). 

 

http://www.beyondlogic.org/usbnutshell/usb4.shtml

Posts: 9
Registered: ‎07-28-2017

Re: CP2615 GPIO debounce duration

HI Brian,

   Thanks again for your clarifications.  Couple more questions below:

1. HID interface in CP2615 has interrupt type transfer.  USB host will poll the device at a frequency specified in the endpoint descriptor (ie. bInterval).  This endpoint descriptor will be sent from CP2615 to the host during enumeration.  What is the value of this bInterval parameter set in CP2615?   1ms as you said in previous post?

 

2. Since IOP is run on the Serial IO Interface, which has bulk type transfer without latency guarantee, all I/O input and output access using IOP will not have latency guarantee as in the HID Interface, right?

 

Thanks.

Posts: 9
Registered: ‎07-28-2017

Re: CP2615 GPIO debounce duration

With some help from my colleagues, I got some results for my two questions below:

1. HID interface in CP2615 has interrupt type transfer.  USB host will poll the device at a frequency specified in the endpoint descriptor (ie. bInterval).  This endpoint descriptor will be sent from CP2615 to the host during enumeration.  What is the value of this bInterval parameter set in CP2615?   1ms as you said in previous post?

By using some USB traffic monitor software running on PC, it was found that the interrupt endpoint descriptor has bInterval set as 20ms.  Since this is the only one interrupt endpoint found after CP2615 device enumeration,  I guess this should be the one we are looking for.  

 

is this bInterval parameter be programmable, say change to 1ms?

 

2. Since IOP is run on the Serial IO Interface, which has bulk type transfer without latency guarantee, all I/O input and output access using IOP will not have latency guarantee as in the HID Interface, right?

After reading some portions of USB 2.0 spec, bulk transfer does not guarantee latency as it is the lowest priority type of transfer, from bandwidth allocation perspective.  So, i guess the answer to my question is that no latency guarantee on IOP.

 

Here is my new question about button debouncing:

3. Can button debounce be turned off in CP2615?  or can the debouncing period be changed? 

 

The reason of asking all the above questions is to find a way to reduce the latency (below 10ms) of HID button notifications as much as possible when a button is pressed.   If there is any other ways to achieve this with CP2615,  please advice.

 

Thanks.