STC8H8K64U 的 USB 功能测试(未成功)
对 STC8H8K64U 的 USB 功能测试, 因为存在很多问题并且未能解释/解决, 就不写到系列里了, 把记录放上来抛砖引玉吧.
代码
测试代码下载地址 http://www.stcmcudata.com/STC8F-DATASHEET/STC8H8K64U-DEMO-CODE.ZIP , 使用其中的"39-通过USB发送命令读取ADC测试程序", 用于创建一个 USB HID 设备.
连线
USB口的4线顺序
USB Layout: 5V | D- | D+ | GND
连线
USB STC8H8K64U
5V -> VCC # 这一部分的连线会有其它情况
D- -> P3.0
D+ -> P3.1
P3.2 # 拉高为运行用户代码, 拉低为ISP模式
GND -> GND
VCC的电压, 对USB功能是否工作会有影响, 下面分3种情况说明. 测试的是一片lqfp48封装的 STC8H8K64U, 丝印是B版本, 这些问题也许是个体差异, 需要更多测试判断
测试
VCC直连5V
Win10 能检测到 USB 设备, 但是不识别.
Ubuntu20.04 dmesg 输出
[ 2483.709716] usb 2-3: new full-speed USB device number 31 using xhci_hcd
[ 2483.837738] usb 2-3: device descriptor read/64, error -71
[ 2484.073747] usb 2-3: device descriptor read/64, error -71
[ 2484.309721] usb 2-3: new full-speed USB device number 32 using xhci_hcd
[ 2484.437740] usb 2-3: device descriptor read/64, error -71
[ 2484.673739] usb 2-3: device descriptor read/64, error -71
[ 2484.781788] usb usb2-port3: attempt power cycle
[ 2485.437650] usb 2-3: new full-speed USB device number 33 using xhci_hcd
[ 2485.437786] usb 2-3: Device not responding to setup address.
[ 2485.645720] usb 2-3: Device not responding to setup address.
[ 2485.853705] usb 2-3: device not accepting address 33, error -71
[ 2485.981717] usb 2-3: new full-speed USB device number 34 using xhci_hcd
[ 2486.002557] usb 2-3: device descriptor read/8, error -71
[ 2486.130718] usb 2-3: device descriptor read/8, error -71
[ 2486.237826] usb usb2-port3: unable to enumerate USB device
VCC经两个1N4148串联降压到3.7V
Win10 能检测到 USB 设备, 但是不识别.
Ubuntu20.04 的 dmesg, 此时能检测到, 但是应该是有问题的. 在刚开始测试时, 会输出与上面错误状态一样的dmesg
[ 2035.215017] usb 2-3: new full-speed USB device number 29 using xhci_hcd
[ 2035.343043] usb 2-3: device descriptor read/64, error -71
[ 2035.601374] usb 2-3: New USB device found, idVendor=5354, idProduct=4380, bcdDevice= 1.00
[ 2035.601389] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2035.601395] usb 2-3: Product: STC USB Device
[ 2035.601399] usb 2-3: Manufacturer: STC
[ 2036.170978] hid: raw HID events driver (C) Jiri Kosina
[ 2036.176067] usbhid 2-3:1.0: can't add hid device: -71
[ 2036.176082] usbhid: probe of 2-3:1.0 failed with error -71
[ 2036.176133] usbcore: registered new interface driver usbhid
[ 2036.176136] usbhid: USB HID core driver
[ 2083.254934] usb 2-3: USB disconnect, device number 29
[ 2085.559301] usb 2-3: new full-speed USB device number 30 using xhci_hcd
[ 2085.709303] usb 2-3: New USB device found, idVendor=5354, idProduct=4380, bcdDevice= 1.00
[ 2085.709318] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2085.709323] usb 2-3: Product: STC USB Device
[ 2085.709328] usb 2-3: Manufacturer: STC
[ 2085.711834] usbhid 2-3:1.0: can't add hid device: -71
[ 2085.711867] usbhid: probe of 2-3:1.0 failed with error -71
[ 2340.604515] usb 2-3: USB disconnect, device number 30
VCC使用USB2TTL提供的3.3V
USB 与 USB2TTL 共地
Win10 情况依旧, 在很少数的情况, 能识别出 HID Input 设备, 但是上位机软件无法检测识别.
Ubuntu20.04 可以正常识别, 分两种情况:
将P32通过2KR电阻接3.3V上拉, 最初加电未正常工作, 经过两次加电, 能看到正确的输出
[ 1902.282379] usb 2-2: new full-speed USB device number 42 using xhci_hcd
[ 1902.432752] usb 2-2: New USB device found, idVendor=5354, idProduct=4380, bcdDevice= 1.00
[ 1902.432766] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1902.432771] usb 2-2: Product: STC USB Device
[ 1902.432776] usb 2-2: Manufacturer: STC
[ 1902.436845] input: STC STC USB Device as /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/0003:5354:4380.0003/input/input22
[ 1902.494766] hid-generic 0003:5354:4380.0003: input,hidraw0: USB HID v1.01 Device [STC STC USB Device] on usb-0000:00:14.0-2/input0
USB设备信息
$ lsusb -v
Bus 002 Device 042: ID 5354:4380 Meyer Instruments (MIS) STC USB Device
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x5354 Meyer Instruments (MIS)
idProduct 0x4380
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0029
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.01
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 27
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
P32悬空, 会进入ISP模式
[ 1645.193000] usb 2-2: new full-speed USB device number 30 using xhci_hcd
[ 1645.341751] usb 2-2: device descriptor read/all, error -71
[ 1645.468940] usb 2-2: new full-speed USB device number 31 using xhci_hcd
[ 1645.597259] usb 2-2: Device not responding to setup address.
[ 1645.805130] usb 2-2: Device not responding to setup address.
[ 1646.012966] usb 2-2: device not accepting address 31, error -71
[ 1646.013086] usb usb2-port2: attempt power cycle
[ 1646.668947] usb 2-2: new full-speed USB device number 32 using xhci_hcd
[ 1646.669156] usb 2-2: Device not responding to setup address.
[ 1646.877105] usb 2-2: Device not responding to setup address.
[ 1647.084924] usb 2-2: device not accepting address 32, error -71
[ 1647.212913] usb 2-2: new full-speed USB device number 33 using xhci_hcd
[ 1647.238924] usb 2-2: New USB device found, idVendor=34bf, idProduct=1001, bcdDevice= 1.00
[ 1647.238934] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1647.238939] usb 2-2: Product: USB-ISP
[ 1647.238942] usb 2-2: Manufacturer: STC
[ 1647.242464] input: STC USB-ISP as /devices/pci0000:00/0000:00:14.0/usb2/2-2/2-2:1.0/0003:34BF:1001.0002/input/input21
[ 1647.301225] hid-generic 0003:34BF:1001.0002: input,hidraw0: USB HID v1.01 Device [STC USB-ISP] on usb-0000:00:14.0-2/input0
lsusb -v
Bus 002 Device 033: ID 34bf:1001 STC USB-ISP
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x34bf
idProduct 0x1001
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0029
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.01
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 23
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 1
问题
综上, STC8H 的 USB 功能还是存在一些问题, 也许是使用的方法不对, 这些记录对其他人也许会有帮助. 待有更多资料再试吧.
参考
- USB下载的说明 https://www.stcisp.com/stc15-usb-isp-d1.html
- USB HID 跨平台库 libusb/hidapi
STC8H8K64U 的 USB 功能测试(未成功)的更多相关文章
- PS2鼠标+LCD12864实验(调试未成功)
此试验我一人调试许久都未成功,但发送ff时,读出来的数据确是对的,一开始让我窃喜,但发送f4时,读出来的数据确是错的,哎让苦恼啊,能力有限,只能先暂时就这样吧,那位什么还要贴出来呢,有两个原因: 1. ...
- WebApi 数据保护操作未成功。这可能是由于未为当前线程的用户上下文加载用户配置文件导致的。当线程执行模拟时,可能会出现此情况。","ExceptionType":"System.Security.Cryptography.CryptographicException","StackTrace
在调用System.Security.Cryptography.ProtectedData.Protect方法来保护私密信息时,IIS可能会报以下错误:CryptographicException: ...
- Eclipse + Apache Axis2 发布RESTful WebService(三)第一个程序Hello Axis2 !(未成功)
此路不通 Axis2发布SOAP WebService非常简单,建一个Dynamic Web Project,然后为它建一个Axis的Web Service(Tomcat7+JDK),就会生成Clas ...
- git 取消未成功的 merge
git 取消未成功的 merge # 合并时遇到冲突想取消操作,恢复index $ git merge --abort # 可以回退到某个提交 $ git reset --hard # 可以撤销某个提 ...
- 解Bug之路-主从切换"未成功"?
解Bug之路-主从切换"未成功"? 前言 数据库主从切换是个非常有意思的话题.能够稳定的处理主从切换是保证业务连续性的必要条件.今天笔者就来讲讲主从切换过程中一个小小的问题. 故障 ...
- STC8H开发(九): STC8H8K64U模拟USB HID外设
目录 STC8H开发(一): 在Keil5中配置和使用FwLib_STC8封装库(图文详解) STC8H开发(二): 在Linux VSCode中配置和使用FwLib_STC8封装库(图文详解) ST ...
- 22、在Ubuntu 14.0上使用韦东山IP2977测试总结(未成功)
1. 去www.kernel.org下载同版本的内核(与Ubuntu 14.0) 解压后把drivers/media/video/uvc目录取出(发现我的3.13版本的在drivers\media\u ...
- django 未成功初始化自定义表单
用以下两句 python3 manage.py makemigrations python3 manage.py migrate 成功初始化了数据库,但是只初始化了django自带的表,未初始化我自定 ...
- VS发布,应用程序验证未成功。无法继续。
用VS2005发布客户端程序. 1.发布:点击工程项目属性,右键发布按钮,一切正常. 2.测试安装:提示如下提示框: 打开详细信息内容如下: 错误摘要 以下是错误摘要,这些错误的详细信息列在该日志的后 ...
- VisualSVN Server搭建VDFS分布式仓研究(未成功)
FSFS与VDFS的使用区别在于FSFS是本地仓库,VDFS是分布式仓库,实现在同一个局域网内多台仓库进行同步:以下是我的猜测,因为没搭建成功: 1.必须是同一个局域网,如果有外内网基本是不可实现,需 ...
随机推荐
- JS - console多个值
Promise.all([p1, p2]).then( (res) => { let [p1, p2] = res; console.l ...
- [转帖]Kubernetes1.25.6部署文档 使用cri-docker部署K8s1.25.6
https://zhuanlan.zhihu.com/p/600808149 本文档将通过kubeadm+docker部署K8s集群,本次集群使用的容器运行工具为docker,K8s的容器运行工具也可 ...
- [转帖]CoreDNS loop 插件异常问题
https://zhuanlan.zhihu.com/p/476611162 背景 最近有遇到一个客户集群,发现集群中的 CoreDNS 老是异常 (loop 插件检测到有回路后进行 panic) ...
- [转帖]Jmeter性能测试:高并发分布式性能测试
一.为什么要进行分布式性能测试 当进行高并发性能测试的时候,受限于Jmeter工具本身和电脑硬件的原因,无法满足我们对大并发性能测试的要求.基于这种场景下,我们就需要采用分布式的方式来实现我们高并发的 ...
- 【转帖】python 安装whl文件
前言 WHL文件是以Wheel格式保存的Python安装包,Wheel是Python发行版的标准内置包格式.在本质上是一个压缩包,WHL文件中包含了Python安装的py文件和元数据,以及经过编译的p ...
- [转帖]019 Linux tcpdump 抓包案例入门可真简单啊?
https://my.oschina.net/u/3113381/blog/5477908 1 tcpdump 是什么? tcpdump 可以将网络中传送的数据包完全截获下来提供分析.它支持针对网 ...
- ESXi6.7安装Win11的方法
背景 公司里面要进行新的操作系统验证了. 之前Win10 Win7 Win8 都比较简单. 就是现在Win11有了TPM非常繁琐. 今天必须得搞一把了,就简单搜索了下. 发现还是可以解决的. 然后记录 ...
- mysql8 部分信息总结
0. 我这边环境需要的配置参数 datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.logp ...
- 商智C店H5性能优化实战
前言 商智C店,是依托移动低码能力搭建的一个应用,产品面向B端商家.随着应用体量持续增大,考虑产品定位及用户体验,我们针对性能较差页面做了一次优化,并取得了不错的效果,用户体验值(UEI)从一般提升到 ...
- golang: 学会几个语法上的新写法
看了VictoriaMetrics,学会了几个新写法,记录下来: 1. 数组拷贝 以前: arr := make([]byte, 0, len(oldArr) arr = append(arr, ol ...