上传的Arduino code通过Arduino的IDE虚拟串口 [英] Upload Arduino code on virtual serial port through Arduino IDE

查看:204
本文介绍了上传的Arduino code通过Arduino的IDE虚拟串口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了几个软件,提供虚拟COM端口。这些COM端口会出现在设备管理器并可以从Arduino的IDE,菜单中选择要上传工具 - >串行端口 - > COM3。它开始上传,并达到90%,然后,要么超时或只是什么都不做。

I downloaded several software that provide virtual COM ports. These COM ports do appear in the Device Manager and can be selected for upload from the Arduino IDE, menu Tools -> Serial Port -> COM3. It starts uploading and reaches 90% and then it either times out or just does nothing.

我要上传到虚拟COM端口,所以我可以再在另一个程序读取编译输出文件。我不希望在所有使用Arduino的我,我不想让手动上传时的详细输出文件。当我真正的Arduino上传此问题不会发生。

I want to upload onto the virtual COM port so I could then read the compilation output files in another program. I don't want to use my Arduino at all, and I don't want to manually get the verbose output files when uploading. This problem doesn't happen when I upload on the real Arduino.

应用程序应该在所有平台上运行。这个任务似乎很容易在Linux上,而我对着在Windows上规定的问题,并与Mac任何帮助,也将是有益的。

The application should work on all platforms. This task seems easy on Linux, and I am facing the stated problem on Windows and any help with Mac would also be useful.

该应用程序将是硬件仿真和可视化试图给用户比其他仿真那里更亲身体验的教育工具。所以,可能是这会给你的,为什么我想这样做的想法。

The application will be an educational tool for hardware simulation and visualization trying to give a more hands-on experience for users than other simulators out there. So may be this will give you an idea of why I want to do so.

我如何开始?

推荐答案

我想你可能会假设上传code到Arduino是单向通信:这就像把草莓搅拌机,和< A HREF =htt​​p://en.wikipedia.org/wiki/Daiquiri相对=nofollow> Daquiri 出来。如果这是真的,你可以只采取任何的IDE转储到串口,将它保存到一个文件,你有一个Arduino二进制文件。 (跳转到 TL; DR :如果不感兴趣的细节结果:这种假设是不正确的)。

I think you might be assuming that uploading code to Arduino is one-way communications: this would be like putting strawberries in a blender, and a Daquiri comes out. If that was true, you could just take whatever the IDE dumps to the serial port, save it to a file, and you have an Arduino binary. (Skip to TL;DR if not interested in details. Upshot: this assumption is not correct).

1-双向通信的假设是不完全正确的:上有一个Arduino的程序(称为的引导程序),这是负责与程序员(通信程序员:一个程序,程序的Arduino,假设它是Arduino的IDE现在)。在自己最自然的状态,Arduino的处理器不能在多个串行线路编程。而这些芯片进行编程或者通过在系统编程(ISP)或通过上的 JTAG 协议。引导装载程序是,草图/节目通过串行端口一个Arduino CPU和装载上运行的程序。这个程序在启动时运行,并查找通过串口编程命令。

The 1-way communication assumption is not entirely correct: there is a program on the Arduino (called "a bootloader") which is responsible for communicating with the programmer ("programmer": a program that programs the Arduino, assume it is the Arduino IDE for now). In their most "natural" state, the Arduino CPUs cannot be programmed across serial lines. Rather these chips are programmed either via the in system programming (ISP) or via the JTAG protocol. The bootloader is a program that runs on an Arduino CPU and loading of sketches/programs over the serial port. This program runs at startup and looks for programming commands over the serial port.

如果它发现一个程序员试图传达编程信息,它会读取已编译的Arduino二进制过来的串行链路,将其存储在闪存中,将其发送回通过串行连接进行验证,如果一切是成功,退出并启动存储的草图。如果串口上出现任何编程的信息,即没有程序员试图写一个新的草图,然后引导程序简单地退出,并且已经启动闪存中存储的程序。

If it discovers that a programmer is trying to communicate programming information, it will read the compiled Arduino binary coming over the serial link, store it in flash memory, send it back to over the serial link for verification, and if everything is successful, exit and launch the stored sketch. If no programming information appears on the serial port, that is, no programmer is trying to write a new sketch, then the bootloader simply quits and launches the program already stored in flash.

TL; DR :为了实现你的串口上有伪的Arduino,你必须写一个程序,一些code,它在虚拟的另一端模拟一个Arduino(引导程序)串行端口。所以,当一个程序员/ IDE说要Arduino的你在吗?你的程序会回答是!,就像将一个Arduino。

TL;DR: In order to implement a pseudo-Arduino on your serial port you must write a program some code that simulates an Arduino (bootloader) on the other end of your virtual serial port. So when a programmer/IDE says to Arduino "are you there?" your program will respond "yes!", just like an Arduino would.

默认Arduino的引导程序是 STK-500兼容:这意味着它实现了STK-500指令 - 为其基准可以发现 rel=\"nofollow\">。如果你决定这样做,那么最简单的事情可能与现有的引导程序来启动,如的的Arduino 的或 Adafruit的的(有别人太),并对其进行修改。这样一个引导程序将拥有所有已经实施的命令,因为它是用C写的(我不会选择装配引导程序修改:),它应该是很容易修改。

The default Arduino bootloader is STK-500 compatible: that means that it implements STK-500 commands - the reference for which can be found here. If you decide to do this, then the easiest thing might be to start with an existing bootloader, such as Arduino's or AdaFruit's (there are others too), and modify it. Such a bootloader would have all the commands already implemented, and since it is written in C (I wouldn't choose an assembly bootloader to modify :), it should be easy enough to modify.

另外,你可能决定STK-500是太难实现。如果是这样的话,你可以使用任何编程协议 AVRDUDE 支持:AVRDUDE是用于编程AVR芯片的程序,以及Arduino的IDE使用AVRDUDE内部草图发送到Arduino。如果你这样做,那么你就必须改变这些程序员,你正在使用的Arduino IDE中的设置。

Alternatively, you might decide that STK-500 is too difficult to implement. If this is the case, you can use any programmer protocol that Avrdude supports: Avrdude is a program for programming AVR chips, and Arduino IDE uses Avrdude internally to send the sketch to the Arduino. If you do this, then you'd have to change the settings in Arduino IDE for which programmer you are using.

我个人认为,STK-500兼容是我们的最佳选择,但因人而异

Personally, I think STK-500 compatible is the best option for this, but YMMV.

这篇关于上传的Arduino code通过Arduino的IDE虚拟串口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆