【Follow me第二季第4期】Arduino Nano RP2040 Connect之UART总线
<p data-spm-anchor-id="0.0.0.i0.112b793dKmIvY5">本期活动发放的开发板是Arduino Nano RP2040 Connect,这块主板上的主芯片是树莓派的RP2040。</p><p><strong>RP2040是支持两路UART的。</strong></p>
<p>Arduino Nano RP2040 Connect主板的pinout图中有标注一路TX、RX:</p>
<p> </p>
<p>另外参考RP2040 GPIO功能图:</p>
<p> </p>
<p>可知这一路硬件连线实际使用的是RP2040的UART0,但是在Arduino IDE中如果想使用这一路硬件的话,需要使用对应的代码对象Serial1。</p>
<p>Arduino Nano RP2040 Connect的USB是支持CDC类型,可以直接使用Arduino IDE的Serial来控制。</p>
<p>所以我猜测了两种UART的实现接口,不知道Arduino在封装时实际是哪一种:</p>
<table style="border-collapse:collapse" width="586">
<colgroup>
<col width="72" />
<colwidth="182" />
<colwidth="165" />
<colwidth="72" />
<colwidth="95" />
</colgroup>
<tbody>
<tr>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:1px solid black; border-right:1px solid black; border-left:1px solid black"><strong>硬件</strong></td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:1px solid black; border-right:1px solid black; border-left:none"><strong>Arduino IDE初始化代码</strong></td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:1px solid black; border-right:1px solid black; border-left:none"><strong>RP2040 UART控制器</strong></td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:1px solid black; border-right:1px solid black; border-left:none"> </td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:1px solid black; border-right:1px solid black; border-left:none"> </td>
</tr>
<tr>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">JP3.1</td>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">Serial1.begin(115200);</td>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">UART0</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">TX</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">GPIO0</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">JP3.2</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">RX</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">GPIO1</td>
</tr>
<tr>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">USB CDC</td>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">Serial.begin(115200);</td>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">UART1</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">TX</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">endpoint</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">RX</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">endpoint</td>
</tr>
<tr>
<td colspan="5" style="border-bottom: 1px solid black; vertical-align: middle; white-space: nowrap; border-top: 1px solid black; border-right: none; border-left: none; text-align: center;">或者</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black"><strong>硬件</strong></td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none"><strong>Arduino IDE初始化代码</strong></td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none"><strong>RP2040 UART控制器</strong></td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none"> </td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none"> </td>
</tr>
<tr>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">JP3.1</td>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">Serial1.begin(115200);</td>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">UART0</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">TX</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">GPIO0</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">JP3.2</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">RX</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">GPIO1</td>
</tr>
<tr>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">USB CDC</td>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">Serial.begin(115200);</td>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">?</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">TX</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">endpoint</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">RX</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">endpoint</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">?</td>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">?</td>
<td rowspan="2" style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">UART1</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">TX</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">?</td>
</tr>
<tr>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:1px solid black">?</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">RX</td>
<td style="border-bottom:1px solid black; vertical-align:middle; white-space:nowrap; border-top:none; border-right:1px solid black; border-left:none">?</td>
</tr>
</tbody>
</table>
<p>我在任务一种同时使用了USB和杜邦线连接的UART,实际demo可参考<a href="https://bbs.eeworld.com.cn/thread-1300207-1-1.html">【Follow me第二季第4期】任务一 Blink三色LED / 串口打印 - DigiKey得捷技术专区 - 电子工程世界-论坛</a></p>
<p> </p>
<p>疑问:实际还可以从硬件引脚引出UART1吗?</p>
<div style="position: fixed; opacity: 1; height: 300px; width: 100%; font-size: 25px; text-align: center; bottom: 200px; left: 0px; display: none; flex-direction: column; justify-content: center; z-index: 1661789940; top: calc(50% + 0px);"> </div>
页:
[1]