<?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>[nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/80781/nrf52811-two-way-uart-connection</link><description>Hello, I am currently using the logger backend to send information via UART from the nRF52811 to a PC. This works well, but only for one way communication. I would like to send some instructions from the PC to the nRF52811, which means having a two way</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 25 Oct 2021 13:51:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/80781/nrf52811-two-way-uart-connection" /><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/335787?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 13:51:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a5b5fb5-a852-4b58-b134-29ec2741949e</guid><dc:creator>slid_daaviet</dc:creator><description>&lt;p&gt;I wasn&amp;#39;t testing a debug build&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f605.svg" title="Sweat smile"&gt;&amp;#x1f605;&lt;/span&gt;. When debugging, I select the app_error_handler function to get the p_file_name value:&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1635169799555v1.png" /&gt;&lt;br /&gt;Then I check the string pointed by p_file_name using watch, and got this:&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1635169880154v2.png" /&gt;Interest fact: when I set NRF_LOG_ENABLE to 1,&amp;nbsp; build and start debugging, the program gets stuck in &amp;quot;running...&amp;quot; at app_fifo_get()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/335781?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 13:42:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:694b79af-12c7-4862-8c6f-62d4d7d99d24</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hm, no. No idea, to be honest. Are you testing a debug build? And can you show how you found the value 0x20005f28?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/335776?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 13:38:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f7196f0-194c-42a0-a5f8-0bd39ed0b341</guid><dc:creator>slid_daaviet</dc:creator><description>&lt;p&gt;I get an &amp;quot;L&amp;quot;. I can&amp;#39;t find what it means. Any idea? (sorry for so many questions)&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1635169054355v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/335767?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 13:27:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8f60ef9-9564-4f3e-bde5-8b0edebed668</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is within the RAM of the nRF51811 so I am not sure why SES restricts this. You can turn of restrictions though, from project options under Debug -&amp;gt; Debugger. There set &amp;quot;Restrict Memory Access&amp;quot; to &amp;quot;No&amp;quot;. Does that help?&lt;/p&gt;
&lt;p&gt;Updat: Just to be sure, make sure you test a debug project, so that DEBUG is defined. That is needed for this information to be part of the build.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/335752?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 13:00:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa8c14de-ed6e-434b-a0bd-d71f9111736c</guid><dc:creator>slid_daaviet</dc:creator><description>&lt;p&gt;Instead of pointing to a file, it says &amp;quot;Restricted memory range&amp;quot;. Have you any idea what it means?&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1635166802591v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/335710?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 11:53:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e3244f1-41a7-48da-99f2-b2ef7ec4e403</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;p_file_name is a pointer to a string that shows the file name where the error was detected by an APP_ERROR_CHECK. If you enable logging it is printed directly. If not, you can inspect it with a debugger. Remember to first make a debug build as that makes this much easier (the C code you see then matches the machine code). Then inspect for instance like this if using SES:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Add p_info to watch&lt;/li&gt;
&lt;li&gt;Read the value of p_file_name wihin p_info&lt;/li&gt;
&lt;li&gt;Type inn (char*)&amp;lt;value of p_file_name&amp;gt; as an expression&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;then you can read the value of the string like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/get_5F00_filename.PNG" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/335701?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 11:20:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:172856bb-3ca2-4780-b3ee-ca4aff3655fb</guid><dc:creator>slid_daaviet</dc:creator><description>&lt;p&gt;If I enable the DEBUG flag, app_error_handler function is called. It has an error code, a p_file_name and line_num, how can I interpret the hexadecimal value of p_file_name to locate the error?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/335691?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 10:56:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ce44c50-4164-494a-8a14-3069369778dd</guid><dc:creator>slid_daaviet</dc:creator><description>[quote userid="7377" url="~/f/nordic-q-a/80781/nrf52811-two-way-uart-connection/335648#335648"]There was a problem with the link to the example you are using. Can you post it again?[/quote]
&lt;p&gt;It&amp;#39;s this &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Fuart_example.html"&gt;UART example&lt;/a&gt;.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/80781/nrf52811-two-way-uart-connection/335648#335648"]I see. What did you do to debug? The APP_UART_FIFO_INIT() essentially created two static buffers, and then calls&amp;nbsp;app_uart_init(). If there is an issue, that should return an error code.[/quote]
&lt;p&gt;If I am correct, it appears to occur when app_uart_get() is called. Then uart_event_handler is called, which in turn calls app_error_handler_bare. Depending on the breakpoints I use,&amp;nbsp;app_error_handler_bare receives an error code of either 0x00000004 or 0x0000000c, which according to nrf_error.h correspond to &amp;quot;No Memory for operation&amp;quot; and &amp;quot;Data size exceeds limit&amp;quot; respectively.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/80781/nrf52811-two-way-uart-connection/335648#335648"]This is to aid debugging. It breaks on error, and then you can inspect with a debugger. What error code was returned from where? As you point to&amp;nbsp;APP_UART_FIFO_INIT I assume you see it is from app_uart_init()? You may be interested in &lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/an-introduction-to-error-handling-in-nrf5-projects"&gt;An introduction to error handling in nRF5 projects&lt;/a&gt;.[/quote]
&lt;p&gt;Ah I see. I&amp;#39;ll read up on that, thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/335648?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 08:03:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e976adc-6159-415e-ac77-c95ba638b331</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="slid_daaviet"]I have tried adapting &lt;a title="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Fuart_example.html" href="https://devzone.nordicsemi.com/f/nordic-q-a/80781/nrf52811-two-way-uart-connection/this%20example"&gt;this example&lt;/a&gt; to the nRF52811, without success so far.[/quote]
&lt;p&gt;There was a problem with the link to the example you are using. Can you post it again?&lt;/p&gt;
[quote user="slid_daaviet"]I think the problem is in the APP_UART_FIFO_INIT function[/quote]
&lt;p&gt;I see. What did you do to debug? The APP_UART_FIFO_INIT() essentially created two static buffers, and then calls&amp;nbsp;app_uart_init(). If there is an issue, that should return an error code.&lt;/p&gt;
[quote user="slid_daaviet"]because there is a call to the app_error_handler funcion and NRF_BREAKPOINT_COND is activated.[/quote]
&lt;p&gt;This is to aid debugging. It breaks on error, and then you can inspect with a debugger. What error code was returned from where? As you point to&amp;nbsp;APP_UART_FIFO_INIT I assume you see it is from app_uart_init()? You may be interested in &lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/an-introduction-to-error-handling-in-nrf5-projects"&gt;An introduction to error handling in nRF5 projects&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/335534?ContentTypeID=1</link><pubDate>Fri, 22 Oct 2021 15:37:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f9ba18c-0281-484b-a070-c2f6eea9262c</guid><dc:creator>slid_daaviet</dc:creator><description>&lt;p&gt;Thanks for the help. I have tried adapting &lt;a title="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Fuart_example.html" href="https://devzone.nordicsemi.com/f/nordic-q-a/80781/nrf52811-two-way-uart-connection/this%20example"&gt;this example&lt;/a&gt; to the nRF52811, without success so far. I think the problem is in the APP_UART_FIFO_INIT function, but can&amp;#39;t even debug it correctly, because there is a call to the app_error_handler funcion and NRF_BREAKPOINT_COND is activated. It&amp;#39;s probably a vague problem description, but that&amp;#39;s what I know so far...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/334862?ContentTypeID=1</link><pubDate>Tue, 19 Oct 2021 12:24:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9956adc2-0517-4080-854a-43e33c6b2a89</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="slid_daaviet"]Thanks for the tip, but that example is for UART over BLE, which is not exactly what I&amp;#39;m looking for.[/quote]
&lt;p&gt;Yes, but the thing is that the example implements UART bridging over BLE (so both physical UART and NUS). If you ignore the BLE/NUS part, you are left with a simple example of using plain UART without the added complexity of the logger library. You can also refer to the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/uart_example.html"&gt;UART example&lt;/a&gt; for something similar.&lt;/p&gt;
[quote user="slid_daaviet"]So, I am already receiving data from the nRF52811, but I would like to just send data through that serial port from the PC to the nRF52811.[/quote]
&lt;p&gt;I see. The easiest way is to refer to one of the examples mentioned above, which implements bidirectional UART communication.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/334849?ContentTypeID=1</link><pubDate>Tue, 19 Oct 2021 11:56:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5549ec7-c4cd-4618-81b4-3b697f98f73e</guid><dc:creator>slid_daaviet</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Thanks for the tip, but that example is for UART over BLE, which is not exactly what I&amp;#39;m looking for. Actually, the nRF52811 is connected to an nRF52840 that is used as a bridge (for flashing the code and reading data), which is turn is connected to the PC via a usb cable. When I plug in the usb cable, a serial port is opened and I am reading that port. So, I am already receiving data from the nRF52811, but I would like to just send data through that serial port from the PC to the nRF52811.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/334683?ContentTypeID=1</link><pubDate>Mon, 18 Oct 2021 17:12:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da824373-0e0c-4b9f-9bb1-50a5604962ce</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The CLI interface can be used for anything, not just control logging (see for instance the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_crypto_cli_example.html"&gt;crypto CLI example&lt;/a&gt;). It is a bit complex though, so an alternative could be to skip the logger module altogether&amp;nbsp;(including CLI) and use a simpler UART library for your UART communication. See for instance how physical UART is used in the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/ble_sdk_app_nus_eval.html"&gt;NUS example&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/334669?ContentTypeID=1</link><pubDate>Mon, 18 Oct 2021 15:01:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ecf7321-0e86-4edc-81a1-189d22e0e136</guid><dc:creator>slid_daaviet</dc:creator><description>&lt;p&gt;Just to clarify, I really just want to be able to send bytes via UART and have them be read by the nRF52811. With that working, I can then design my own protocol that interprets the command bytes&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/334653?ContentTypeID=1</link><pubDate>Mon, 18 Oct 2021 14:10:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f17606e1-db21-4fe0-9b01-ab1b7f9bc553</guid><dc:creator>slid_daaviet</dc:creator><description>&lt;p&gt;From what I can understand, &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Flib_nrf_log.html&amp;amp;anchor=nrf_log_cli"&gt;CLI Interface &lt;/a&gt;allows to control logger parameters, but what if I want to control radio features, e.g stop transmission, or change gpio pins?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [nRF52811] two way UART connection</title><link>https://devzone.nordicsemi.com/thread/334579?ContentTypeID=1</link><pubDate>Mon, 18 Oct 2021 11:46:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9bf56dfe-e4c3-4f54-97b4-f18fe3cf2b0e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi David,&lt;/p&gt;
&lt;p&gt;Are you using the logger module in the nRF5 SDK? If using a recent&amp;nbsp;nRF5 SDK&amp;nbsp;versions&amp;nbsp;and the logger module, you can consider the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_nrf_log.html#nrf_log_cli"&gt;CLI interface&lt;/a&gt;. Older nRF5 SDK versions also had a method for reading back simple characters without using the CLI (using&amp;nbsp;NRF_LOG_GETCHAR()), but that was removed in SDK 15.0.0.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>