<?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>Cannot read properly from UART with Thingy 91</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93108/cannot-read-properly-from-uart-with-thingy-91</link><description>Hi. 
 We are working on a project that needs to read several bytes from the UART using Thingy 91. Connectivity bridge is flashed in the 52840 SoC but the main project in the 9160 only manages to read 7 bytes from the UART. I&amp;#39;ve attached a sample that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Jan 2023 13:07:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93108/cannot-read-properly-from-uart-with-thingy-91" /><item><title>RE: Cannot read properly from UART with Thingy 91</title><link>https://devzone.nordicsemi.com/thread/406037?ContentTypeID=1</link><pubDate>Mon, 23 Jan 2023 13:07:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33899942-a3eb-4087-926c-48d9ece1406d</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="MarioDLH"]It&amp;#39;s like it&amp;nbsp;won&amp;#39;t work if a serial connection isn&amp;#39;t detected at the moment the example starts runnning.[/quote]
&lt;p&gt;&lt;span&gt;Sorry for the delay. Try to add something like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;	/* Data Terminal Ready - check if host is ready to communicate */
	while (!dtr) {
		ret = uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &amp;amp;dtr);
		if (ret) {
			LOG_ERR(&amp;quot;Failed to get Data Terminal Ready line state: %d&amp;quot;,
				ret);
			continue;
		}
		k_msleep(100);
	}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Example usage &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.2.99-ncs1/samples/subsys/usb/cdc_acm/src/main.c#L100"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot read properly from UART with Thingy 91</title><link>https://devzone.nordicsemi.com/thread/396393?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2022 11:44:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3d71821-79c0-4929-b4d3-a13f887a7d64</guid><dc:creator>MarioDLH</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Has there been any progress with this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot read properly from UART with Thingy 91</title><link>https://devzone.nordicsemi.com/thread/392964?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2022 09:01:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86158e0f-c74e-4341-b4f4-5a2469571e0f</guid><dc:creator>MarioDLH</dc:creator><description>&lt;p&gt;I&amp;#39;m using version 2.0.0 currently. When I try sending data opening the port with an external program it doesn&amp;#39;t work in any case. It can receive bytes using a terminal if I flash (or restart) the device with it previously opened. It&amp;#39;s like it&amp;nbsp;won&amp;#39;t work if a serial connection isn&amp;#39;t detected at the moment the example starts runnning.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot read properly from UART with Thingy 91</title><link>https://devzone.nordicsemi.com/thread/392951?ContentTypeID=1</link><pubDate>Fri, 28 Oct 2022 08:04:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b532cc9-790a-4d66-82c9-9f3a4765ee31</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1) What nRF Connect SDK version are you using?&lt;/p&gt;
[quote user="MarioDLH"]Also, it doesn&amp;#39;t receive anything if I try to send data using the program I provided before. In both cases it gets blocked and I even have to reset the thingy and recover the device in order to flash it again. Is there any idea of what is causing this?[/quote]
&lt;p&gt;2) These errors are happened after you closed the terminal, and opened it again? Before you closed the terminal, it was working as expected ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot read properly from UART with Thingy 91</title><link>https://devzone.nordicsemi.com/thread/392452?ContentTypeID=1</link><pubDate>Tue, 25 Oct 2022 15:25:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e439f3b-ee64-46f8-8ecf-4767a3129412</guid><dc:creator>MarioDLH</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Thanks for the reply. I tried the provided example and it works fine using putty, but as soon as I close the terminal, it won&amp;#39;t work again if I reopen it. Also, it doesn&amp;#39;t receive anything if I try to send data using the program I provided before. In both cases it gets blocked and I even have to reset the thingy and recover the device in order to flash it again. Is there any idea of what is causing this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot read properly from UART with Thingy 91</title><link>https://devzone.nordicsemi.com/thread/392118?ContentTypeID=1</link><pubDate>Mon, 24 Oct 2022 11:09:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00cc19a5-6075-46cf-a7ab-9936ebeb7654</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I recommend using the async UART. You can find a link to an example in this post:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/81387/limited-to-reading-8-bytes-per-transmission-on-uart_fifo_read-function/337487"&gt;RE: Limited to reading 8 bytes per transmission on uart_fifo_read() Function&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot read properly from UART with Thingy 91</title><link>https://devzone.nordicsemi.com/thread/392101?ContentTypeID=1</link><pubDate>Mon, 24 Oct 2022 10:34:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebb53958-5ba0-4235-b2a3-510cedfcfe19</guid><dc:creator>MarioDLH</dc:creator><description>&lt;p&gt;I tried to do so, but unfortunately the problem persists. It keeps receiving the same 7 bytes everytime there is a message. I hope they can find another solution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cannot read properly from UART with Thingy 91</title><link>https://devzone.nordicsemi.com/thread/391910?ContentTypeID=1</link><pubDate>Fri, 21 Oct 2022 13:26:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac4676c4-fd73-4882-a182-6464936a55c6</guid><dc:creator>y009</dc:creator><description>&lt;p&gt;Looking also for an alternative solution for this.&amp;nbsp;&lt;br /&gt;I found that it is the newline causing the receiving to be triggered as done. I could send however long a char:&lt;br /&gt;sending &amp;quot;hello world&amp;quot;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;D: uart evt 3
T: rx_enable ret: 0
D: uart evt 2
T: hello world
D: uart evt 4
D: uart evt 5
T:
D: uart evt 3
T: rx_enable ret: 0&lt;/pre&gt;&lt;br /&gt;hello world is properly received.&lt;br /&gt; But when sending &amp;quot;hello&amp;nbsp;&lt;br /&gt;world&amp;quot;, with a new line in-between the received msg becomes scrambled:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;D: uart evt 3
T: rx_enable ret: 0
D: uart evt 2
worldllo
D: uart evt 4
D: uart evt 5
T:
D: uart evt 3
T: rx_enable ret: 0&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Since you are sending certificates, as was I, hopefully a better solution comes up but mine was:&lt;br /&gt;switch to&amp;nbsp;&lt;span&gt;asynchronous&amp;nbsp;uart api and prepare the certificates before sending them over by stripping all the newline characters and re-add them back in on the mcu. &lt;br /&gt;(Since the location of newlines for pem type certificates is after 64characters it&amp;#39;s easy to find the correct location to add them back in)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>