Closed kaidegit closed 3 years ago
Hi, several questions.
What pyocd version? (pyocd --version
)
What OS are you using?
Can you please provide a USB descriptor dump?
lsusb -v
on LinuxCould you please provide the log for pyocd list -vv
? This will output any debug logs, potentially including USB errors.
Thanks!
The pyocd version is 0.30.3.dev0+dirty.
I'm using macOS Big Sur(11.0.1).
I ran lsusb -v
on my Mac and it says:
WCH-Link:
Product ID: 0x8011
Vendor ID: 0x1a86
Version: 1.02
Serial Number: 0001A0000001
Speed: Up to 12 Mb/s
Manufacturer: wch.cn
Location ID: 0x14a40000 / 8
Current Available (mA): 500
Current Required (mA): 500
Extra Operating Current (mA): 0
The log for pyocd list -vv
is
0001355:DEBUG:session:Project directory: /Users/kai
0001370:DEBUG:pemicro:Opened PEMicro library: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pypemicro-0.1.5-py3.8.egg/pypemicro/libs/MacOS/unitacmp-64.dylib
No available debug probes are connected
However, i can find the wchlink on my windows laptop.....
system version: Windows 10 Pro 21H1
pyocd version: 0.29.0
pyocd list -vv
0003547:DEBUG:session:Project directory: C:\Users\yekai
0003662:WARNING:common:STLink and CMSIS-DAPv2 probes are not supported because no libusb library was found.
# Probe Unique ID
-------------------------------------------
0 wch.cn WCH CMSIS-DAP 0001A0000001
Apologies for taking a while to get back to this. Unfortunately the lsusb
call on your Mac didn't provide the descriptors I need. Would you mind trying out this:
$ brew install mikhailai/misc/usbutils
$ lsusb -v -d 1a86:8011 > usb-descriptors.txt
Then attach the usb-descriptors.txt
file to a comment here.
If you still have the lsusb
package installed, you'll have to either uninstall it or run brew unlink lsusb
first, as it conflicts with usbutils.
Another option would be to run usbview.exe on your Windows laptop and copy the info text dump. The data will be the same.
Another test to run would be to try this Python command:
$ python -c "import pprint, hid ; pprint.pprint(hid.enumerate())"
This will dump info about all available USB HID devices, as the hidapi library sees them. (pyocd uses hidapi for communicating with HID devices on macOS and Windows, though pyocd <0.30 on Windows used pywinusb instead by default.)
Bus 020 Device 012: ID 1a86:8011 QinHeng Electronics
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 8
idVendor 0x1a86 QinHeng Electronics
idProduct 0x8011
bcdDevice 1.02
iManufacturer 1 wch.cn
iProduct 2 WCH-Link
iSerial 3 0001A0000001
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 107
bNumInterfaces 3
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 1 AT-commands (v.25ter)
iFunction 4 WCH CMSIS-DAP
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 0 None
iInterface 4 WCH CMSIS-DAP
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x01
call management
bDataInterface 1
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Union:
bMasterInterface 0
bSlaveInterface 1
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 2
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 5 (error)
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 6 (error)
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 33
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
Device Status: 0x0000
(Bus Powered)
{'interface_number': 2,
'manufacturer_string': 'wch.cn',
'path': b'IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/XHC@14/XH'
b'C@14000000/HS10@14a00000/USB 2.0 Hub [MTT]@14a00000/AppleUSB20Hu'
b'b@14a00000/AppleUSB20HubPort@14a40000/WCH-Link@14a40000/WCH CMSI'
b'S-DAP@2/AppleUserUSBHostHIDDevice',
'product_id': 32785,
'product_string': 'WCH-Link',
'release_number': 258,
'serial_number': '0001A0000001',
'usage': 1,
'usage_page': 65280,
'vendor_id': 6790},
Thanks! The reason it's not detected is pretty simple: there's no "CMSIS-DAP" in the device's product name string.
The CMSIS-DAP specification also allows for "CMSIS-DAP" to appear in the interface name string. But the hidapi library doesn't report the interface's name (if it has one). And, the interface name descriptors are apparently messed up on the WCH-Link: the CDC interface association and first CDC interface have the name "WCH CMSIS-DAP", but the CMSIS-DAP HID interface has an erroneous string ID 6 (according to lsusb).
However, oddly, the string "WCH CMSIS-DAP" appears in the 'path' of the hidapi device info dictionary, associated with interface 2 (the HID interface). This doesn't add up… But it does present an option for detecting CMSIS-DAPv1 devices that only have "CMSIS-DAP" in the interface string when using hidapi.
I'll make a change to look for "CMSIS-DAP" in the hidapi device path, and give you a branch to try it out with.
Ok, the change is ready for testing on this branch of my fork.
You can install like this:
$ pip install -U git+https://github.com/flit/pyOCD@bugfix/hidapi_uid_and_if_name
OK, It can find my wch link now.
Thanks!
Great! Thanks for testing.
I have the same problem.
My macOS is 11.6.4 (20G417). After I connected CH32V307VCt6 to my MacbookPro(2015) by builtin WCH-LINK, I can see a WCH-Link device in SystemInfomation / USB. I can connect to it with Serial Tool, and get the output.
$ lsusb -vv -d 1a86:8011
WCH-Link:
Product ID: 0x8010
Vendor ID: 0x1a86
Version: 2.03
Serial Number: 0001A0000001
Speed: Up to 12 Mb/s
Manufacturer: wch.cn
Location ID: 0x14100000 / 26
Current Available (mA): 500
Current Required (mA): 100
Extra Operating Current (mA): 0
$ system_profiler SPUSBDataType
WCH-Link:
Product ID: 0x8010
Vendor ID: 0x1a86
Version: 2.03
Serial Number: 0001A0000001
Speed: Up to 12 Mb/s
Manufacturer: wch.cn
Location ID: 0x14100000 / 26
Current Available (mA): 500
Current Required (mA): 100
Extra Operating Current (mA): 0
$ ls -lh /dev/cu.*
/dev/cu.usbmodem0001A00000012
$ python -V
Python 3.8.5
$ python -c "import pprint, hid ; pprint.pprint(hid.enumerate())"
no info about WCH-LINK
all output are for ['product_string': 'Keyboard Backlight'] or ['product_string': 'Apple Internal Keyboard / Trackpad']
$ python3 -mpip install --pre -U git+https://github.com/pyocd/pyOCD.git@develop
install ok
$ pyocd -V
0.33.1.dev35
$ pyocd list -vv
No available debug probes are connected
It's actual for me again currently (pyocd 0.34.3)
The problem is reproducible with both 1a86:8010
(wch-LinkE-R0-1v2) and 2a86:8011
I don't have 1a86:8011
for testing
More info on wch-LinkE-R0-1v2 https://www.wch.cn/products/WCH-Link.html?spm=a2g0o.detail.1000023.14.56d72adcTTkc7f
It doesn't look to be based on DAP-Link, the following command does nothing
openocd -f interface/cmsis-dap.cfg -f target/stm32g0x.cfg -c "cmsis_dap_vid_pid 0x1a86 0x8010"
Here is a modified version of openocd that can provide a hint https://nc-pin.com/index.php/2022/04/25/openocd-for-ch32v-series/
@eugene-bright 1a86:8010 means it is in RISC-V mode. Re-check its recognized product name. You should see WCH-LinkRV
.
The docs are in Chinese only. I clicked IAP button and now I can't go out of IAP mode :hide-the-pain: One more peace of data I found https://www.wch.cn/bbs/thread-71088-1.html
The docs are in Chinese only. I clicked IAP button and now I can't go out of IAP mode :hide-the-pain:
One more peace of data I found
it should be work after replug it。。。do you flash the ch549's firmware? it should be flashed the firmware marked ch32v307。
btw,the chip has no boot0 to go to chip's bootloader. So if the iap part is broken, it is a must to have an another wch link or linke to flash it.
@kaidegit Thank you very much for the input! I did not flash anything. But apparantly I'm now forced to do so because replugging doesn't make the change and the dongle appears as WinChipHead 4348:55e0 all the time. I'm new to this stuff and touching it in the spare time. The goal is to adopt WCH-LinkE and start learning CH32V003 MCU. It's very promising.
Pyocd may can only work with arm mcu. And the debugger port of v003 is not open sourced. So just use the openocd wch offered to debug v003.
👌
WCH-Link is a CMSIS-dap debugger made by WCH.
It can be found by Keil and OpenOCD when adding the command
cmsis_dap_vid_pid 0x1a86 0x8011
.However, it cannot be found by PyOCD. When I run
pyocd list
, it just showsNo available debug probes are connected
.