本帖最后由 马文 于 2021-11-28 08:50 编辑
#申请原创#
开箱终于拿到板子了,先来个简简单单的开箱,拆开快递包装后,就一个小小的 MicroChip 色 的小盒子,盒子里面有 2 个分别装着 ATtiny1627 Curiosity Nano 和 排针的静电带,如下: 拆开袋子如下:
关于开发板该板子的信息、资源可以在官网找到:https://www.microchip.com/en-us/development-tool/DM080104 可以下载的资料如下: 根据描述,主要有 2 部分,如下图: 左边部分是带 Micro USB 接口的 On-board debugger,右边是引出了 IO、有一个 LED、一个按键的 ATtiny1627 部分。
On-board debugger 的功能对于 On-board debugger,文档 ATtiny1627-Curiosity-Nano-HW-UserGuide-DS40002199A.pdf 有详细的说明:
上面描述 On-board debugger 是一个有多个接口的 usb 复合设备,这些接口分别是: On-board debugger 连上电脑生成的设备来实际看下这个 On-board debugger,用根 Micro USB 线把这板子连接上电脑,电脑右下角弹出如下内容:
然后变成了:
现在来找下上面提到的 4 个功能,首先看下大容量设备,也就是 U 盘,这个最容易看了,只要打开我的电脑就可以看到,在我的电脑上显示如下:
进入该 U 盘目录为:
把 ATtiny1627 的固件拷贝到该目录就可以对板子上的 ATtiny1627 进行烧录了, 然后打开电脑的设备管理器,可以找到 虚拟串口 跟 GDI ,如下: 到现在,还差一个,调试器没找到,看了下设备管理器,也没有异常设备,可以断定驱动应该是没问题,那就应该可以正常使用,
On-board debugger 的详细信息为了一探究竟,我使用 USB device viewer 来看下这个 USB 设备,先看下设备描述符: ===>Device Descriptor<===
bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0200
bDeviceClass: 0xEF -> This is a Multi-interface Function Code Device
bDeviceSubClass: 0x02 -> This is the Common Class Sub Class
bDeviceProtocol: 0x01 -> This is the Interface Association Descriptor protocol
bMaxPacketSize0: 0x40 = (64) Bytes
idVendor: 0x03EB = Atmel Corporation
idProduct: 0x2175
bcdDevice: 0x0100
iManufacturer: 0x01
English (United States) "Microchip Technology Incorporated"
iProduct: 0x02
English (United States) "nEDBG CMSIS-DAP"
iSerialNumber: 0x03
English (United States) "MCHP3258021800000744"
bNumConfigurations: 0x01
上面可以看到这个设备是多接口设备,PID、VID 分别为:0x2175、0x03EB。 然后根据上面找到设备的顺序,分别看下对应的接口描述符,首先是 mass storage : ===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x04
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x08 -> This is a Mass Storage USB Device Interface Class
bInterfaceSubClass: 0x06
bInterfaceProtocol: 0x50
iInterface: 0x06
English (United States) "Curiosity Virtual Storage"
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x85 -> Direction: IN - EndpointID: 5
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x05 -> Direction: OUT - EndpointID: 5
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
可以看到这是一个 InterfaceClass 为 Mass Storage USB Device Interface,使用了 2 个 Bulk 传输端点,一个用作输入、一个用作输出, 然后是 CDC 设备: ===>IAD Descriptor<===
bLength: 0x08
bDescriptorType: 0x0B
bFirstInterface: 0x01
bInterfaceCount: 0x02
bFunctionClass: 0x02 -> This is Communications (CDC Control) USB Device Interface Class
bFunctionSubClass: 0x02
bFunctionProtocol: 0x01
iFunction: 0x05
English (United States) "Curiosity Virtual COM Port"
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x02 -> This is Communications (CDC Control) USB Device Interface Class
bInterfaceSubClass: 0x02
bInterfaceProtocol: 0x01
CAUTION: This may be an invalid bInterfaceProtocol
iInterface: 0x00
-> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05 24 00 10 01
-> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<===
bLength: 0x04
bDescriptorType: 0x24
04 24 02 02
-> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05 24 06 01 02
-> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<===
bLength: 0x05
bDescriptorType: 0x24
05 24 01 03 02
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x84 -> Direction: IN - EndpointID: 4
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x10
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x02
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x0A -> This is a CDC Data USB Device Interface Class
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
CAUTION: This may be an invalid bInterfaceProtocol
iInterface: 0x00
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x83 -> Direction: IN - EndpointID: 3
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x03 -> Direction: OUT - EndpointID: 3
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
CDC 设备使用了 2 个 Interface, 3 个端点,一个 中断传输、2个 bulk 传输, 然后是GDI(Data Gateway Interface) 设备:
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x03
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0xFF -> Vendor Specific Device
bInterfaceSubClass: 0xFF
*!*CAUTION: This appears to be an invalid bInterfaceSubClass
bInterfaceProtocol: 0xFF
*!*WARNING: must be set to PC_PROTOCOL_UNDEFINED 0 for this class
iInterface: 0x07
English (United States) "Curiosity Data Gateway Interface"
*!*CAUTION: 0xFF is a prerelease Class ID
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x86 -> Direction: IN - EndpointID: 6
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0xFF
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x06 -> Direction: OUT - EndpointID: 6
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0xFF
从上面的描述符得知,该接口为自定义设备,使用了 2个 bulk 传输, 然后就剩下一个 interface 了,描述符如下:
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x03 -> HID Interface Class
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
CAUTION: This may be an invalid bInterfaceProtocol
iInterface: 0x00
===>HID Descriptor<===
bLength: 0x09
bDescriptorType: 0x21
bcdHID: 0x0111
bCountryCode: 0x00
bNumDescriptors: 0x01
bDescriptorType: 0x22
wDescriptorLength: 0x0023
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x81 -> Direction: IN - EndpointID: 1
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x01
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x02 -> Direction: OUT - EndpointID: 2
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x01
这是一个 HID Interface ,这个应该就是 debuger 了,使用了 2 个中断传输,然后我在设备管理其中根据 PID、VID 找到了对应的设备: 至于为什么有 2 个,由于技术不到家,还不知道为什么,就不班门弄斧,免得误人子弟
实际体验
接下来分别使用下这些功能,在 microchip studio 中使用 ATmel Start Project 创建一个 串口数据数据的简单的工程,使用 uart0,波特率设置为 9600,如下: main 文件为: #include <atmel_start.h>
#include "stdio.h"
int main(void)
{
/* Initializes MCU, drivers and middleware */
atmel_start_init();
/* Replace with your application code */
while (1) {
printf("Hello ATtiny1627\r\n");
}
}
试了下在 Microchip studio 中调试,也试了下使用 Microchip studio 下载固件,都可以用起来,首先要在工程中把调试器选择了:
下图是调试:
下图是下载:
试了下 drag-and-drop 功能,也成功用起来,把 main 函数修改为: int main(void)
{
/* Initializes MCU, drivers and middleware */
atmel_start_init();
/* Replace with your application code */
while (1) {
printf("drag-and-drop\r\n");
}
}
编译,把生成的固件放入 ATtiny1627 Curiosity Nano 所对应的磁盘,ATtiny1627 能够成功跑起来,如下:
对于 Data Gateway Interface,根据文档 ATtiny1627-Curiosity-Nano-HW-UserGuide-DS40002199A.pdf,需要配合 MPLAB Data Visualizer 来使用,我尝试了下载,网速太慢了,目前还没下载下来,就先不体验了,
关于 On-board debugger 的名字刚把该板子插入电脑的时候,看到 正在设置 nEDBG CMSIS-DAP,对使用 arm M 内核单片机的人来说应该很熟悉 CMSIS-DAP,我很纳闷,为什么一块 AVR 单片机的调试器为什么会有个这样的名字,后来想了下 MicroChip 也有 arm M 内核单片机,也许这个 On-board debugger 也可以用来调试 arm M内核单片机,我在文档 ATtiny1627-Curiosity-Nano-HW-UserGuide-DS40002199A.pdf 找到了 SWD 接口的定义,也找了一块 arm M 内核单片机接上试了下,在 keil 里面可以连接到 MCU,也可以下载:
参考ATtiny1627-Curiosity-Nano-HW-UserGuide-DS40002199A.pdf :https://ww1.microchip.com/downloads/en/DeviceDoc/ATtiny1627-Curiosity-Nano-HW-UserGuide-DS40002199A.pdf
|