<?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>How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/64142/how-to-prevent-radio-test-from-stopping-with-cli-disconnected</link><description>Hi Devzone: 
 We put the radio test project on our custom battery powered board and encountered a problem. 
 When we disconnect the usb cable, the tone emitted by radio test project disappeared. 
 We want to disconnect the cable as the cable could act</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Oct 2021 12:43:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/64142/how-to-prevent-radio-test-from-stopping-with-cli-disconnected" /><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/335490?ContentTypeID=1</link><pubDate>Fri, 22 Oct 2021 12:43:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b66f72f-49fd-4c3e-bc5e-28c451c763af</guid><dc:creator>lorenzoFIL</dc:creator><description>&lt;p&gt;I know this thread is a bit old, but I was encountering the same issue and thought it might be helpful for others.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It looks like when USB is disconnected and app_usbd_stop() is called, if you go down the rabbit hole, you&amp;#39;ll end up in app_usbd.c and in the APP_USBD_EVT_STOP_REQ event, the code will try to release the hfclk in line 1106 of SDK 17.0.2. Hopefully this is helpful for others in the future.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/279744?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 13:42:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ecf8be5-3e9a-42d0-be5f-af52153ed211</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The HF clock is requested in the app_usbd.c driver more specifically in&amp;nbsp;sustate_set(). Either way I guess the original issue is solved?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/278151?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2020 17:19:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da833fd3-c863-44b8-b1bb-b68a24cfbb87</guid><dc:creator>cpeng</dc:creator><description>&lt;p&gt;Hi Jared:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In the main(), usbd_init() is indeed called, but that function is the original code in the cli example project written by Nordic. I did not modify it. Can you tell if it&amp;#39;s turning off the HFCLK? Below is the code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void usbd_init(void)
{
#if CLI_OVER_USB_CDC_ACM
    ret_code_t ret;
    static const app_usbd_config_t usbd_config = {
        .ev_handler = app_usbd_event_execute,
        .ev_state_proc = usbd_user_ev_handler
    };
    ret = app_usbd_init(&amp;amp;usbd_config);
    APP_ERROR_CHECK(ret);

    app_usbd_class_inst_t const * class_cdc_acm =
            app_usbd_cdc_acm_class_inst_get(&amp;amp;nrf_cli_cdc_acm);
    ret = app_usbd_class_append(class_cdc_acm);
    APP_ERROR_CHECK(ret);

    if (USBD_POWER_DETECTION)
    {
        ret = app_usbd_power_events_enable();
        APP_ERROR_CHECK(ret);
    }
    else
    {
        NRF_LOG_INFO(&amp;quot;No USB power detection enabled\nStarting USB now&amp;quot;);

        app_usbd_enable();
        app_usbd_start();
    }

    /* Give some time for the host to enumerate and connect to the USB CDC port */
    nrf_delay_ms(1000);
#endif
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;With a rough scan I didn&amp;#39;t find any &amp;quot;&lt;span&gt;nrf_drv_clock&amp;nbsp;&amp;quot; related code in here that could cause HFCLK be turned off.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/277311?ContentTypeID=1</link><pubDate>Wed, 28 Oct 2020 09:39:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0f382b1-ac54-453a-b70b-4463cc557e15</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;My last point was referring to your previous question about where the USBD driver might be turning off the clock. We&amp;#39;ve seen earlier that a call to request the hfclk clock with the nrf_drv_clock driver will effectively turn off the clock if the clock was already running and was initially turned on by writing directly to the register. I was therefore curious if you during the initialization process was requesting the hfclk clock for example in usbd_init()&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/277246?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2020 20:09:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcf227bc-9cec-469f-8eca-09dee7634d4d</guid><dc:creator>cpeng</dc:creator><description>&lt;p&gt;Hi Jared:&lt;/p&gt;
&lt;p&gt;I added this code to cli usb example project, the added lines are in the main() function.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1603829338865v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/277133?ContentTypeID=1</link><pubDate>Tue, 27 Oct 2020 12:34:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c603259-2d7e-482f-83df-1adbdcfc9ed3</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. Good that it worked. In regards to where the HFCLK is written to in the USBD API, most of our examples do this during the initialization routine. For example the USBD example:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/2678.pastedimage1603802020874v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Are you doing something similar?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/276316?ContentTypeID=1</link><pubDate>Wed, 21 Oct 2020 22:03:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98702e50-c470-4afa-bc78-47ed56992268</guid><dc:creator>cpeng</dc:creator><description>&lt;p&gt;Problem solved!&lt;/p&gt;
&lt;p&gt;I put&amp;nbsp;&lt;/p&gt;
&lt;p&gt;NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART&amp;nbsp; &amp;nbsp; = 1;&lt;/p&gt;
&lt;p&gt;in the main() while loop to constantly re-write the register, and now the crystal stays on when USB cable is unplugged.&lt;/p&gt;
&lt;p&gt;My guess is somewhere in the USBD api function calls Nordic turns HFCLK off when usb power is unplugged.&lt;/p&gt;
&lt;p&gt;however I searched in the code i couldn&amp;#39;t find any relevant place where Nordic does that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/275555?ContentTypeID=1</link><pubDate>Mon, 19 Oct 2020 10:06:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f0aa848-e2df-4ee1-93ed-0a528a0ae2fe</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The radio_test example activates the HFCLK by writing directly to the register. Are you requesting the clock again or using the clock driver in any other place in your code? What changes did you do in the application? My guess is that the register is written to an additional time somewhere in your code.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/275436?ContentTypeID=1</link><pubDate>Fri, 16 Oct 2020 22:04:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ef1232c-99b1-4785-b9ee-c16d28224aa5</guid><dc:creator>cpeng</dc:creator><description>&lt;p&gt;Hi Jared:&lt;/p&gt;
&lt;p&gt;I finally got a chance to probe the crystal, as you have predicted, yes the external crystal stopped when USB cable is unplugged, indicating Nordic switched to internal oscillator.&lt;/p&gt;
&lt;p&gt;Now the question is how to modify the code to prevent Nordic from doing this switching.&lt;/p&gt;
&lt;p&gt;If you know it by any chance that would save me some effort digging into the documents.&lt;/p&gt;
&lt;p&gt;Thanks again for your advice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/273672?ContentTypeID=1</link><pubDate>Thu, 08 Oct 2020 09:07:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2269641c-e44b-41fe-8402-60b6243830ba</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Valid point, I&amp;#39;ll share your thoughts onwards..&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Looking forward to the result regarding the external crystal.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/273592?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 21:35:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cac73820-4768-4873-91dc-856ccd43c766</guid><dc:creator>cpeng</dc:creator><description>&lt;p&gt;Hi Jared: I will try to see if the clock stops and get back to you.&lt;/p&gt;
&lt;p&gt;Oh and I need to clear out a confusion: in order to use radio project over USB, I had to merge the radio_test project with cli project so the CLI is through USB, not UART.&lt;/p&gt;
&lt;p&gt;I think in the future Nordic should build a radio test project that does CLI over USB instead of UART.&lt;/p&gt;
&lt;p&gt;Because UART needs the ARM chip on the DK board to work, and most people use radio test project&amp;nbsp;on their own customized board in order to test their radio performance, and most likely the board will not have a huge ARM chip on it, so it defeats the purpose of building radio test project over UART.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/273172?ContentTypeID=1</link><pubDate>Tue, 06 Oct 2020 09:51:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:605db0f9-71e1-4b6b-8a69-f0e95848cb0f</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;SDK 17.0 includes a fix in the handling of the USB CLI backend when a port is closed. The changed behavior is probably related to this. I have a suspicion that your new behavior is caused by the&amp;nbsp;example stopping the HFXO when you unplug the USB cable. Could you either probe the crystal or read out the&amp;nbsp;NRF_CLOCK-&amp;gt;HFCLKSTAT and see if it&amp;#39;s stopped when you unplug the cable?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/272808?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2020 23:09:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b77b8c31-a60d-4497-a98d-ddf43a4cc28c</guid><dc:creator>cpeng</dc:creator><description>&lt;p&gt;Hi Jared:&lt;/p&gt;
&lt;p&gt;Thanks for keep tracking this problem. Now with a new try the problem changes a little bit.&lt;/p&gt;
&lt;p&gt;I spliced radio_test project with cli project in SDK 17.0.2 instead of 16, everything works with usb plugged in. CLI commands output a tone which I can measure in a spectrum analyzer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now with USB cable unplugged, the tone didn&amp;#39;t go away. Instead it shifts down by an offset.&lt;/p&gt;
&lt;p&gt;For example, if cli command sets up a tone at channel 80 which is 2.48G, unplugging USB would have the tone shift down to 2.435Ghz. Similar offsets happens with other channels too.&lt;/p&gt;
&lt;p&gt;Do you have any suggestion what could cause this shift?&lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/272718?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2020 11:59:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44e019e9-19ad-499f-885e-0e7491051a03</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The example uses CLI which again is dependent on the USB peripheral if you chose USB as the transport layer. CLI is used for communicating with the user on how to setup the test. You would have to modify the entire example so that it isn&amp;#39;t dependent on the USB as transport layer. I haven&amp;#39;t tested this but you could try to use the UART&amp;nbsp; as transport layer instead.&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/272634?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2020 21:29:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b5fe122-b947-4b8c-a2e3-8b2204cfa840</guid><dc:creator>cpeng</dc:creator><description>&lt;p&gt;Hi Jared, sorry I wasn&amp;#39;t very specif in describing what I did:&lt;/p&gt;
&lt;p&gt;by turning off all asserts, I just commented out ASSERT lines in nrf_cli_uart.c, nrf_cli.c, nrf_queue.c&lt;/p&gt;
&lt;p&gt;I guess it&amp;#39;s probably not beneficial to do.&lt;/p&gt;
&lt;p&gt;The board is powered by battery, so after USB cable disconnected the code still runs.&lt;/p&gt;
&lt;p&gt;I did have the board swd pins still connected after I disconnect the usb cable, and fired up the debugger.&lt;/p&gt;
&lt;p&gt;Do you have any recommendation of what to check? The debugger shows the code still runs, bouncing between some nrf_cli files.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/271703?ContentTypeID=1</link><pubDate>Mon, 28 Sep 2020 08:46:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76805ebc-4be1-49c6-9ea2-fc8938cb41b9</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;And is the board still supplied after you plug the cable out? What is supplying the board?&amp;nbsp;&lt;/p&gt;
[quote user="cpeng"]I turned off all asserts, the tone generated by radio test still vanishes after usb cable is pulled off.[/quote]
&lt;p&gt;How did you do this? I don&amp;#39;t see how this would solve the issue. Have you routed the SWD pins out so you could connect the board to a debugger? Could you try to see what the application is doing when you plug out the usb cable?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/271599?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2020 20:02:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a093d846-50dc-4e7e-b319-e469de6f69b4</guid><dc:creator>cpeng</dc:creator><description>&lt;p&gt;Hi Jared:&lt;/p&gt;
&lt;p&gt;Sorry for the delay, but I had a chance to re-visit the problem. I turned off all asserts, the tone generated by radio test still vanishes after usb cable is pulled off.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know how to solve the problem right now..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/261921?ContentTypeID=1</link><pubDate>Tue, 28 Jul 2020 09:21:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:276debcf-257a-4617-8743-ba6a88191534</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;My guess is that the application asserts because you disconnect the backend that the CLI module is dependent on.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/261836?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2020 15:14:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b200e68d-87a7-4746-aa7f-867e4c79a8f2</guid><dc:creator>cpeng</dc:creator><description>&lt;p&gt;Hi Jared:&lt;/p&gt;
&lt;p&gt;Thanks for reaching out to help.&lt;/p&gt;
&lt;p&gt;The board is a customized board that has a usb port on it.&lt;/p&gt;
&lt;p&gt;The cli module&amp;nbsp; transport layer is usb cdc acm through that port.&lt;/p&gt;
&lt;p&gt;I merged the radio test with cli example, because the original radio test project uses UART instead of USB cdc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to prevent Radio test from stopping with cli disconnected?</title><link>https://devzone.nordicsemi.com/thread/261800?ContentTypeID=1</link><pubDate>Mon, 27 Jul 2020 13:13:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d2c60bf-60c1-4cd2-a85d-3f383f9b9c7c</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;How is the board supplied and what transport layer are you using for CLI module?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>