<?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>nRF52840 UART queries</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55895/nrf52840-uart-queries</link><description>Hello, 
 
 I am using nRF52840, SDK_16.0.0, S140 SoftDevice and Segger 4.16 for flashing the image. I am using ‘ble_app_blinky’. 
 
 1) In Product specification, it says 2 UARTE supported. Whereas in section 6.33.10 I am seeing only one instance of UART0</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 21 Dec 2019 14:43:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55895/nrf52840-uart-queries" /><item><title>RE: nRF52840 UART queries</title><link>https://devzone.nordicsemi.com/thread/226668?ContentTypeID=1</link><pubDate>Sat, 21 Dec 2019 14:43:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:187cf81a-beb2-4f59-b91b-6ec91553cf0f</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;Thanks a lot for your inputs and doing actual current measurements.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART queries</title><link>https://devzone.nordicsemi.com/thread/226667?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 15:31:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdd564a2-faf2-416f-b539-8e81adb4903a</guid><dc:creator>H&amp;#229;kon</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1)&amp;nbsp;UART is only enabled when the bootloader enters DFU mode, e.g. when the button is pressed&lt;/p&gt;
&lt;p&gt;2) When DFU is completed the device resets, and if no button is pressed after the reset, the bootloader validates the application, then starts the application.&lt;/p&gt;
&lt;p&gt;3)&lt;/p&gt;
&lt;p&gt;I did some quick measurements with the power profiler kit on the nRF52840.&lt;br /&gt;I modified the peripheral -&amp;gt; serial example to either enable uart, then enter sleep mode, or disable uart before entering sleep mode.&lt;/p&gt;
&lt;p&gt;In the attached pictures below you can see that the UART being enabled adds around 600 uA.&lt;br /&gt;With UART enabled ~630 uA&lt;br /&gt;With UART disabled ~18 uA&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Code changes: &lt;br /&gt;Add the following lines before the infinite loop in the example. &lt;br /&gt; &lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//nrf_drv_uart_uninit(&amp;amp;serial_uart); // comment out to disable UART peripheral
while(true)
{
    sleep_handler(); // Enter sleep mode
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="Uart peripheral disabled, sleep mode" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-bdeec665ff724b45b16ca02920816967/uart_5F00_disabled_5F00_sleep_5F00_mode.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="Uart peripheral enabled, sleep mode" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-bdeec665ff724b45b16ca02920816967/uart_5F00_enabled_5F00_sleep_5F00_mode.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART queries</title><link>https://devzone.nordicsemi.com/thread/226666?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 09:43:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59b96ddf-13b7-461b-a761-06ab4b2637a9</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I my use case first Secure Serial bootloader is loaded and then my ble_app_blinky with UART application is loaded.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1) Because of Secure serial bootloader whether serial uart is always enabled. Even I am not seeing calling&amp;nbsp;nrfx_uarte_uninit().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2) (Or) Can I assume when pin is pressed then only chip will enter into boot mode and once DFU done, device will reset, so no issue even if there is no initialization of uart.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;3) What will be the current with uart enabled. Whether it will be 3 to 4 mA of ideal current. Anyway I will test practically, but this is for my quick understanding.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards&lt;/p&gt;
&lt;p&gt;Vishnu Beema&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART queries</title><link>https://devzone.nordicsemi.com/thread/226665?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 08:41:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e565c2d-887a-4c51-add3-4dc38d41ecf9</guid><dc:creator>H&amp;#229;kon</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;From your followup questions:&lt;br /&gt;a) The device can enter low power modes regardless of the UART being enabled. Simplistic said low power mode is to halt the CPU and make it wait for an event to happen. The CPU will resume operation when an event occur, handle the event and enter the wait-for-event mode again. However, the UART consumes energy by being enabled. This applies to all peripherals.&lt;/p&gt;
&lt;p&gt;b) The CPU will enter low power mode, but the current consumption is higher than needed. This can easily be measured if you run e.g. the app_ble_uart example and do measurements with and without UART enabled.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;c) The ble_app_uart example does not handle dynamic enabling and disabling of UART. However, when you know you system&amp;#39;s needs you can dynamically turn the UART on and off whenever needed. The function&amp;nbsp;&lt;strong&gt;&lt;em&gt;app_uart_close()&amp;nbsp;&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt;can be used to disable the UART.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART queries</title><link>https://devzone.nordicsemi.com/thread/226664?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 06:52:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1dc64320-65d9-4f15-ab7b-b1282d139a1d</guid><dc:creator>beemavishnu</dc:creator><description>&lt;p&gt;Thank you for your inputs.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1) Yes, I want RTT for debug logs and UART for serial communication with other board.&lt;/p&gt;
&lt;p&gt;2) app_uart_put() is working. Issue is with my code. I am increment &lt;em&gt;index&lt;/em&gt; before printing. So it will be a null character and I will not be seeing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My further queries are:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1) Need more inputs on the statement “UART peripheral whenever possible”.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;a) Assume BLE is advertising every 1 sec and to my understanding nRF will go to low power mode in-between Advertisement packets. But if UART is always enabled will not nRF chip go to low power mode in-between Advertisement packets.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;b) If UART is always enabled, whether controller will not go to low power mode and whether current consumption will be more.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;c) In ble_app_uart, how are you handling of enabling and disabling of UART. Is there any reference.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards&lt;/p&gt;
&lt;p&gt;Vishnu Beema&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 UART queries</title><link>https://devzone.nordicsemi.com/thread/226663?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 15:19:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be2013f5-b385-4ff6-921a-d01b3d2f3668</guid><dc:creator>H&amp;#229;kon</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;br /&gt;I will try to answer your questions.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1) Yes, you understand correctly. UART0 and UARTE0 share the same memory space and HW and can be used with or without EasyDMA. UARTE1 can only be used with EasyDMA.&lt;/p&gt;
&lt;p&gt;2) I don&amp;#39;t understand, you say you need UART, but you have enabled RTT? Do you mean that you need our logger, and want to use RTT as the log backend, or do you need the UART to be available as part of the application, while RTT is only for logging? In both cases, it should be OK.&lt;/p&gt;
&lt;p&gt;3) &lt;em&gt;app_uart_put()&lt;/em&gt; is to be the correct way to transmit data in this context.&lt;br /&gt;If you have a look in the &lt;em&gt;nus_data_handler(ble_nus_evt_t * p_evt)&lt;/em&gt; you can see how &lt;em&gt;app_uart_put()&lt;/em&gt; is used.&lt;br /&gt;It seems that you are not waiting the tx to finish, other example typically use&lt;em&gt; app_uart_put()&lt;/em&gt; inside a while loop. You can se how this is done in e.g. the peripheral example of uart on (line 173).&lt;br /&gt;&lt;em&gt;while (app_uart_put(cr) != NRF_SUCCESS);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;4) I understand the confusion, and share this confusion with you. However, the serial port library is only a wrapper around the same functionality as using the uart more directly as is done in the app_uart example. I don&amp;#39;t think it matters which method you choose to use, however I find the syntax in the serial port libary to be a bit easier.&lt;/p&gt;
&lt;p&gt;a) All the mentioned examples, etc. are able to handle both rx and tx&lt;br /&gt;b) Many of our BLE examples use UART and BLE simultaneously, the app_ble_uart does this as well.&amp;nbsp;&lt;br /&gt;c) I will recommend to disable the UART peripheral whenever possible, and e.g. use a BLE message or a pin input to trigger that the device should start listening on rx.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>