<?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] USBD event allocation failed! and USBD event queue full! when using battery measurement.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110956/usb-hid-usbd-event-allocation-failed-and-usbd-event-queue-full-when-using-battery-measurement</link><description>Hello Nordic team. 
 I&amp;#39;ve got some trouble with the HID and his event queue when enabling the battery measurement. 
 I&amp;#39;m working with get set and everything seems to work fine so far, but when I&amp;#39;m enabling my battery measurement procedure this two errors</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 08 May 2024 08:13:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110956/usb-hid-usbd-event-allocation-failed-and-usbd-event-queue-full-when-using-battery-measurement" /><item><title>RE: [USB HID] USBD event allocation failed! and USBD event queue full! when using battery measurement.</title><link>https://devzone.nordicsemi.com/thread/482446?ContentTypeID=1</link><pubDate>Wed, 08 May 2024 08:13:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5583327b-9b7f-41c6-81a1-1f89e5984957</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Always happy to help out.&lt;/p&gt;
&lt;p&gt;In-place logging in equal or higher priority threads will delay other workqueues/threads from running, which again can be problematic especially for USB responses. It is fine to log if CONFIG_LOG_MODE_DEFERRED is set.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [USB HID] USBD event allocation failed! and USBD event queue full! when using battery measurement.</title><link>https://devzone.nordicsemi.com/thread/482266?ContentTypeID=1</link><pubDate>Tue, 07 May 2024 11:54:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c07bad4b-455b-4b12-88ed-5758d8570f80</guid><dc:creator>Martdur</dc:creator><description>&lt;p&gt;True !&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I disabled once(because of dropped messages) and never put it back.&lt;/p&gt;
&lt;p&gt;So as I understand too much LOG outside usb related function will delayed further LOG that are called from time sensitive function in the usb driver ?&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the help !&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards.&lt;/p&gt;
&lt;p&gt;Martin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [USB HID] USBD event allocation failed! and USBD event queue full! when using battery measurement.</title><link>https://devzone.nordicsemi.com/thread/482238?ContentTypeID=1</link><pubDate>Tue, 07 May 2024 10:23:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5221d05f-b7da-425a-89f8-89287321279d</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What is your LOG_MODE configured to?&lt;/p&gt;
&lt;p&gt;If you do not log in a dedicated thread (ie. CONFIG_LOG_MODE_DEFERRED is not y-selected), in-place logging is used, which will cause a timing skew when logging from interrupt / workqueue context. This can explain the behavior that you&amp;#39;re seeing.&lt;/p&gt;
&lt;p&gt;You ideally want&amp;nbsp;&lt;span&gt;CONFIG_LOG_MODE_DEFERRED=y if you&amp;#39;re logging from time-sensitive functions.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [USB HID] USBD event allocation failed! and USBD event queue full! when using battery measurement.</title><link>https://devzone.nordicsemi.com/thread/482212?ContentTypeID=1</link><pubDate>Tue, 07 May 2024 08:42:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ec43bf1-d9e7-460a-a98c-cb6e2fcaf9fc</guid><dc:creator>Martdur</dc:creator><description>&lt;p&gt;So I solve the issue with a quick fix :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I was measuring the battery level in a work handler trigger every x times with a timer.&lt;/p&gt;
&lt;p&gt;In this handler I was doing&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the battery measurement&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Log the battery value&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Log the timestamp using :&amp;nbsp;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;date_time_now&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;gmtime&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Removing the timestamp print seems to solve the issue but this is not a normal behavior.&lt;/p&gt;
&lt;p&gt;Is there a link between the LOG module and the USBD event queue ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;or even between&amp;nbsp;date_time and the USBD event queue ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>