<?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>UART lock up</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23966/uart-lock-up</link><description>Hi, 
 I&amp;#39;m having some trouble using the UART protocol (4800 8N1) communicating with a GPS device. 
 It happen that the nRF51 device is not getting an interrupt (nothing at all, even not an error) when a NMEA character have been sent from the GPS. (I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Aug 2017 07:08:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23966/uart-lock-up" /><item><title>RE: UART lock up</title><link>https://devzone.nordicsemi.com/thread/94354?ContentTypeID=1</link><pubDate>Wed, 02 Aug 2017 07:08:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9ac5e7b-1bd0-4772-b25d-6d7c6e9e2654</guid><dc:creator>shadowsky</dc:creator><description>&lt;p&gt;Thank Sigurd for your answer.&lt;/p&gt;
&lt;p&gt;I tried to run my program with the patch you suggest me (&lt;a href="https://devzone.nordicsemi.com/question/59646/uart-sdk-migration-810-1000/?answer=60042#post-id-60042"&gt;see this link&lt;/a&gt;). But it didn&amp;#39;t help to solve my issue.&lt;/p&gt;
&lt;p&gt;After further research in the nordic library I found what was causing me trouble and patch it (see bellow), which resolved everything in my case.&lt;/p&gt;
&lt;p&gt;My problem because I wasn&amp;#39;t reading my FIFO buffer fast enough (this happen in purpose) I started to have the length between my reading pointer and my writing pointer bigger than the FIFO length buffer than I declared.&lt;/p&gt;
&lt;p&gt;file modified: components/libraries/uart/app_uart_fifo.c (line 21)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static __INLINE uint32_t fifo_length(app_fifo_t * const fifo)
 {
   uint32_t tmp = fifo-&amp;gt;read_pos;
-  return fifo-&amp;gt;write_pos - tmp;
+  return (uint32_t)((uint32_t)fifo-&amp;gt;write_pos - tmp) &amp;amp; fifo-&amp;gt;buf_size_mask;
 }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;file modified: components/libraries/fifo/app_fifo.c (line 30)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static __INLINE uint32_t fifo_length(app_fifo_t * p_fifo)
{
  uint32_t tmp = p_fifo-&amp;gt;read_pos;
-  return p_fifo-&amp;gt;write_pos - tmp;
+  return (uint32_t) ((uint32_t) p_fifo-&amp;gt;write_pos - tmp) &amp;amp; p_fifo-&amp;gt;buf_size_mask;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Of course if anyone think at a better solution to solve this issue I&amp;#39;m open to any suggestion.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART lock up</title><link>https://devzone.nordicsemi.com/thread/94353?ContentTypeID=1</link><pubDate>Tue, 01 Aug 2017 14:22:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:859c74ee-334d-40bb-b05a-ffbaebda54ee</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Make sure that both the GPS and the nRF51 device are configured with the same settings (Baud-rate, parity, flow-control) and connected correctly(RX_PIN_NUMBER/ TX_PIN_NUMBER). Also make sure that the UART is initialized properly without error(see &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;this post&lt;/a&gt; about debugging).&lt;/p&gt;
&lt;p&gt;Also check that you are not running to the isssue described &lt;a href="https://devzone.nordicsemi.com/question/59646/uart-sdk-migration-810-1000/?answer=60042#post-id-60042"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>