<?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>nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/20545/nrf52-dk-uart-problems</link><description>Hello, 
 I integrated the relevant code from the &amp;quot;uart&amp;quot; example into the &amp;quot;ble_app_uart&amp;quot; example(this is all the code in the main routine): 
 uint8_t cr; 
uart_init();
	printf(&amp;quot;\r\nUART Start!\r\n&amp;quot;);

 while (true){
 
 while (app_uart_get(&amp;amp;cr)</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 31 Mar 2017 11:00:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/20545/nrf52-dk-uart-problems" /><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80094?ContentTypeID=1</link><pubDate>Fri, 31 Mar 2017 11:00:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:164686be-f099-43db-83d1-958204499ac3</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;In APP_UART_FIFO_INIT, the function name for the event handler is passed as an argument. As you can see in the source code: APP_UART_FIFO_INIT() --&amp;gt; app_uart_init(), the UART event handler is assigned to m_event_handler (app_uart_fifo.c). In case of an UART event, uart_event_handler (app_uart_fifo.c) will pass the event to the assigned m_event_handler.&lt;/p&gt;
&lt;p&gt;In app_uart_fifo.c, uart_event_handler() is set to be the event handler function in app_uart_init() --&amp;gt; nrf_drv_uart_init().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80104?ContentTypeID=1</link><pubDate>Thu, 30 Mar 2017 08:43:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b2f7d02-48e4-431a-b1a5-4b2f3be50679</guid><dc:creator>H4NNE5</dc:creator><description>&lt;p&gt;OK, thank you for making that clear. So that&amp;#39;s the difference I already pointed out in my initial question but lacking knowledge of the internal UART procedures, I couldn&amp;#39;t conclude which impact &amp;quot;error&amp;quot; or &amp;quot;event handle&amp;quot; would have.
I still don&amp;#39;t understand how during the &amp;quot;APP_UART_FIFO_INIT&amp;quot;, &amp;quot;error&amp;quot; or &amp;quot;uart handle&amp;quot; are passed without the required &amp;quot;p_event&amp;quot; pointer. Can you please also explain that to me?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80105?ContentTypeID=1</link><pubDate>Wed, 29 Mar 2017 12:28:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6e13c97-9e4b-4c29-87a6-19882dee5f24</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;After testing your example, and comparing it with the &amp;quot;bare&amp;quot; uart example in the SDK, I realized why app_uart_get() always returns NRF_ERROR_NOT_FOUND (0x05): The mechanism in the &amp;quot;bare&amp;quot; uart example and ble_app_uart is different. The bare UART example uses polling/pulling to check if characters have been transmitted over UART, while ble_app_uart is event driven. The difference between the two examples lies in uart_error_handle (uart) and uart_event_handle (ble_app_uart).&lt;/p&gt;
&lt;p&gt;In the bare uart example, uart_error_handle does only check for communication errors, and does not handle incoming data.&lt;/p&gt;
&lt;p&gt;In ble_app_uart, uart_event_handle will handle the event for incoming data (APP_UART_DATA_READY). Since UART is running on higher priority than main(), uart_event_handle --&amp;gt; APP_UART_DATA_READY --&amp;gt; app_uart_get() will always the data before app_uart_get() in main. app_uart_get() in main will return NRF_ERROR_NOT_FOUND because all incoming characters have already been read.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80106?ContentTypeID=1</link><pubDate>Mon, 27 Mar 2017 08:56:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:664ba61f-ba64-4751-87ca-68be649b3a71</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Did you upload your project file?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80098?ContentTypeID=1</link><pubDate>Thu, 23 Mar 2017 14:05:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b364f2ab-1370-4d37-a13b-6948c09408cb</guid><dc:creator>H4NNE5</dc:creator><description>&lt;p&gt;First: I can&amp;#39;t upload my project files to this answer (see the Top in Capital letters). Why?&lt;/p&gt;
&lt;p&gt;Second: In your python script RTSCTS Flow Control was set to 1 while in the main.c the Flow Control was disabled. That&amp;#39;s why I had strange behavior. And Flow Control HAS to be enabled. Program gets stuck if it&amp;#39;s disabled.
But the errorcode is still 0x05. So please check out my project file, if I can upload it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80086?ContentTypeID=1</link><pubDate>Thu, 23 Mar 2017 10:23:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3484048e-53e4-4df0-be40-75728e7cbf4e</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;The uart_event_handle is provided upon UART initialization, and since there will be a UART interrupt upon a reception over UART, it is normal that the uart_event_handle will be called. In the small example I uploaded, the softdevice is not enabled, no BLE link, etc., so the firmware should go to the error handler after calling ble_nus_string_send() (I believe)).&lt;/p&gt;
&lt;p&gt;The priority of uart_event_handle is APP_IRQ_PRIORITY_LOWEST, which is higher than the main loop. Therefore, if characters are sent continuously over UART, there will always be a UART interrupt, and it will not be possible to return to the main thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80085?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 12:04:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48df765e-bb70-4066-821c-02882edcdf58</guid><dc:creator>H4NNE5</dc:creator><description>&lt;p&gt;The DK received the bytes from the script using the uart example but not in the ble-example.&lt;/p&gt;
&lt;p&gt;Yes, the ble_app_uart example worked fine. Only after I got that running I started with this UART experiment.&lt;/p&gt;
&lt;p&gt;Update:
The Characters appear inside the &amp;quot;m_rx_fifo&amp;quot; struct so the RX is setup correctly and also after each received character the &amp;quot;err_code&amp;quot; is 0x00, but after leaving &amp;quot;app_uart_get&amp;quot; the program doesn&amp;#39;t jump back into your routine but inside the routine &amp;quot;uart_event_handle&amp;quot; which is part of the &amp;quot;main.c&amp;quot; which is weird.&lt;/p&gt;
&lt;p&gt;Btw. Thank you for your intensive help on this problem! That&amp;#39;s highly appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80100?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 11:39:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:972e9899-a85f-4c78-abfb-f0a83c64b8c1</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Also, does ble_app_uart in the SDK work for you? Are you able to transfer data from the PC to the peripheral device?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80099?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 11:38:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d61d7f5d-aeb8-484a-8c9c-2a47bc15879f</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Could you try &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/uart_5F00_nbytes.py"&gt;this python script&lt;/a&gt;  for pushing data from the PC over UART for a given COM port, and check if that change anything?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80095?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 11:34:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15d9e199-b73a-4cb9-8dd1-bcc5f7134d93</guid><dc:creator>H4NNE5</dc:creator><description>&lt;p&gt;Same here.
If I use the UART example, the echo function works also for single characters.&lt;/p&gt;
&lt;p&gt;Can you find out if it&amp;#39;s important if the UART flow control is disabled or enabled and the difference between uart_event_handle and uart_error_handle in &amp;quot;APP_UART_FIFO_INIT&amp;quot;? Because as mentioned above, these are the differences inbetween both examples.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80097?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 11:32:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2888c70-fec2-4598-95dc-e8aad84b49d5</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;How do you transfer data from the terminal to the DK? Do you type characters in the terminal? That is what I do. Sometimes, I have the impression that the terminal will not transfer one character only, but rather wait for multiple characters to transfer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80093?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 10:06:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06d85b9c-3b00-49ef-a670-9f0eb2ac163b</guid><dc:creator>H4NNE5</dc:creator><description>&lt;p&gt;Alright, the missing softdevice was the cause.
The memorysettings didn&amp;#39;t have to be adapted, because I took the project file right out of the example folder. However the frequency setting was at 12MHz instead of 64 like in your image.
But with debug running now I still don&amp;#39;t get a &amp;quot;NRF_SUCCESS&amp;quot;. Weird.
For &amp;quot;got_character&amp;quot; and &amp;quot;cr&amp;quot; I get a &amp;quot;not in scope&amp;quot; in my Watch1.
How do you upload pictures here in the comments? I wanted to share my screenshot.&lt;/p&gt;
&lt;p&gt;Update:  OK, they were &amp;quot;not in scope&amp;quot; because they get optimized away. I set the optimization level to 0. But the errorcode in &amp;quot;app_uart_get&amp;quot; is still 5.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80103?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 09:44:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac25382f-d53e-404f-b9f6-f0627a3737c4</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ram_5F00_rom.PNG" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80102?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 09:41:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e279a13-692d-4439-9fa5-3f4097cc4cef</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Did you remember to flash the softdevice, S132 v. 4.0.2? And change the RAM/ROM settings for the project?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80096?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 09:11:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:134c5cc3-8f51-4132-9ef7-d965c507e874</guid><dc:creator>H4NNE5</dc:creator><description>&lt;p&gt;Ok, Thanks. Of course I forgot to update the sdk_config-file...
Now it compiles correctly but the next problem that emerges is that in debug mode is that the debugging isn&amp;#39;t reaching the main() routine. It get&amp;#39;s stuck somewhere running in a dead loop.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80101?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 08:08:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ecd5b76-cb15-4e37-a151-b1e0ea0d940e</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;I have updated my answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80092?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2017 15:00:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ac4f49e-e714-4d11-aa5b-e4683c64f0f1</guid><dc:creator>H4NNE5</dc:creator><description>&lt;p&gt;Hi Kristin,
I integrated the new SDK and the example&amp;#39;s project file and adapted the links to the header files but I still get this error:
&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Errors.png"&gt;Error List&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Update:
Here is my project folder content: I CANT UPLOAD THE FILE FROM MY COMPUTER :(&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80088?ContentTypeID=1</link><pubDate>Mon, 20 Mar 2017 11:33:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:466f31fb-a886-4742-b40b-2c9d56b317d1</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;I have updated my answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80090?ContentTypeID=1</link><pubDate>Fri, 17 Mar 2017 14:36:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d6aac45-345d-4eb3-89f6-b859235d32b5</guid><dc:creator>H4NNE5</dc:creator><description>&lt;p&gt;Yes that&amp;#39;s exactly the error I get from debugging.
So I guess it must have to do with a wrong configuration, but which? Because I thought I checked all UART configuration between the 2 examples...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80091?ContentTypeID=1</link><pubDate>Fri, 17 Mar 2017 13:49:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cc5701a-e05d-415b-9963-ac27c1f14b31</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Aha, I misunderstood, I thought you connected two nRF52-DKs together.&lt;/p&gt;
&lt;p&gt;When you connect the nRF52-DK to a serial port on a PC, does app_uart_get() return NRF_SUCCESS if you send some characters from the terminal to the nRF52-DK? If app_uart_get() returns NRF_ERROR_NOT_FOUND is means that there is no data in the RX buffer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80089?ContentTypeID=1</link><pubDate>Fri, 17 Mar 2017 13:20:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:163bc8a2-f461-435e-aa64-cf96e72c1093</guid><dc:creator>H4NNE5</dc:creator><description>&lt;p&gt;Do you know what the UART example is doing?
It&amp;#39;s establishing a connection from the board to the PC using the virtual COM port over USB and echoing UART communication that&amp;#39;s coming from the PC.
So there&amp;#39;s no need to check any connection. Also I wrote that the UART example itself is working fine.
Maybe you didn&amp;#39;t see that I&amp;#39;m using your Development Kit (PCA10040).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 DK: UART problems</title><link>https://devzone.nordicsemi.com/thread/80087?ContentTypeID=1</link><pubDate>Fri, 17 Mar 2017 13:15:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee01b304-290d-43bf-8a3d-da3bd347c7fa</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Could you double check that you have connected the boards correctly together?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;TX &amp;lt;--&amp;gt; RX
RX &amp;lt;--&amp;gt; TX
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Update 20.03.2017:&lt;/strong&gt; I have tested similar code here, based on ble_app_uart (SDK 13), and in that case app_uart_get(..) will receive characters from the terminal. Could you test my code, and check if it work on your side? The project should be used with S132 v.4.0.2.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ble_5F00_app_5F00_uart_5F00_UART_5F00_only.zip"&gt;ble_app_uart_UART_only.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 22.03.2017:&lt;/strong&gt; APP_TIMER_CONFIG_RTC_FREQUENCY should have the following definition in sdk_config.h.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/app_5F00_timer_5F00_def.PNG" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>