<?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 CDC Console issue when CONFIG_LOG enabled and debug enabled</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99466/usb-cdc-console-issue-when-config_log-enabled-and-debug-enabled</link><description>I am using the NFR528333 Development Board to send console messages out the USB CDC device. When I enable &amp;quot;debug options&amp;quot; in the build and have CONFIG_LOG =y, I do not see the USB CDC device show up in Windows. If I disable the &amp;quot;debug options&amp;quot; in the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 05 Jun 2023 21:18:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99466/usb-cdc-console-issue-when-config_log-enabled-and-debug-enabled" /><item><title>RE: USB CDC Console issue when CONFIG_LOG enabled and debug enabled</title><link>https://devzone.nordicsemi.com/thread/429426?ContentTypeID=1</link><pubDate>Mon, 05 Jun 2023 21:18:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51d248e9-4e6e-4478-a57a-4f7f7f183edd</guid><dc:creator>eb12345</dc:creator><description>&lt;p&gt;Can you please let me know if I need to increase the stack size of anything.&amp;nbsp;I&amp;#39;m not using the Shell, and was just following what the documentation said to do. Can you please try it and let me know what you find.&lt;br /&gt;Eran&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB CDC Console issue when CONFIG_LOG enabled and debug enabled</title><link>https://devzone.nordicsemi.com/thread/429121?ContentTypeID=1</link><pubDate>Sun, 04 Jun 2023 19:30:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72777004-6394-497e-9d1c-efe3cdec2104</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Sorry for the late reply.&lt;/p&gt;
[quote user="eb12345"]Isn&amp;#39;t the logging module suppose to work with console ? [/quote]
&lt;p&gt;Yes it should be as shown &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.0-rc2/zephyr/services/usb/uds_cdc_acm.html#console-over-cdc-acm-uart"&gt;here&lt;/a&gt;, But I have not tried it myself.&amp;nbsp;My suggestion was based on the fact that we were using shell for most of our samples when using CDC and I was not sure if the stack sizes were tuned to use console as backend.&amp;nbsp;&lt;/p&gt;
[quote user="eb12345"]My original program that I had posted clearly showed that I was using console. Is this a mis-configuration or is there a stack size issue ?[/quote]
&lt;p&gt;This seems a stack issue, but you are right I have not verified this. You might have already tried to increase the&amp;nbsp;shell stack/buffer&amp;nbsp;sizes? ( CONFIG_&lt;span&gt;SHELL_STACK_SIZE / CONFIG_&lt;/span&gt;&lt;span&gt;SHELL_CMD_BUFF_SIZE )&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB CDC Console issue when CONFIG_LOG enabled and debug enabled</title><link>https://devzone.nordicsemi.com/thread/428578?ContentTypeID=1</link><pubDate>Wed, 31 May 2023 22:06:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1140c4d7-a196-49cd-926d-6cc2ea6927dc</guid><dc:creator>eb12345</dc:creator><description>&lt;p&gt;Isn&amp;#39;t the logging module suppose to work with console ? Were you able to confirm that this is where the stack overflow was coming from. My original program that I had posted clearly showed that I was using console. Is this a mis-configuration or is there a stack size issue ?&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Eran&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB CDC Console issue when CONFIG_LOG enabled and debug enabled</title><link>https://devzone.nordicsemi.com/thread/426749?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 06:52:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11a76ee2-50c0-409d-8c09-3971312babda</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;The problem could be that you might be using the console instead of the shell in your DTS overlay.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To fix this you should change this line:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;zephyr,console = &amp;amp;cdc_acm_uart0;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;zephyr,shell-uart = &amp;amp;cdc_acm_uart0;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB CDC Console issue when CONFIG_LOG enabled and debug enabled</title><link>https://devzone.nordicsemi.com/thread/426692?ContentTypeID=1</link><pubDate>Mon, 22 May 2023 19:26:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f24e575d-4a5c-4c9f-96e1-897be8adb1c5</guid><dc:creator>eb12345</dc:creator><description>&lt;p&gt;Thank you for your reply. I believe the default is that asserts are globally disabled, and I had to enable them? I tried the following with different stack sizes but it did not help:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_USB_WORKQUEUE&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_USB_WORKQUEUE_STACK_SIZE=4096&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_USB_NRFX_WORK_QUEUE_STACK_SIZE=4096&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_MAIN_STACK_SIZE=4096&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;CONFIG_HEAP_MEM_POOL_SIZE=256&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;Can you let me know how you can find out which assert triggered ?&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Eran&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB CDC Console issue when CONFIG_LOG enabled and debug enabled</title><link>https://devzone.nordicsemi.com/thread/426686?ContentTypeID=1</link><pubDate>Mon, 22 May 2023 18:51:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7319a49-ad28-4378-9a00-35c7ef11b54e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I managed to reproduce this, you are getting a stack overflow error and disabling the assert is causing the application to continue without panicing. This is not recommended handling of stack overflow. By disabling ASSERTS, you are temporarily masking side effects of the issue. I will investigate a bit further in the coming days to see which thread caused the stack overflow so that we can increase the stack size of the thread that is causing this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB CDC Console issue when CONFIG_LOG enabled and debug enabled</title><link>https://devzone.nordicsemi.com/thread/426466?ContentTypeID=1</link><pubDate>Mon, 22 May 2023 08:28:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e86d959e-ca15-4b0a-a5eb-e026e298a212</guid><dc:creator>Raoul</dc:creator><description>&lt;p&gt;Hi Eran,&lt;/p&gt;
&lt;p&gt;Sorry for the late answer, I was sick at the start of last week and then we had two national holidays following one after another.&lt;/p&gt;
&lt;p&gt;Great that you&amp;#39;ve been able to boil down the issue to this, thanks for sharing! I&amp;#39;ll hand this over to a colleague since I&amp;#39;ll be out of office this whole week. If there turns out to be a bug here it will be shared with the developers of course.&lt;/p&gt;
&lt;p&gt;My colleague will get back to you soon.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Raoul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB CDC Console issue when CONFIG_LOG enabled and debug enabled</title><link>https://devzone.nordicsemi.com/thread/424664?ContentTypeID=1</link><pubDate>Tue, 09 May 2023 19:44:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a47b7bff-7309-40a7-906d-32e4c2d83a95</guid><dc:creator>eb12345</dc:creator><description>&lt;p&gt;Hi Raoul,&lt;/p&gt;
&lt;p&gt;Thank you for the suggestions. I tried and took a look at the stack space and even heap space. Everything looks good.&lt;/p&gt;
&lt;p&gt;I was able to isolate the issue and listed the code below to the small sample application (based on the &amp;quot;Hello World&amp;quot; sample) which enables console log and CDC USB.&lt;/p&gt;
&lt;p&gt;I got the application to work, but only if I enable ASSERTs using the following config command:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_ASSERT&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Can you please try out the sample application and see if you are seeing the same thing. Make sure to comment the CONFIG_ASSERT=y line if you want to see the issue. I am using the nrf52833 Development Board (nrf52833dk_nrf52833dk,dts)&lt;/p&gt;
&lt;p&gt;Thank you,&lt;/p&gt;
&lt;p&gt;Eran&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* main.c */
#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/usb/usb_device.h&amp;gt;
#include &amp;lt;zephyr/usb/usbd.h&amp;gt;
#include &amp;lt;zephyr/logging/log.h&amp;gt;

LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);

static const struct device *const usbDev = DEVICE_DT_GET(DT_NODELABEL(cdc_acm_uart0));

void main(void)
{
    if (!device_is_ready(usbDev)) {
        LOG_ERR(&amp;quot;CDC device usbDev is not ready&amp;quot;);
        return;
	}

	if (usb_enable(NULL)) {
		return;
	}

	printk(&amp;quot;Hello World! %s\n&amp;quot;, CONFIG_BOARD);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# prj.conf
CONFIG_LOG=y

CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT=&amp;quot;Zephyr USB console sample&amp;quot;
CONFIG_USB_DEVICE_PID=0x0004

# Comment this line and USB will not show up in Windows Devic Manager
# CONFIG_ASSERT=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* app.overlay */

/ {
	chosen {
		zephyr,console = &amp;amp;cdc_acm_uart0;
	};
};


zephyr_udc0: &amp;amp;usbd {
    compatible = &amp;quot;nordic,nrf-usbd&amp;quot;;
	status = &amp;quot;okay&amp;quot;;
	cdc_acm_uart0: cdc_acm_uart0 {
		compatible = &amp;quot;zephyr,cdc-acm-uart&amp;quot;;
	};
};
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB CDC Console issue when CONFIG_LOG enabled and debug enabled</title><link>https://devzone.nordicsemi.com/thread/424619?ContentTypeID=1</link><pubDate>Tue, 09 May 2023 14:53:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdf206b3-9118-4d88-990f-6e711534fe79</guid><dc:creator>Raoul</dc:creator><description>&lt;p&gt;Hi Eran,&lt;/p&gt;
&lt;p&gt;This sounds to me like it could be related to a lack of stack space. The various Zephyr modules have a preset amount of stack space that can be changed in Kconfig options.&lt;/p&gt;
&lt;p&gt;Could you try changing some of the stack sizes mentioned in this related ticket? &amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/81379/ncs-usb-cdc-fault-when-config_no_optimizations-y"&gt;NCS USB CDC fault when CONFIG_NO_OPTIMIZATIONS=y&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you want to investigate stack usage more closely, you could follow the instructions my colleague described in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/81379/ncs-usb-cdc-fault-when-config_no_optimizations-y/337551"&gt;in one of the replies there&lt;/a&gt;. In particular, the things mentioned here:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/81217/generate-useful-stack-usage-report-with-zephyr-nrf-connect/336645"&gt;RE: Generate useful stack usage report with Zephyr/nRF Connect&lt;/a&gt;&amp;nbsp; and here: &lt;a href="https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-3-ncs-v1-4-0#mcetoc_1f4cg7h4q0"&gt;https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-3-ncs-v1-4-0#mcetoc_1f4cg7h4q0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Feel free to reach out if you get stuck!&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Raoul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>