<?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>I can&amp;#39;t read on my uart</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49174/i-can-t-read-on-my-uart</link><description>Hi, i&amp;#39;m using nRF52840 
 I&amp;#39;m using 2 uarts : 
 one (uart0) is only for logging and another one (uart1) is for communication. 
 I can send from both uart, i can see i receive datas from uart1 but i can&amp;#39;t read it 
 I try to read with an event_handle, event</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Jul 2019 14:41:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49174/i-can-t-read-on-my-uart" /><item><title>RE: I can't read on my uart</title><link>https://devzone.nordicsemi.com/thread/195717?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 14:41:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:388762fe-99d3-4896-9134-604fbfac28c9</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The&amp;nbsp;&lt;span&gt;NRF_ERROR_MODULE_NOT_INITIALIZED error should only be returned if the following evaluates&amp;nbsp;to false:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;if (!p_serial-&amp;gt;p_ctx-&amp;gt;p_config)&lt;br /&gt; {&lt;br /&gt; return NRF_ERROR_MODULE_NOT_INITIALIZED;&lt;br /&gt; }&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't read on my uart</title><link>https://devzone.nordicsemi.com/thread/195701?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 14:10:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1d91407-14f4-4cab-baaa-0e8c111bc90d</guid><dc:creator>Geoffroy</dc:creator><description>&lt;p&gt;yes right now i can read each data so that&amp;#39;s good (i still have other tests to do)&lt;/p&gt;
&lt;p&gt;i don&amp;#39;t understand neither.&lt;/p&gt;
&lt;p&gt;i understand to get an err 0x80 because my function event_handle wasn&amp;#39;t in same file that def of uart OK.&lt;/p&gt;
&lt;p&gt;but why there is an err for module not initialized after i could read data once I don&amp;#39;t know !!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't read on my uart</title><link>https://devzone.nordicsemi.com/thread/195696?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 14:00:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84d2f25f-9ae9-4960-bd46-2a49a8d60faa</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Ok, so changing the&amp;nbsp;&lt;em&gt;timeout_ms&lt;/em&gt;&lt;span&gt;&amp;nbsp; variable to 0, i.e. executing the nrf_serial_read function as a non-blocking call fixed the issue? I do not see why that change resolves teh issue with&amp;nbsp;nrf_serial_read&amp;nbsp;returning&amp;nbsp;0x80, i.e. NRF_ERROR_MODULE_NOT_INITIALIZED.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't read on my uart</title><link>https://devzone.nordicsemi.com/thread/195676?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 13:33:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a122103a-1e9a-4b7a-82d1-eec98accb9ca</guid><dc:creator>Geoffroy</dc:creator><description>&lt;p&gt;data isn&amp;#39;t modified between calls.&lt;/p&gt;
&lt;p&gt;i changed timeout value to 0 in&amp;nbsp;&lt;span&gt;nrf_serial_read() call and it works correctly now.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't read on my uart</title><link>https://devzone.nordicsemi.com/thread/195663?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 13:14:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6025e480-a370-477b-8c91-1c5a821e05c3</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Then is sounds like the data pointed to by p_serial is modified between the calls. Can you print or set a breakpoint at the&amp;nbsp;nrf_serial_read() call and see if the data is being modified between the calls?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't read on my uart</title><link>https://devzone.nordicsemi.com/thread/195657?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 13:00:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16419fae-693c-4e8a-8038-79a52a3157b3</guid><dc:creator>Geoffroy</dc:creator><description>&lt;p&gt;well i finally included all code in same file (main.c)&lt;/p&gt;
&lt;p&gt;i read value first time then error 0x80&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't read on my uart</title><link>https://devzone.nordicsemi.com/thread/195651?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 12:55:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53bc592f-a044-4acb-b22e-9bdf0f40a09a</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;It might be&amp;nbsp;if the&amp;nbsp;p_serial pointer passed to&amp;nbsp;nrf_serial_read() function is not the same as the one the one defined in&amp;nbsp;NRF_SERIAL_UART_DEF(serial1_uart, 1). Have you placed&amp;nbsp;NRF_SERIAL_UART_DEF(serial1_uart, 1) in a common header file that that is included in both main and uart.c?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ret_code_t nrf_serial_read(nrf_serial_t const * p_serial,
                           void * p_data,
                           size_t size,
                           size_t * p_read,
                           uint32_t timeout_ms)
{
    ret_code_t ret;

    ASSERT(p_serial);
    if (!p_serial-&amp;gt;p_ctx-&amp;gt;p_config)
    {
        return NRF_ERROR_MODULE_NOT_INITIALIZED;
    }
    
    .
    .
    .
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't read on my uart</title><link>https://devzone.nordicsemi.com/thread/195648?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 12:52:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a551419-f6c0-46d6-b82f-e66626902e8b</guid><dc:creator>Geoffroy</dc:creator><description>&lt;p&gt;EDIT2 : i put all code in file main.c&lt;/p&gt;
&lt;p&gt;now i receive correctly first value, but when i send another one i get ret = 0x80 NRF_ERROR_MODULE_NOT_INITIALIZED&lt;/p&gt;
&lt;p&gt;where is the problem ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I can't read on my uart</title><link>https://devzone.nordicsemi.com/thread/195619?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 11:47:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6109760-eb9c-45b2-aa7e-63f29b09e721</guid><dc:creator>Geoffroy</dc:creator><description>&lt;p&gt;EDIT :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I add ret = to function&amp;nbsp;nrf_serial_read to get err_code.&lt;/p&gt;
&lt;p&gt;i get err_code 0x80 for&amp;nbsp;NRF_ERROR_MODULE_NOT_INITIALIZED.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;code for init (above) is in main.c and code for event_handle is in another file, uart.c could it be a problem ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>