对 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
上一篇:STC8H8K64U 的 USB 功能测试(续)
下一篇:STC8H开发(八): NRF24L01无线传输音频(对讲机原型)
推荐阅读最新更新时间:2024-11-04 18:32
设计资源 培训 开发板 精华推荐
- FAN2558 180mA低压CMOS LDO典型应用电路
- 使用 Infineon Technologies AG 的 IRU3073 的参考设计
- LT3988 的典型应用 - 双路 60V 单片式 1A 降压型开关稳压器
- RGB_800X480
- 具有静音/待机功能的 Tda7293 120V - 100W Dmos 音频放大器的典型高效应用电路
- 智能小夜灯 esp8266
- RD-549,FAN9672 2 相交错 CCM PFC 控制器的参考设计,用于高达 3KW 的功率因数校正前端设计
- LT3091HT7 并联线性稳压器的典型应用
- 使用 MaxLinear, Inc 的 SPX385S-1.2/TR 的参考设计
- ESP32-CAM底板 SSD1331 OLED显示屏 附源码
- 阅1SP0350V SCALE-2单通道即插即用型门极驱动器,参与PI答题享好礼!
- 点评下载资料,参加幸运抽奖,让我们迈开技术交流分享的步伐!!
- 12月6日上午10:00有奖直播:如何使用Microchip安全方案为IoT设备保驾护航
- 下载有好礼!罗姆带您学习电源设计应用小技巧(电源管理篇)
- 是德科技推出新的8通道示波器 点击获取报价
- TIDesigns 有奖调查轻松赢好礼!
- TE有奖活动|如何有效应对当下测试测量领域的挑战
- 降暑消消乐 和Silicon Labs一起消灭这包“以太网供电难题”
- 《CoolSiC™英飞凌最佳的伺服驱动解决方案》白皮书下载
- 有奖活动|逛安富利人工智能云会展,解锁AI资料,赢好礼!