<?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>RTT logging interferes with USB</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65716/rtt-logging-interferes-with-usb</link><description>I am using RTT logging and it is interfering with USB HID data transfer. The host sends consecutive OUT packets and I print some logs after each one. I will miss a APP_USBD_HID_USER_EVT_OUT_REPORT_READY event sometimes. I am doing this in the main loop</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 15 Sep 2020 14:06:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65716/rtt-logging-interferes-with-usb" /><item><title>RE: RTT logging interferes with USB</title><link>https://devzone.nordicsemi.com/thread/269691?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2020 14:06:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9571f72-1959-4223-b78a-d34dad68d0e5</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;It may not be a problem. If I remember correctly, it was easyDMA related, so if you are not using that in your USB, it may not be a problem.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTT logging interferes with USB</title><link>https://devzone.nordicsemi.com/thread/269227?ContentTypeID=1</link><pubDate>Fri, 11 Sep 2020 19:31:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a36f2eda-d119-4063-a89a-773236b28810</guid><dc:creator>Jefferson</dc:creator><description>&lt;p&gt;I am using softdevice.&amp;nbsp; What kind of bugs are in USBD interrupt?&amp;nbsp; I am using interrupt and I don&amp;#39;t see any problems yet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTT logging interferes with USB</title><link>https://devzone.nordicsemi.com/thread/269111?ContentTypeID=1</link><pubDate>Fri, 11 Sep 2020 09:18:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7d9a0f3-5518-4fa6-9870-2a205a03a6c0</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;That seems plausible.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If the USB is set up as interrupts should solve the issue, because interrupts will always have a higher priority than the main loop. So even if an interrupt occurs between NRF_LOG_PROCESS() and nrf_pwr_mgmt_run(), or even during nrf_pwr_mgmt_run, but before the call to sd_app_evt_wait(), the interrupt will be handled. If it occurs after the call to sd_app_evt_wait(), it will obviously be handled as well. However, I believe there are some bugs in the interrupt driven USBD drivers, so I am not sure that works flawless either.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I see that the USB composite example has this in the main-loop:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        UNUSED_RETURN_VALUE(NRF_LOG_PROCESS());
        /* Sleep CPU only if there was no interrupt since last loop processing */
        __WFE();&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You should keep your check of the return for NRF_LOG_PROCESS(), in my opinion. But perhaps you can try to call nrf_app_usbd_event_queue_process() once more right before app_usbd_event_queue_process().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do you use the softdevice, by the way? If not, you can just use the WFE, like in the usbd_hid_composite example.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTT logging interferes with USB</title><link>https://devzone.nordicsemi.com/thread/269051?ContentTypeID=1</link><pubDate>Thu, 10 Sep 2020 17:23:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63546ec1-c791-40af-bc44-bb1e8702f219</guid><dc:creator>Jefferson</dc:creator><description>&lt;p&gt;I am logging with debugger and using USB for HID.&amp;nbsp; I think the problem is how&amp;nbsp;idle_state_handle() and&amp;nbsp;nrf_pwr_mgmt_run() is handled by the SDK and all examples.&amp;nbsp; It does not work in many cases.&amp;nbsp; When&amp;nbsp;running&amp;nbsp;&lt;span&gt;NRF_LOG_PROCESS() and it returns false, a USB event could occur but&amp;nbsp;nrf_pwr_mgmt_run() would be run and could be stuck in sleep if no more USB events occur.&amp;nbsp; Setting USB events to interrupts fixes the problem in most cases but there is still some time for interrupt to occur before entering sleep mode and getting stuck in sleep.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTT logging interferes with USB</title><link>https://devzone.nordicsemi.com/thread/268920?ContentTypeID=1</link><pubDate>Thu, 10 Sep 2020 10:29:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64dd7b05-ed1e-4cf8-b44c-08409d847741</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Then I guess this requires more information on what your application does, and what the &amp;quot;//process data and print to log&amp;quot; does.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Keep NRF_LOG_DEFERRED set to 1, since this will only process logging when nothing else requires attention.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Just to clarify something: Are you trying to log RTT via the USB peripheral, or are you logging with RTT via the debugger, and at the same time using the USB for something else?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTT logging interferes with USB</title><link>https://devzone.nordicsemi.com/thread/268803?ContentTypeID=1</link><pubDate>Wed, 09 Sep 2020 15:58:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f8eac73-46e9-404c-8057-0f523517c6fb</guid><dc:creator>Jefferson</dc:creator><description>&lt;p&gt;I tried setting to 1 and 0 and both don&amp;#39;t work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTT logging interferes with USB</title><link>https://devzone.nordicsemi.com/thread/268748?ContentTypeID=1</link><pubDate>Wed, 09 Sep 2020 12:34:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f8ed8ae-d148-460f-b6b0-45fcb33ba05a</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Do you use deferred logging? Please check the definition of&amp;nbsp;NRF_LOG_DEFERRED in sdk_config.h. If it is not set to 1, can you try to set it to 1?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTT logging interferes with USB</title><link>https://devzone.nordicsemi.com/thread/268608?ContentTypeID=1</link><pubDate>Wed, 09 Sep 2020 00:25:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eea0c365-4937-43a8-822e-3ae66326edcc</guid><dc:creator>Jimmy Wong</dc:creator><description>&lt;p&gt;I used the nRF52840 dongle as the example and add the logger through USB.&lt;br /&gt;it may be useful for your case.&lt;br /&gt;&lt;a href="https://jimmywongiot.com/2019/10/25/how-to-use-the-nrf52840-dongle-pca10059-as-development-board/"&gt;jimmywongiot.com/.../&lt;/a&gt;&lt;br /&gt;&lt;a href="https://github.com/jimmywong2003/nrf52840-dongle-example/"&gt;github.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>