<?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>About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/13231/about-a-procedure-with-uart-as-disable</link><description>Because of the power-saving support, I want to disable the UART before Call the sd_app_evt_wait(). 
 I referred to two following sites to know the procedure of the case.
1. https://devzone.nordicsemi.com/question/5186/how-to-minimize-current-consumption</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 09 May 2016 07:04:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/13231/about-a-procedure-with-uart-as-disable" /><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50448?ContentTypeID=1</link><pubDate>Mon, 09 May 2016 07:04:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e63cd526-54c0-44b9-bf64-49a0a8906cd2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I think it should work OK. I think we can now mark this case as accepted by clicking the gray circle with ✓&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50447?ContentTypeID=1</link><pubDate>Mon, 09 May 2016 02:47:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0bb14bb0-5ed6-4bbb-8df2-41341033c493</guid><dc:creator>satokato</dc:creator><description>&lt;p&gt;Hi Aryan, Thank you for reply.
When I compare SDK10 with SDK8 and set a certain register for the difference by manual operation for setting, I seem to work well.
The register whom there was for the difference is as follows for setting.&lt;/p&gt;
&lt;p&gt;・app_uart_init()&lt;/p&gt;
&lt;p&gt;NRF_GPIO-&amp;gt;OUTSET&lt;/p&gt;
&lt;p&gt;・app_uart_close()&lt;/p&gt;
&lt;p&gt;NRF_UART0-&amp;gt;INTENCLR /
NRF_UART0-&amp;gt;PSELTXD /
NRF_UART0-&amp;gt;PSELRXD /
NRF_GPIO-&amp;gt;PIN_CNF[tx_pin_no] /
NRF_GPIO-&amp;gt;PIN_CNF[rx_pin_no]&lt;/p&gt;
&lt;p&gt;But I would like to confirm whether there is not a problem as a procedure.&lt;/p&gt;
&lt;p&gt;For example, in the case of app_uart_close() function,
Between SDK8 and SDK10, I think that there is for difference as follows.&lt;/p&gt;
&lt;p&gt;・In the case of SDK8&lt;/p&gt;
&lt;p&gt;uint32_t app_uart_close(uint16_t app_uart_uid);&lt;/p&gt;
&lt;p&gt;・In the case of SDK10&lt;/p&gt;
&lt;p&gt;uint32_t app_uart_close(void);&lt;/p&gt;
&lt;p&gt;Is my understanding incorrect?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50446?ContentTypeID=1</link><pubDate>Mon, 02 May 2016 05:57:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0013d043-46f1-4ab1-80ce-7620b7b9b41e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Satokato, I am sorry for late reply, I was sick all week.
I did not realize that there are differences in the two SDKs for this API, after your changes, did you manage to get it to work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50445?ContentTypeID=1</link><pubDate>Mon, 25 Apr 2016 01:47:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afb73fce-70f5-4518-9647-bf8302baee47</guid><dc:creator>satokato</dc:creator><description>&lt;p&gt;Hi,Aryan,
Thank you for confirmation.
I tried a code recommended by you, but have not yet worked well.
After checking it, in app_uart_init() function and app_uart_close() function recommended by you,
there seems to be for difference to a register set in SDK8 and SDK10.
(For example,the register setting by interrupts_disable() function and pins_to_default() function of SDK10.)
As of the following code, it seems to work well if you set the register which has a difference in the manual.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;uint32_t app_uart_init()
{
…
// Configure RX and TX pins.
// &amp;lt;&amp;lt; add start.
nrf_gpio_pin_set(p_comm_params-&amp;gt;tx_pin_no);
// &amp;gt;&amp;gt; add end.
nrf_gpio_cfg_output(p_comm_params-&amp;gt;tx_pin_no);
nrf_gpio_cfg_input(p_comm_params-&amp;gt;rx_pin_no, NRF_GPIO_PIN_NOPULL);
…
}&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;When I use SDK8, is it necessary to set the register with the difference by manual operation in comparison with setting of other SDK10?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50444?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2016 07:27:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70ce0583-b759-4e2c-8362-efdf43953c1e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi satokato,&lt;/p&gt;
&lt;p&gt;I see, thanks for clarifying this. The API for the uart_fifo stays same in SDK8 and SDK11.
That means that the recommendation i gave you to close the uart and the reinit again is still valid.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while(your_condition)
{
    err_code = app_uart_close();
    APP_ERROR_CHECK(err_code);

    err_code = sd_app_evt_wait();
    APP_ERROR_CHECK(err_code);

    APP_UART_FIFO_INIT( &amp;amp;comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_event_handle,
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
    APP_ERROR_CHECK(err_code);
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50443?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2016 00:35:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67abca47-393a-407a-9741-ab020d11da29</guid><dc:creator>satokato</dc:creator><description>&lt;p&gt;Hi,Aryan,
I&amp;#39;m sorry to confuse it.
It is recognition from SDK_10.0.0 that nrf_drv_uart(nrf_drv_uart.c/nrf_drv_uart.h) was introduced,
and my project makes app_uart_fifo.c of SDK_8.0.0 to a base.
I think app_uart_fifo.c of SDK_8.0.0 to have taken the role of the driver.
Therefore I do not use nrf_drv_uart.
Is my understanding incorrect?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50441?ContentTypeID=1</link><pubDate>Tue, 19 Apr 2016 06:54:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d983115c-f9f9-419e-900f-2eb511e7cbf4</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Satokato,&lt;/p&gt;
&lt;p&gt;I am confused, you said you are using app_uart_fifo library and this one uses nrf_drv_uart driver. Did you implement your own app_uart_fifo without using the nrf_uart_driver?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50442?ContentTypeID=1</link><pubDate>Tue, 19 Apr 2016 02:46:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ede1aeb1-0068-4bc5-bf71-a8dc40447fb0</guid><dc:creator>satokato</dc:creator><description>&lt;p&gt;Hi,Aryan, Thank you for advice.&lt;/p&gt;
&lt;p&gt;Unfortunately I do not use nrf_drv_uart in my project now.
There is the following same function, can you use it in substitution for your advice?&lt;/p&gt;
&lt;p&gt;・uint32_t app_uart_close(uint16_t app_uart_id);&lt;/p&gt;
&lt;p&gt;Or must I introduce nrf_drv_uart?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50440?ContentTypeID=1</link><pubDate>Mon, 18 Apr 2016 10:08:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:973891f5-36f1-4801-9595-738144f549f2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Satokato,&lt;/p&gt;
&lt;p&gt;Yes, it is lot different with app_uart_fifo. This module uses lower level driver nrf_drv_uart. The easiest is to do an unit when not need and init when you wakeup again. This adds little latency but your problem will be solved without hacking the library and driver&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;while(your_condition)
{
    err_code = app_uart_close();
    APP_ERROR_CHECK(err_code);

    err_code = sd_app_evt_wait();
    APP_ERROR_CHECK(err_code);

    APP_UART_FIFO_INIT( &amp;amp;comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_event_handle,
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
    APP_ERROR_CHECK(err_code);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But remember one thing, because you are disabling UART before you go to sleep, you cannot use UART events to wakup your system, that wont work. Any other event to wake your system will work as usual.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50439?ContentTypeID=1</link><pubDate>Mon, 18 Apr 2016 09:20:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b74c5f9f-4415-4adf-b7a2-ab154e160911</guid><dc:creator>satokato</dc:creator><description>&lt;p&gt;Hi Aryan,
Thank you for reply.&lt;/p&gt;
&lt;p&gt;Sorry.I&amp;#39;m using app_uart_fifo Code.
When I use app_uart_fifo, are the procedures different?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About a procedure with UART as disable</title><link>https://devzone.nordicsemi.com/thread/50438?ContentTypeID=1</link><pubDate>Mon, 18 Apr 2016 07:49:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afe4473b-7d18-4471-8bc4-cbef3e21012a</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi satokato,&lt;/p&gt;
&lt;p&gt;Are you using simple_uart code?
In procedure 1) the code is changing the pin directions when disabling but not setting them back to their usable state when you have to re-use UART again. I do not think you need reset the GPIO direction as that will not change power consumption.&lt;/p&gt;
&lt;p&gt;The code in the procedure 2) &lt;code&gt;simple_uart_putstring&lt;/code&gt; which starts UART when needed to transmit and stops when last byte is transmitted is perfect. &lt;code&gt;simple_uart_put&lt;/code&gt; will make sure that the it waits until the byte is transmitted before stopping the the uart.&lt;/p&gt;
&lt;p&gt;But the given solutions were only for TX, That will keep RX ON all time. If you want to toggle RX also then you can do like below&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t simple_uart_get(void)
{
       
    NRF_UART0-&amp;gt;TASKS_STARTRX = 1;

    while (NRF_UART0-&amp;gt;EVENTS_RXDRDY != 1)
    {
        // Wait for RXD data to be received
    }

    NRF_UART0-&amp;gt;EVENTS_RXDRDY = 0;

    NRF_UART0-&amp;gt;TASKS_STOPRX = 1;
    return (uint8_t)NRF_UART0-&amp;gt;RXD;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that if you switch RX on as you need, then you need to know when the peer device will transmit else you this device might be sleeping with RX off when the other device sends byte and it will be lost.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>