<?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[M5StamPLC and Serial1]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">my RS485-reader on a M5StamPLC worked fine with the standard Arduino Libraries on Serial1. If I use M5StamPLC-Library like #include &lt;M5StamPLC.h&gt; and if I use the M5StamPLC.begin(); then Serial1 didn‘t work anymore.</p>
<pre><code>void setup() {
   M5StamPLC.begin(); &lt;— Didn‘t work. Serial1.available never find an input
   Serial1.begin(38400, SERIAL_8N1, RX_PIN, TX_PIN);
}

void loop() {
   while (Serial1. available) {
       char incomingByte = Serial1.read();
       …
   }
}
</code></pre>
<p dir="auto">I can‘t find the init-calls for RS485 in M5StamPLC   and not in M5Unified.</p>
<p dir="auto">Who can help?</p>
]]></description><link>https://community.m5stack.com/topic/7638/m5stamplc-and-serial1</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 22:01:21 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7638.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Jun 2025 18:42:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5StamPLC and Serial1 on Wed, 25 Jun 2025 01:15:55 GMT]]></title><description><![CDATA[<p dir="auto">The issue you're experiencing with the M5StamPLC.begin() function interfering with Serial1 is likely due to the library initializing or reconfiguring the hardware UART pins used by Serial1. Here's how you can resolve it:<br />
Solution:</p>
<p dir="auto">Check Pin Mapping:</p>
<p dir="auto">Ensure that the pins you're using for Serial1 (RX_PIN and TX_PIN) are not being reconfigured by the M5StamPLC.begin() function. The M5StamPLC library might initialize its own UART or other peripherals on the same pins.</p>
<p dir="auto">Explicitly Reinitialize Serial1 After M5StamPLC.begin():</p>
<p dir="auto">Call Serial1.begin() again after M5StamPLC.begin() to ensure the UART settings are restored:void setup() {<br />
M5StamPLC.begin();<br />
Serial1.begin(38400, SERIAL_8N1, RX_PIN, TX_PIN);<br />
}</p>
<p dir="auto">Use Alternative UART Pins:</p>
<p dir="auto">If the issue persists, try using a different UART (e.g., Serial2) if your hardware supports it. For example:Serial2.begin(38400, SERIAL_8N1, RX_PIN_2, TX_PIN_2);</p>
<p dir="auto">Review M5StamPLC Library Documentation:</p>
<p dir="auto">The M5StamPLC library might have specific requirements or conflicts with certain pins. Refer to the official documentation for details.</p>
<p dir="auto">Debugging:</p>
<p dir="auto">Add debug prints to verify if Serial1 is being initialized correctly:void setup() {<br />
Serial.begin(115200); // For debugging<br />
M5StamPLC.begin();<br />
Serial1.begin(38400, SERIAL_8N1, RX_PIN, TX_PIN);<br />
Serial.println("Serial1 initialized");<br />
}</p>
<p dir="auto">Additional Notes:</p>
<p dir="auto">If the problem is related to the M5StamPLC library's internal UART configuration, you may need to modify the library or contact M5Stack support (<a href="mailto:support@m5stack.com" target="_blank" rel="noopener noreferrer nofollow ugc">support@m5stack.com</a>) for further assistance.</p>
<p dir="auto"><a href="https://chat.m5stack.com/" target="_blank" rel="noopener noreferrer nofollow ugc">https://chat.m5stack.com/</a></p>
]]></description><link>https://community.m5stack.com/post/29327</link><guid isPermaLink="true">https://community.m5stack.com/post/29327</guid><dc:creator><![CDATA[yuyun2000]]></dc:creator><pubDate>Wed, 25 Jun 2025 01:15:55 GMT</pubDate></item></channel></rss>