<?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 resets the chip when sending new line</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16085/uart-resets-the-chip-when-sending-new-line</link><description>Hi, 
 I want to communicate with other chip on UART.
the chip on other end requires AT(CR,LF) command to start communication over UART. 
 UART is setup correctly, but it reset the NRF51 chip
following is snippet of my code for sending data over UART</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 31 Aug 2016 14:19:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16085/uart-resets-the-chip-when-sending-new-line" /><item><title>RE: UART resets the chip when sending new line</title><link>https://devzone.nordicsemi.com/thread/61341?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2016 14:19:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d3e9f4c-3d29-478f-8f42-d0ff238d8589</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Are you using the default SDK 11 UART example otherwise??  My main code looks like this, which seems to be working fine with optimization level 3:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;printf(&amp;quot;\n\rStart: \n\r&amp;quot;);

uint8_t p_data[4] = {0x41, 0x54, 0x0d, 0x0a};

for (uint8_t i=0; i&amp;lt;4; i++) { while (app_uart_put(p_data[i]) != NRF_SUCCESS); }
for (uint8_t i=0; i&amp;lt;2; i++) { while (app_uart_put(p_data[i]) != NRF_SUCCESS); }
	
while (true) { }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I can receive all the characters on the UART peer side.   Perhaps it could help to see trace of the UART lines when this data is sent (RXD,TXD,RTS,CTS), perhaps that will provide some hints.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART resets the chip when sending new line</title><link>https://devzone.nordicsemi.com/thread/61340?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2016 14:04:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:869ed9f8-1736-4c01-8ae7-46427f70a954</guid><dc:creator>nirmal@nordic</dc:creator><description>&lt;p&gt;This is strange !!!!!
Yes I am using nRF51 - DK....
But I could not make it working on Level 3 ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART resets the chip when sending new line</title><link>https://devzone.nordicsemi.com/thread/61339?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2016 13:23:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b021804-eacb-4ee1-b2c8-96bb2bffb575</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;I was actually running this with Level 3 optimization, but it works fine. Im running this on nRF51-DK. Are you using the same?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART resets the chip when sending new line</title><link>https://devzone.nordicsemi.com/thread/61338?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2016 13:09:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38fc1449-b9a4-46fb-8157-8ceb7647cbef</guid><dc:creator>nirmal@nordic</dc:creator><description>&lt;p&gt;Hi,
Thank you for your answer...
But I found issue was running with Level3 Optimization...&lt;/p&gt;
&lt;p&gt;As soon as I switched to Level 0 Optimization...It worked fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART resets the chip when sending new line</title><link>https://devzone.nordicsemi.com/thread/61337?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2016 13:05:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13a4508e-fd26-4f39-8f1c-5a86011e2930</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I insert your snippet code into the uart example in nRF5 SDK 11.0.0 and it works fine. I can not reproduce the problem. By default, the nrF51 resets upon application error. Check if you can capture an error code in the debugger instead of resetting the nRF51, as described &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/?answer=60126#post-id-60126"&gt;here&lt;/a&gt;. &lt;a href="https://devzone.nordicsemi.com/blogs/821/an-introduction-to-error-handling-in-nrf5-projects/"&gt;This thread&lt;/a&gt; could also be helpful for debugging.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>