<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[UART on Lopy not recognizing non-default pins]]></title><description><![CDATA[<p dir="auto">I'm trying to setup a LoPy 1.0 with expansion board 2.0 to read GPS data and write that data to an SD card. In the process of debugging the system I noticed that the SD and Uart1 share the use of pin G11/P4. I figured the best option would be to redefine the UART pins in order to be able to use both the UART and SD card at the same time.</p>
<p dir="auto">My problem is that when I change the pins to something like P20 and P21 (like in the example) the board will not recognize input and instead continues to only accept data on the G11/P4 pin. Below is some test code that I wrote to try to figure this out. Any help would be greatly appreciated.</p>
<pre><code>from machine import UART, Pin
from micropyGPS import MicropyGPS
import time

uart = UART(1,9600, pins = ('P21','P22'))
uart.init(9600,bits = 8, parity = None, stop = 1)

while(True):
    if(uart.any()):
        a = uart.read(100)
        print(a)
    else:
        print(&quot;No data&quot;)
</code></pre>
]]></description><link>https://forum.pycom.io/topic/3775/uart-on-lopy-not-recognizing-non-default-pins</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 11:07:47 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/3775.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Sep 2018 21:11:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to UART on Lopy not recognizing non-default pins on Fri, 21 Sep 2018 21:11:20 GMT]]></title><description><![CDATA[<p dir="auto">I'm trying to setup a LoPy 1.0 with expansion board 2.0 to read GPS data and write that data to an SD card. In the process of debugging the system I noticed that the SD and Uart1 share the use of pin G11/P4. I figured the best option would be to redefine the UART pins in order to be able to use both the UART and SD card at the same time.</p>
<p dir="auto">My problem is that when I change the pins to something like P20 and P21 (like in the example) the board will not recognize input and instead continues to only accept data on the G11/P4 pin. Below is some test code that I wrote to try to figure this out. Any help would be greatly appreciated.</p>
<pre><code>from machine import UART, Pin
from micropyGPS import MicropyGPS
import time

uart = UART(1,9600, pins = ('P21','P22'))
uart.init(9600,bits = 8, parity = None, stop = 1)

while(True):
    if(uart.any()):
        a = uart.read(100)
        print(a)
    else:
        print(&quot;No data&quot;)
</code></pre>
]]></description><link>https://forum.pycom.io/post/22374</link><guid isPermaLink="true">https://forum.pycom.io/post/22374</guid><dc:creator><![CDATA[Paloma]]></dc:creator><pubDate>Fri, 21 Sep 2018 21:11:20 GMT</pubDate></item><item><title><![CDATA[Reply to UART on Lopy not recognizing non-default pins on Sat, 22 Sep 2018 10:39:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3265">@paloma</a><br />
Hello i have fall in same trap than you (but with i2c pin)</p>
<blockquote>
<p dir="auto">uart = UART(1,9600, pins = ('P21','P22'))</p>
</blockquote>
<p dir="auto">You set P21 and P22 as TX/RX, but please notice that when you call</p>
<blockquote>
<p dir="auto">uart.init(9600,bits = 8, parity = None, stop = 1)</p>
</blockquote>
<p dir="auto">This function have again internaly default value for RX/TX pin according to pycom documentation -&gt; <em><strong>uart.init(baudrate=9600, bits=8, parity=None, stop=1, * , timeout_chars=2, pins=(TXD, RXD, RTS, CTS))</strong></em></p>
<p dir="auto">So i strongly think that if you change your function call  by</p>
<p dir="auto">uart.init(baudrate=9600, bits=8, parity=None, stop=1, pins=('P21', 'P22'))</p>
<p dir="auto">it will work as you want</p>
]]></description><link>https://forum.pycom.io/post/22376</link><guid isPermaLink="true">https://forum.pycom.io/post/22376</guid><dc:creator><![CDATA[Eric73]]></dc:creator><pubDate>Sat, 22 Sep 2018 10:39:00 GMT</pubDate></item><item><title><![CDATA[Reply to UART on Lopy not recognizing non-default pins on Mon, 24 Sep 2018 16:25:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/2686">@eric73</a> This seems to have solved my problem! Thanks!</p>
]]></description><link>https://forum.pycom.io/post/22395</link><guid isPermaLink="true">https://forum.pycom.io/post/22395</guid><dc:creator><![CDATA[Paloma]]></dc:creator><pubDate>Mon, 24 Sep 2018 16:25:27 GMT</pubDate></item></channel></rss>