使用 UART 从 Raspberry Pi 编程 Arduino

Posted

技术标签:

【中文标题】使用 UART 从 Raspberry Pi 编程 Arduino【英文标题】:Program an Arduino from a Raspberry Pi using UART 【发布时间】:2014-03-21 23:42:55 【问题描述】:

我正在尝试使用 Raspberry Pi 对安装在面包板上的 Arduino 进行编程。 对于 Arduino 的设置,我一直遵循 this 教程,除了 USB 串行设备。相反,我通过电平转换器连接了 Raspberry Pi。我自己设计了电平转换器,使用 4066 模拟开关和运算放大器作为电压跟随器,以提供稳定的 3.3V 电压。来自 Pi 的 3.3V 在 Arduino 引脚上转换为 5V,反之亦然。在 shell 中或通过 Pi 上的 Arduino IDE 运行 avrdude 时,我没有得到任何响应。

Pi 和 Arduino 都将其 TX 引脚驱动到高值(3.3V 和 5V)。 Arduino 已在 stk500 开发板上使用引导加载程序进行闪存。我一直在运行的命令是:

/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega8 -carduino -P/dev/ttyAMA0 -b9600 -D -Uflash:w:/tmp/build4533291593992176675.tmp/sketch_mar21a.cpp.hex:i 

连接到 pin13 的 LED 大约每 6 秒闪烁一次。

谁能告诉我如何让 Raspberry Pi 与 Arduino 对话?

【问题讨论】:

为什么不在 3.3V 下运行 Arduino? 【参考方案1】:

相当难过。我要尝试的第一件事就是检查 RX/TX 通信是否正常。编写一个简单的程序在 arduino 引脚 2 和 3 上读写,以及在 PI 上类似的东西。

其他要查看的内容http://arduino.cc/en/Main/StandaloneAssembly。您也许可以使用 AVR 执行操作,请参阅 http://arduino.cc/en/Hacking/Programmer。

有一个新的 arduino 堆栈交换 https://arduino.stackexchange.com/ 可能值得在那里询问。

【讨论】:

以上是关于使用 UART 从 Raspberry Pi 编程 Arduino的主要内容,如果未能解决你的问题,请参考以下文章

无法使用 Raspberry Pi 3 在 Windows IoT 上打开 UART 端口

Pymodbus - 在 raspberry pi3 的 uart 上通过 rs485 读取电能表的输入寄存器

Raspberry Pi UART 程序在 C 中使用 termios 接收垃圾(Rx 和 Tx 直接连接)

如何为 Raspberry Pi 编写简单的 UART Linux 设备驱动程序?

Android事物:在Raspberry PI 3上通过USB UART接收数据时出现NullPointerException

Android Things:在 Raspberry PI 3 上通过 USB UART 接收数据时出现 NullPointerException