<?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]Boot protocol Stack overflow</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111429/usb-hid-boot-protocol-stack-overflow</link><description>Hello ! 
 
 I&amp;#39;m struggling a bit with the USB HID boot protocol, I have a lot of stack overflow error when trying to do operations while in the get_report callback. 
 I know that I don&amp;#39;t have to do time consuming operations while in callback, but not</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 04 Jun 2024 16:31:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111429/usb-hid-boot-protocol-stack-overflow" /><item><title>RE: [USB HID]Boot protocol Stack overflow</title><link>https://devzone.nordicsemi.com/thread/487370?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 16:31:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38d1b25c-6dd6-4898-9f43-562967d0d762</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Martin&lt;/p&gt;
&lt;p&gt;Kconfig parameters generally don&amp;#39;t define low and high limits, just one or more default values which might depend on other config parameters.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will close the ticket then &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [USB HID]Boot protocol Stack overflow</title><link>https://devzone.nordicsemi.com/thread/487049?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2024 08:13:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6dbddbce-d942-4526-9fe6-2efb20cdb962</guid><dc:creator>Martdur</dc:creator><description>&lt;p&gt;Hi Torbjorn,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;My bad I thought the&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/subsys/usb/device/Kconfig#L138"&gt;USB_WORKQUEUE_STACK_SIZE&lt;/a&gt;&lt;span&gt;&amp;nbsp;was limited in the upper limit.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kinds regards.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Martin.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [USB HID]Boot protocol Stack overflow</title><link>https://devzone.nordicsemi.com/thread/486026?ContentTypeID=1</link><pubDate>Mon, 27 May 2024 12:45:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7676f30d-002e-4f21-abb8-9e7da5761efe</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Martin&lt;/p&gt;
&lt;p&gt;Glad I could help.&amp;nbsp;&lt;/p&gt;
[quote user="MartKanope"]&lt;strong&gt;note&lt;/strong&gt; : It would be nice to have a larger max usb workqueue size.[/quote]
&lt;p&gt;Not sure what you mean. There shouldn&amp;#39;t be any defined max size, as long as you have enough RAM available.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [USB HID]Boot protocol Stack overflow</title><link>https://devzone.nordicsemi.com/thread/486012?ContentTypeID=1</link><pubDate>Mon, 27 May 2024 11:40:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9b6bb15-30a8-42c8-bbc7-316e15843414</guid><dc:creator>Martdur</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;Torbj&amp;oslash;rn&lt;/span&gt;,&lt;/p&gt;
&lt;p&gt;Sorry I was a bit tired when opening this topic and yes your right.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m already using the max stack size, the issues seems to come from my&amp;nbsp; architecture; since I&amp;#39;m using &lt;span&gt;std::&lt;/span&gt;container..&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll see if I need to change it later.&lt;/p&gt;
&lt;p&gt;Thanks for the response.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;note&lt;/strong&gt; : It would be nice to have a larger max usb workqueue size.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best 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]Boot protocol Stack overflow</title><link>https://devzone.nordicsemi.com/thread/485632?ContentTypeID=1</link><pubDate>Thu, 23 May 2024 12:30:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5eb42c9-d761-429e-97d2-db551e1cc9ac</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Martin&lt;/p&gt;
&lt;p&gt;The time spent and the stack memory used is essentially two separate issues, and you need to be aware of them both, since they are not directly related.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you incur stack overflows often you might want to consider which variables you are putting on the stack and which you are not.&amp;nbsp;Consider making larger arrays or structs static or global, to avoid them being put on the stack, since pushing a lot of data on the stack will also incur CPU overhead and increase runtime.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As for increasing the stack size I assume it is the &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/subsys/usb/device/Kconfig#L138"&gt;USB_WORKQUEUE_STACK_SIZE&lt;/a&gt; parameter you would need to change. You could try to set this to a larger value, and see if it solves the situation.&lt;/p&gt;
&lt;p&gt;The default should be 1024 bytes, try larger values like 2048 or 4096 and see if it works better:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_USB_WORKQUEUE_STACK_SIZE=4096&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>