<?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>Use libuarte example with GPIO</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/64667/use-libuarte-example-with-gpio</link><description>Good afternoon everyone, I am facing problems using libuarte example (SDK 17 and NRF52 DK. Using SES and S132, PCA 10040) It works well with puTTY or other software, but I want to use it to read data from an Arduino. What I do is the following : I connect</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Aug 2020 08:31:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/64667/use-libuarte-example-with-gpio" /><item><title>RE: Use libuarte example with GPIO</title><link>https://devzone.nordicsemi.com/thread/265485?ContentTypeID=1</link><pubDate>Thu, 20 Aug 2020 08:31:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ba4aeba-a067-44a6-aea7-9b77ec3b0d49</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;One thing you can try if you&amp;#39;re having transmission problems is to enable the external HF clock constantly from your application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Using external HF clock means you will have much more accurate baudrate generation for the UART. Without it you could have as much as +/- 5% drift on the clock, which could lead to bit errors over the UART.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re not using a SoftDevice then enabling external HF clock can be done as easy as this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;&lt;/pre&gt;&lt;/p&gt;
[quote user="roduss"]Do you confirm that you have perfect transmission using 2 nRF kits at 115200 bps ?[/quote]
&lt;p&gt;Yes, if you&amp;#39;re using external HF clock like I mentioned above.&amp;nbsp;&lt;/p&gt;
[quote user="roduss"]One last thing I would like to be sure about, is libuarte&amp;nbsp; supposed to be more accurate than the UART example without Flow control ? (I ended up using the UART example withtout using the flow control and I didn&amp;#39;t get any transmissions errors)[/quote]
&lt;p&gt;I won&amp;#39;t say libuarte is more accurate, but it is more flexible if you have a UART application where you are receiving data at random times, and where you don&amp;#39;t know how much data you will receive ahead of time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;With the older UART driver you have to wait until the RX buffer fills up before you receive any data, which can take a lot of time if you have a large buffer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;With the libuarte driver you can define a timeout period, and if no more data is received for this long you will get whatever data is currently in the buffer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Use libuarte example with GPIO</title><link>https://devzone.nordicsemi.com/thread/265342?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2020 13:26:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:775ac290-779b-4abc-b7a3-c547fd90bc32</guid><dc:creator>roduss</dc:creator><description>&lt;p&gt;Hellooo,&lt;br /&gt;I tried your solution, copied a brand new example, changed my libuarte config, connected it to the Arduino and it finally worked ! &lt;br /&gt;It was that simple finally .... &lt;br /&gt;I still had some transmission issues with baudrate at 115200 and 38400, it works really good at 9600, but I think it might more be an echo problem from the Arduino and the AltSoftSerial/SoftwareSerial libraries, so my issue is solved !&lt;br /&gt;&lt;br /&gt;Do you confirm that you have perfect transmission using 2 nRF kits at 115200 bps ?&lt;/p&gt;
&lt;p&gt;One last thing I would like to be sure about, is libuarte&amp;nbsp; supposed to be more accurate than the UART example without Flow control ? (I ended up using the UART example withtout using the flow control and I didn&amp;#39;t get any transmissions errors)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Use libuarte example with GPIO</title><link>https://devzone.nordicsemi.com/thread/265212?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2020 06:11:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5eb0d45c-45ce-45b2-84c3-a45ce5cacbfb</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;No problem, just let me know when you have more questions &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Use libuarte example with GPIO</title><link>https://devzone.nordicsemi.com/thread/265041?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2020 09:27:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa80a02d-2ee4-448d-8288-e580031a97ff</guid><dc:creator>roduss</dc:creator><description>&lt;p&gt;Hi, &lt;br /&gt;Thanks a lot for your answer, I&amp;#39;ll have a look at it this week and tell you more about it soon, but it sounds good !&lt;br /&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Use libuarte example with GPIO</title><link>https://devzone.nordicsemi.com/thread/264612?ContentTypeID=1</link><pubDate>Fri, 14 Aug 2020 12:07:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5093dc79-9d45-4daa-9962-f29919b5e348</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There is no need to manually call the nrf_gpio_cfg_xxx functions when using libuarte. When you enable the UART the pin configuration will be overridden by the UART module.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I was able to move the TX and RX to pin 11 and 12 simply by changing the .tx_pin and .rx_pin defines in the libuarte config struct.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I tested it just to be sure, by connecting pin 11 and 12 on one kit to pin 6 and 8 on another kit (in order to connect these pins to a PC through the Segger chip on the second kit).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-2693c9556d2c4511b9c79f43f1a18c8b/IMG_5F00_20200814_5F00_140154.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Are you still having issues with it?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Use libuarte example with GPIO</title><link>https://devzone.nordicsemi.com/thread/264296?ContentTypeID=1</link><pubDate>Wed, 12 Aug 2020 13:57:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:323b4c4f-d5aa-4bad-9d21-70bd88bc6e49</guid><dc:creator>roduss</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Ooops my bad ! So I changed my wiring to send 3.3V to the nRF DK, but still, I don&amp;#39;t get the fundamentals ...&lt;br /&gt;&lt;strong&gt;How should I wire my RX/TX with the DK to see data from Arduino ?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;As you said, pin 6 and 8 are used, so&amp;nbsp;I tried to use pin 11 &amp;amp; 12 (TX and RX), initialize them like this :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define TX_PIN 11 
#define RX_PIN 12

void gpio_init(void)
{
  nrf_gpio_cfg_input(RX_PIN, NRF_GPIO_PIN_NOPULL);
  nrf_gpio_cfg_output(TX_PIN);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And used them in the libuarte config function&amp;nbsp; :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrf_libuarte_async_config_t nrf_libuarte_async_config = {
            .tx_pin     = TX_PIN,
            .rx_pin     = RX_PIN,
            .baudrate   = NRF_UARTE_BAUDRATE_115200,
            .parity     = NRF_UARTE_PARITY_EXCLUDED,
            .hwfc       = NRF_UARTE_HWFC_DISABLED,
            .timeout_us = 100,
            .int_prio   = APP_IRQ_PRIORITY_LOW
    };
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But didn&amp;#39;t&amp;nbsp;read nothing ...&lt;br /&gt;What am I missing ? Should I use another example ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Use libuarte example with GPIO</title><link>https://devzone.nordicsemi.com/thread/264215?ContentTypeID=1</link><pubDate>Wed, 12 Aug 2020 09:57:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:955948c8-67d3-4546-9857-9149f45ed87d</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If your Arduino board is running at 5V it won&amp;#39;t be compatible with the nRF52DK, which typically runs at ~3V.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You would need some kind of level shifter on the UART signals: Either&amp;nbsp;by using a dedicated level shifter IC, or making something more simple based on the fact that the signals are one directional (a 5V to 3V level shifter might be implemented by a simple voltage divider, while 3V to 5V could be implemented with some transistors).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Use libuarte example with GPIO</title><link>https://devzone.nordicsemi.com/thread/264029?ContentTypeID=1</link><pubDate>Tue, 11 Aug 2020 11:49:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcdae3fd-d632-4cec-a71d-90ff1cdeeb73</guid><dc:creator>roduss</dc:creator><description>&lt;p&gt;Good afternoon,&lt;br /&gt;Thanks for your quick answer ! &lt;br /&gt;If I use the DK alone, I get the echo via puTTY, this is working.&lt;br /&gt;What I want is to send a signal using UART protocol with my Arduino (5V) and receive it with the DK. (And when I receive data, print it to puTTY or make a LED blinking)&lt;br /&gt;The Arduino can send a start bit/ a stop bit or even Flow Control if necessary.&lt;br /&gt;&lt;br /&gt;So, when you&amp;#39;re saying &lt;br /&gt;&lt;em&gt; UART is that pins 6 and 8 already have a connection to the programming chip on the DK, which is how it gets connected to the virtual J-Link comport&lt;br /&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Is this related to&lt;em&gt; &lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1597145996908v1.png" alt=" " /&gt; ? &lt;br /&gt;&lt;br /&gt;&lt;/em&gt;So, a solution to make the libuarte example work could be : &lt;/p&gt;
&lt;ul&gt;
&lt;li style="padding-left:30px;"&gt;Connect the Tx of the Arduino to a random pin of the DK (let&amp;#39;s say pin 20 will be RX)&lt;/li&gt;
&lt;li style="padding-left:30px;"&gt;Connect the Rx of the Arduino to another pin of the DK (pin 21 will be TX)&lt;/li&gt;
&lt;li style="padding-left:30px;"&gt;Change anything of this function (or the definition of the RX/TX pins picture above) to initialize pin 20 and 21 as RX and TX? (function is from main.c)&lt;br /&gt;&lt;img height="128" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1597146212360v2.png" width="391" alt=" " /&gt;&lt;/li&gt;
&lt;li style="padding-left:30px;"&gt;Change anything to see the data being echoed in puTTY when received ? &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks a lot for your help !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Use libuarte example with GPIO</title><link>https://devzone.nordicsemi.com/thread/264019?ContentTypeID=1</link><pubDate>Tue, 11 Aug 2020 11:32:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d40c9af3-aa4b-43cf-9355-3ff583159489</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Roduss&lt;/p&gt;
&lt;p&gt;The example should work fine as long as the UART signals are routed correctly, and the voltage levels are compatible.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you saying you don&amp;#39;t even get the echoing to work even when using the DK alone, without connecting any external boards?&lt;/p&gt;
&lt;p&gt;One thing to keep in mind when connecting an external UART is that pins 6 and 8 already have a connection to the programming chip on the DK, which is how it gets connected to the virtual J-Link comport. When connecting to an external board you might have to change to some other pins, or break the SB22, SB23, SB24 and SB25 solder bridges to break the connection between the programming chip and the nRF52832.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>