<?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>libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79351/libuarte-connection-between-nrf9160dk-and-nrf52840</link><description>Hi, If there is already a FAQ, Code or support ticket that I missed, I am more than happy to read it. I have done a number of searches but cant quite get to what I am looking for. Setup: I am trying to get communications between the 52840 and 9160 on</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Sep 2021 21:21:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79351/libuarte-connection-between-nrf9160dk-and-nrf52840" /><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/331162?ContentTypeID=1</link><pubDate>Fri, 24 Sep 2021 21:21:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18e06cf4-83c6-4081-8914-d84936caffca</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Brett,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m glad to hear that it works, thank you for the update. This isn&amp;#39;t just a trap for new players - I was not aware of it either &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt; I have never used printf&amp;#39;s with RTT though, only UART.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/331161?ContentTypeID=1</link><pubDate>Fri, 24 Sep 2021 20:52:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:424c3c0c-db2e-4a02-9785-0bffaa575b20</guid><dc:creator>Brett</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks !&amp;nbsp; That was the answer, printf() was blocking - all appears to be working now.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Trap for new players !&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;-brett&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/330790?ContentTypeID=1</link><pubDate>Thu, 23 Sep 2021 09:57:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:282f630e-e870-49e9-a0c7-cf39fb22bddc</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Brett,&lt;/p&gt;
&lt;p&gt;I have hopefully figured it out now: in your project you used printf&amp;#39;s to print the debug message over RTT, which unlike the NRF_LOG_* macros, are blocking. That is, printf() won&amp;#39;t return until the debug message has been received by the debugger.&lt;/p&gt;
&lt;p&gt;I think this must be the reason why it only worked when you did SES Build-&amp;gt;Debug in the beginning. Please try to use the NRF_LOG_*&amp;nbsp; macros instead to confirm.&lt;/p&gt;
&lt;p&gt;I also made some changes to my 9160 project in the process. Here is my updated version:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3757.uart_5F00_52840_5F00_9160.zip"&gt;devzone.nordicsemi.com/.../3757.uart_5F00_52840_5F00_9160.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/330724?ContentTypeID=1</link><pubDate>Wed, 22 Sep 2021 20:04:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b4e8209-e2da-4f20-a04d-7027fa335780</guid><dc:creator>Brett</dc:creator><description>&lt;p&gt;Thanks Vidar, appreciate you having&amp;nbsp; a look at it for me.&lt;br /&gt;&lt;br /&gt;I can send over my 9160 code as well if that helps at all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/330529?ContentTypeID=1</link><pubDate>Tue, 21 Sep 2021 16:45:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be32dd1a-d8fb-4e08-afa6-a43ad788886f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Brett,&lt;/p&gt;
&lt;p&gt;I have to spend some more time on this, unfortunately. I realized that my UART implementation on the 9160 isn&amp;#39;t working properly either when I started testing with your example. Will try to get you an update tomorrow.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/330356?ContentTypeID=1</link><pubDate>Mon, 20 Sep 2021 20:42:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ce5099b-5040-48b9-b066-a6dc500e70f2</guid><dc:creator>Brett</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;For now I am only trying to send data from the 52840 to the 9160 - so the flow-control should not be an issue ?&lt;/p&gt;
&lt;p&gt;I have attached the code that I have, if you are able to try this on your board to see if it works for you, and/or if there is something obvious I have missed.&lt;br /&gt;&lt;br /&gt;Note; This code is a cut/paste from one of the BLE examples which I have not completely cleaned up yet.&lt;br /&gt;This code has also been cut down to send `1` every 5 seconds over the UART connection, so your 9160 receiver should be able to get the message and log it.&lt;/p&gt;
&lt;p&gt;cheers&lt;/p&gt;
&lt;p&gt;-brett&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/app_5F00_libUARTE.tar.gz"&gt;devzone.nordicsemi.com/.../app_5F00_libUARTE.tar.gz&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/329360?ContentTypeID=1</link><pubDate>Tue, 14 Sep 2021 09:21:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3cfa4e3-736f-45e7-9271-260097feb185</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Brett,&lt;/p&gt;
&lt;p&gt;Your configuration looks fine. You have to select TIMER1&amp;nbsp; like you did as TIMER0 is reserved to the Softdevice.&lt;/p&gt;
[quote user="Brett"]Q: I am using the s340 soft device, doest that influence the&amp;nbsp;clock&amp;nbsp;or&amp;nbsp;timers I need to use ?[/quote]
&lt;p&gt;The only difference is that you can&amp;#39;t use TIMER0 like mentioned above.&lt;/p&gt;
[quote user="Brett"]Q: Does the SES debug provide clock differently than not using it ?[/quote]
&lt;p&gt;The HF clock is kept always on while in debug mode, but you will get the same effect by calling &lt;span&gt;&lt;a title="sd_clock_hfclk_request" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.3.0/group___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html?cp=4_7_4_1_2_7_2_3#ga3e5afb495a1b0307c749cc268df94a74"&gt;sd_clock_hfclk_request&lt;/a&gt;&lt;/span&gt;()&amp;nbsp; like I suggested in my initial reply. So I don&amp;#39;t think the issue is clock related.&lt;/p&gt;
&lt;p&gt;Have you enabled flow control on the 52840 side like I did in my example? I noticed you only had it on the 9160 in the initial code you posted. In that case, do you get a &amp;quot;busy&amp;quot; error if you try to send data from the 9160?&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/329111?ContentTypeID=1</link><pubDate>Sun, 12 Sep 2021 06:26:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71663bb6-04cf-42a8-a41f-f4ebd1c0efc5</guid><dc:creator>Brett</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Your code by itself works fine, so I have tried to identify any differences between them.&lt;/p&gt;
&lt;p&gt;Both lots of settings basically the same now (not identical as I have softdevice/ANT+ code) and the same thing happens, I can run the code in SES-Debug mode and all works, but as soon as I just run or power cycle the unit, I dont get the data through.&lt;br /&gt;&lt;br /&gt;Q: I am using the s340 soft device, doest that influence the&amp;nbsp;clock&amp;nbsp;or&amp;nbsp;timers I need to use ?&lt;br /&gt;&lt;br /&gt;Q: Does the SES debug provide clock differently than not using it ?&lt;br /&gt;&lt;br /&gt;The&amp;nbsp;obvious difference I have between the 2 code bases is below, hence the reason for my timer/RTC&amp;nbsp;question.&lt;/p&gt;
&lt;p&gt;Mine:&lt;/p&gt;
&lt;p&gt;NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 1, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 4);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Yours:&lt;/p&gt;
&lt;pre&gt;NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0, 0, 0, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 255, 3);&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;cheers&lt;/p&gt;
&lt;p&gt;-brett&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/329094?ContentTypeID=1</link><pubDate>Fri, 10 Sep 2021 20:08:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04e23f88-84ba-4e77-aa61-1994e77f8795</guid><dc:creator>Brett</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;It worked on the nrf9160df_nrf9160, and after I copied the overlay to nrf9160dk_nrf9160ns.overlay it works as well.&amp;nbsp; (note: I used&amp;nbsp;&lt;span&gt;nrf9160dk_nrf9160ns and not&amp;nbsp;nrf9160dk_nrf9160_ns).&lt;br /&gt;&lt;br /&gt;I will work from this to see if I can work out what the differences are.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;cheers&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;-brett&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/328947?ContentTypeID=1</link><pubDate>Fri, 10 Sep 2021 08:03:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de8df1aa-fe58-473c-9385-04fb578bb7dd</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Brett,&lt;/p&gt;
&lt;p&gt;Can you try to build for &amp;quot;nrf9160dk_nrf9160&amp;quot; instead? Seems like the UART instance I selected won&amp;#39;t initialize in the non-secure domain for some reason. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update: &lt;/strong&gt;I had forgotten to include an overlay file for nrf9160dk_nrf9160_&lt;strong&gt;ns &lt;/strong&gt;so that&amp;#39;s why it didn&amp;#39;t work. To fix this you can make a copy of the nrf9160dk_nrf9160.overlay file in &amp;quot;boards&amp;quot; and and name it nrf9160dk_nrf9160_ns.overlay.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1631263165402v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/328922?ContentTypeID=1</link><pubDate>Fri, 10 Sep 2021 07:01:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96d5ff86-09dd-4451-b12b-a6ff5c127ba5</guid><dc:creator>Brett</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;br /&gt;&lt;br /&gt;I compiled you code (west build -c -p -b nrf9160dk_nrf9160ns), which worked fine and the flash went fine, but on the 9160 I get the following error.&lt;br /&gt;&lt;br /&gt;BTW: The 52840 complied and loaded fine.&lt;/p&gt;
&lt;p&gt;*** Booting Zephyr OS build v2.6.0-rc1-ncs1 ***&lt;br /&gt;Flash regions Domain Permissions&lt;br /&gt;00 01 0x00000 0x10000 Secure rwxl&lt;br /&gt;02 31 0x10000 0x100000 Non-Secure rwxl&lt;/p&gt;
&lt;p&gt;Non-secure callable region 0 placed in flash region 1 with size 32.&lt;/p&gt;
&lt;p&gt;SRAM region Domain Permissions&lt;br /&gt;00 07 0x00000 0x10000 Secure rwxl&lt;br /&gt;08 31 0x10000 0x40000 Non-Secure rwxl&lt;/p&gt;
&lt;p&gt;Peripheral Domain Status&lt;br /&gt;00 NRF_P0 Non-Secure OK&lt;br /&gt;01 NRF_CLOCK Non-Secure OK&lt;br /&gt;02 NRF_RTC0 Non-Secure OK&lt;br /&gt;03 NRF_RTC1 Non-Secure OK&lt;br /&gt;04 NRF_NVMC Non-Secure OK&lt;br /&gt;05 NRF_UARTE1 Non-Secure OK&lt;br /&gt;06 NRF_UARTE2 Secure SKIP&lt;br /&gt;07 NRF_TWIM2 Non-Secure OK&lt;br /&gt;08 NRF_SPIM3 Non-Secure OK&lt;br /&gt;09 NRF_TIMER0 Non-Secure OK&lt;br /&gt;10 NRF_TIMER1 Non-Secure OK&lt;br /&gt;11 NRF_TIMER2 Non-Secure OK&lt;br /&gt;12 NRF_SAADC Non-Secure OK&lt;br /&gt;13 NRF_PWM0 Non-Secure OK&lt;br /&gt;14 NRF_PWM1 Non-Secure OK&lt;br /&gt;15 NRF_PWM2 Non-Secure OK&lt;br /&gt;16 NRF_PWM3 Non-Secure OK&lt;br /&gt;17 NRF_WDT Non-Secure OK&lt;br /&gt;18 NRF_IPC Non-Secure OK&lt;br /&gt;19 NRF_VMC Non-Secure OK&lt;br /&gt;20 NRF_FPU Non-Secure OK&lt;br /&gt;21 NRF_EGU1 Non-Secure OK&lt;br /&gt;22 NRF_EGU2 Non-Secure OK&lt;br /&gt;23 NRF_DPPIC Non-Secure OK&lt;br /&gt;24 NRF_REGULATORS Non-Secure OK&lt;br /&gt;25 NRF_PDM Non-Secure OK&lt;br /&gt;26 NRF_I2S Non-Secure OK&lt;br /&gt;27 NRF_GPIOTE1 Non-Secure OK&lt;/p&gt;
&lt;p&gt;SPM: NS image at 0x10000&lt;br /&gt;SPM: NS MSP at 0x20010a80&lt;br /&gt;SPM: NS reset vector at 0x11885&lt;br /&gt;SPM: prepare to jump to Non-Secure image.&lt;br /&gt;*** Booting Zephyr OS build v2.6.0-rc1-ncs1 ***&lt;br /&gt;uart_init() failed. (err: -6)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;cheers&lt;/p&gt;
&lt;p&gt;-brett&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/328552?ContentTypeID=1</link><pubDate>Wed, 08 Sep 2021 10:28:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b5b2db7-ab1f-49b6-bfbb-59d0ba1cebf8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;OK, thanks for confirming. I&amp;#39;ve set up a simple loopback test here now with libuarte running on the 52840 and the Zephyr async driver on the nRF9160 and that seems to work fine. Could you try these 2 projects on your end and see if it works for you as well? Maybe you can spot what we&amp;#39;re doing differently.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/uart_5F00_com_5F00_test_5F00_52840_5F00_9160.zip"&gt;devzone.nordicsemi.com/.../uart_5F00_com_5F00_test_5F00_52840_5F00_9160.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;-Vidar&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; This example selected the wrong UARTE instance. Use the updated projects I uploaded here&lt;strong&gt; &lt;/strong&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/79351/libuarte-connection-between-nrf9160dk-and-nrf52840/330790#330790"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/79351/libuarte-connection-between-nrf9160dk-and-nrf52840/330790#330790&lt;/a&gt; instead.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/328469?ContentTypeID=1</link><pubDate>Tue, 07 Sep 2021 20:21:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aff8075f-112a-429b-9ddd-a06ec57a0108</guid><dc:creator>Brett</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;br /&gt;&lt;br /&gt;No difference.&amp;nbsp; It still works in debug mode but fails otherwise.&lt;/p&gt;
&lt;p&gt;-brett&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: libuarte: Connection between NRF9160dk and NRF52840</title><link>https://devzone.nordicsemi.com/thread/328457?ContentTypeID=1</link><pubDate>Tue, 07 Sep 2021 16:58:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac0da941-2e0e-42c8-9734-8d3d2723aac8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Brett,&lt;/p&gt;
&lt;p&gt;On the 52840 side, could you try to call &lt;span&gt;&lt;a title="sd_clock_hfclk_request" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.3.0/group___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html?cp=4_7_4_1_2_7_2_3#ga3e5afb495a1b0307c749cc268df94a74"&gt;sd_clock_hfclk_request&lt;/a&gt;&lt;/span&gt;() after enabling the Softdevice? This will make the Softdevice keep the HF crystal oscillator (HFXO) on and in turn increase the accuracy of the UART baudrate generator (it runs off the less accurate &lt;span&gt;&lt;a title="64 MHz internal oscillator (HFINT)" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/clock.html?cp=4_0_0_4_3_3_0#unique_1778297346"&gt;HFINT&lt;/a&gt;&lt;/span&gt; clock by default). I think it&amp;#39;s worth trying since you seem to get more stable performance when you keep the chip in debug mode.&lt;/p&gt;
&lt;p&gt;I will try to see if I can replicate it here if the above doesn&amp;#39;t help.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>