c++ - Atmel 微芯片 CDC 的标准 COM 端口命令

标签 c++ arduino device-driver cdc atmel

我正在尝试使用 AT90USB162 Atmel 芯片作为通信设备类 (CDC),用于将某些外部传感器与某些 Windows 应用程序进行通信。

Atmel Application Notes site for this chip我找到了应用说明 AVR296: AVRUSBRF01 USB RF Dongle user's guide ,它描述了一种将此芯片用作 CDC 的方法(用于 RF 目的,但这不是此处的关注点)。本应用笔记附带压缩文件 AVR296.zip其中包含用于烧录芯片的.a90文件和用作Windows驱动程序的.inf文件。

因此,我使用提供的 AVRUSBRF01-AT90USB162-usbdevice_cdc_rf-2_0_1.a90 文件烧录了我的芯片,并在我的 Windows 上安装了 at90usbxxx_cdc.inf 驱动程序。终于Windows成功识别了COM口,现在我正在尝试通过CDC机制与芯片通信。

那么,Atmel 的微芯片作为 CDC 是否有标准的命令列表?

我想做的是像在 Windows 中的 C++ 中一样,用于访问通过 USB 连接的微芯片以读取特定引脚状态的常驻应用程序,例如:

ComPort1->WriteStr("read?\n");
Response : String;
ComPort1->ReadStr(Response, 50);

最佳答案

因为没有人回答,我也在其他论坛问过,并将回复贴在这里,以求SO社区的知识。

起初,答案是否定的。然而……

来自 avrfreaks ,感谢@glitch:

The cdc code is only half the AVR equation. All the cdc code does is emulate a cdc device, so your pc code can interact with the device as if it was connected via a serial port. You now need to write your own code,on the AVR, that links with the cdc code, that implements whatever protocol you want, and whatever functionality you want. The cdc code does none of this. [you also need to write the pc side. alternatively you can use a standard terminal app, if the protocol you implement is ascii based]

感谢@dakk64:

Here is an example of a menu driven interface, implemented as a protothread but you could just put it in your main loop.

由于有 874 个 LOC,我不会在这里发布整个代码,但您可以去那里看看。

所以它不是那么简单,没有默认列表(例如,旧的 AT 调制解调器代码),但知道这是一个开始。

关于c++ - Atmel 微芯片 CDC 的标准 COM 端口命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8196072/

相关文章:

c++ - 在开源应用程序中检索数据

Arduino 和 Bitwise,意外的结果

php - 如何在 C++ 中加密数据并在 PHP 中解密?

linux - 删除设备文件的回调

android - 手机中的zigbee硬件

c++ - 最小成本总和

c++ - 编译错误 : Undeclared member that is actually declared

C++单例初始化顺序

c++ - 指向其他结构数组元素的新手 C/C++ 结构数组

android - Linux驱动和安卓驱动有什么区别