<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>USB HID reliability issue on macOS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/80037/usb-hid-reliability-issue-on-macos</link><description>I am currently working on a project developing a USB HID product based on the nRF52840. I have run into an issue regarding USB communication reliability and am seeking the advice of others who know the Nordic products better. 
 The primary issue is that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Oct 2021 13:09:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/80037/usb-hid-reliability-issue-on-macos" /><item><title>RE: USB HID reliability issue on macOS</title><link>https://devzone.nordicsemi.com/thread/333067?ContentTypeID=1</link><pubDate>Thu, 07 Oct 2021 13:09:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fb93c68-4885-484b-920f-5c90328b608b</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I got some feedback on this. Could you try to increase the queue size (upto max 64)?&lt;/p&gt;
&lt;p&gt;Seems like running without the queue could cause issues particularly when SOF start appearing after power saving.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB HID reliability issue on macOS</title><link>https://devzone.nordicsemi.com/thread/332035?ContentTypeID=1</link><pubDate>Fri, 01 Oct 2021 00:32:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50bbbc34-18c6-4d31-8439-b6ed33fa375d</guid><dc:creator>ANewman</dc:creator><description>&lt;p&gt;Understood, and thanks for considering this issue.&lt;/p&gt;
&lt;p&gt;The main thing I need to understand is whether there are likely to be any side-effects from handling all USBD events in interrupts compared to using the event queue. Practical testing has not turned up any issues so far.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB HID reliability issue on macOS</title><link>https://devzone.nordicsemi.com/thread/331847?ContentTypeID=1</link><pubDate>Thu, 30 Sep 2021 07:56:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93932796-9bb2-49bb-9f35-4e838bbd4509</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I&amp;#39;ll check with our USB developers to see if they have some insight to share. Unfortunately, it might take some time for us to get back to you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB HID reliability issue on macOS</title><link>https://devzone.nordicsemi.com/thread/331403?ContentTypeID=1</link><pubDate>Tue, 28 Sep 2021 01:49:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a13e7140-0d06-422b-9c0b-30287aed7ed5</guid><dc:creator>ANewman</dc:creator><description>&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With the change so that only SOF events are processed within interrupts, and not queued, the problem was reduced, but not eliminated. It turns out my initial testing was insufficiently robust to catch all the conditions where the error would occur.&lt;/p&gt;
&lt;p&gt;A more robust fix seems to be to disable the event queue entirely. I assume this means that all USB messages are processed exclusively within interrupt context.&lt;/p&gt;
&lt;p&gt;With the USB event queue disabled I&amp;#39;m finally getting reliable message exchange with the various MACs under all tested scenarios:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// &amp;lt;e&amp;gt; APP_USBD_CONFIG_EVENT_QUEUE_ENABLE - Enable event queue.

// &amp;lt;i&amp;gt; This is the default configuration when all the events are placed into internal queue.
// &amp;lt;i&amp;gt; Disable it when an external queue is used like app_scheduler or if you wish to process all events inside interrupts.
// &amp;lt;i&amp;gt; Processing all events from the interrupt level adds requirement not to call any functions that modifies the USBD library state from the context higher than USB interrupt context.
// &amp;lt;i&amp;gt; Functions that modify USBD state are functions for sleep, wakeup, start, stop, enable, and disable.
//==========================================================
#ifndef APP_USBD_CONFIG_EVENT_QUEUE_ENABLE
#define APP_USBD_CONFIG_EVENT_QUEUE_ENABLE 0
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Whilst this change seems to solve the issue, it makes me slightly uncomfortable. The USB examples all use the event queue so I&amp;#39;m wondering what the consequences of disabling it will be?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>