<?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>How to get Sensor value over UART from External MCU (Arduino) to nRF9160?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/77710/how-to-get-sensor-value-over-uart-from-external-mcu-arduino-to-nrf9160</link><description>Hello There, 
 
 Basically I just want to get Sensor data like (Temp Sensor) who already connect to Arduino and I get it , So I just want that data to nRF9160 over UART in nRF9160 DK and Send it to the Server. 
 How can i do this, IF the suggestion is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 26 Jul 2021 10:16:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/77710/how-to-get-sensor-value-over-uart-from-external-mcu-arduino-to-nrf9160" /><item><title>RE: How to get Sensor value over UART from External MCU (Arduino) to nRF9160?</title><link>https://devzone.nordicsemi.com/thread/321766?ContentTypeID=1</link><pubDate>Mon, 26 Jul 2021 10:16:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04631849-4e45-46dd-b10e-3cd26dbc97fc</guid><dc:creator>Simon</dc:creator><description>[quote user="jaydip1305"]and above example can work with nRF52840 mcu instead of Arduino if yes then what should i write code for nRF52840mcu.[/quote]
&lt;p&gt;The Arduino code is not compatible with the nRF52840. However, the lpuart sample i linked to should work with the nRF52840. However, you have to modify the nrf52840 overlay file like I did for the nRF9160&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/compare/v1.6.0...simon-iversen:lpuart_using_normal_uart"&gt;https://github.com/nrfconnect/sdk-nrf/compare/v1.6.0...simon-iversen:lpuart_using_normal_uart&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;/span&gt;&lt;/p&gt;
[quote user="jaydip1305"]but the question is can&amp;#39;t find the receiver buffer how can I receive my Arduino sensor data in main.c file can you pls give me some hints or some points.[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As you can see at &lt;a href="https://github.com/simon-iversen/sdk-nrf/blob/b548980db67ad4f05cfe2ac64e321d143c1111c7/samples/peripheral/lpuart/src/main.c#L59"&gt;this line&lt;/a&gt;&amp;nbsp;we get the length of the received data using&amp;nbsp;&lt;code&gt;&lt;span&gt;evt-&amp;gt;&lt;/span&gt;&lt;span&gt;data&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;tx&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&lt;code&gt;len&lt;/code&gt;. You can access a pointer that points to the receive buffer at&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;code&gt;&lt;span&gt;evt-&amp;gt;&lt;/span&gt;&lt;span&gt;data&lt;/span&gt;&lt;span&gt;.&lt;/span&gt;&lt;span&gt;tx&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&lt;code&gt;.buf&lt;/code&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;By the way:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The code I linked you to is based on the &lt;a href="https://github.com/nrfconnect/sdk-nrf/tree/v1.6.0/samples/peripheral/lpuart"&gt;LPUART sample&lt;/a&gt;&amp;nbsp;but it is modified to use the normal UART driver instead&amp;nbsp;(such that uart.h--&amp;gt;uart_nrfx_uarte.c&amp;nbsp;is used instead of&amp;nbsp;uart.h--&amp;gt;uart_nrf_sw_lpuart.c --&amp;gt; uart_nrfx_uarte.c). This was because this makes it possible to disable flow control and I wanted to provide you with a simple sample to start with.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get Sensor value over UART from External MCU (Arduino) to nRF9160?</title><link>https://devzone.nordicsemi.com/thread/321618?ContentTypeID=1</link><pubDate>Fri, 23 Jul 2021 16:55:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfbba602-b6ad-4ffe-93f3-344ec1dcdd62</guid><dc:creator>jaydip1305</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;Thank you for the response,&lt;/p&gt;
&lt;p&gt;I am able to communicate with nRF9160dk to Arduino.&lt;/p&gt;
&lt;p&gt;but the question is can&amp;#39;t find the receiver buffer how can I receive my Arduino sensor data in main.c file can you pls give me some hints or some points.&lt;/p&gt;
&lt;p&gt;and above example can work with nRF52840 mcu instead of Arduino if yes then what should i write code for nRF52840mcu.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks &amp;amp; Regards&lt;/p&gt;
&lt;p&gt;Jaydip Kavaiya&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get Sensor value over UART from External MCU (Arduino) to nRF9160?</title><link>https://devzone.nordicsemi.com/thread/321138?ContentTypeID=1</link><pubDate>Wed, 21 Jul 2021 13:08:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c3bfae8-4d26-45cf-b7ff-5f5d348627d7</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;You can transfer the sensor data over UART. First you need to set up Serial communication on the Arduino&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.arduino.cc/en/Tutorial/LibraryExamples/SoftwareSerialExample"&gt;https://www.arduino.cc/en/Tutorial/LibraryExamples/SoftwareSerialExample&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then you set up serial communication on the nRF9160 DK&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/simon-iversen/sdk-nrf/tree/lpuart_using_normal_uart/samples/peripheral/lpuart"&gt;https://github.com/simon-iversen/sdk-nrf/tree/lpuart_using_normal_uart/samples/peripheral/lpuart&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Then you connect&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;RX (arduino) to TX (nrf9160)&lt;/li&gt;
&lt;li&gt;RX (nrf9160) to TX (arduino)&lt;/li&gt;
&lt;li&gt;GND (arduino) to GND (nrf9160)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;and you should be able to communicate between them.&lt;/p&gt;
&lt;p&gt;Please let me know if you encounter any issues.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>