Hardware watchpoint supported by the target
SWD frequency = 4000 kHz
ST-LINK Firmware version : V2J34S7
Device ID: 0x410
PC: 0x80052c4
ST-LINK device status: HALT_MODE
ST-LINK detects target voltage = 3.26 V
Vendor = 0x55
Error in initializing ST-LINK device.
Reason: ST-LINK: Could not verify ST device! Abort connection.
In the log file it shows readJEP106ID(): Vendor = 0x55 and I'm guessing that isn't ST Micro.
0xe00fffc0: 00000000 00000000 00000000 00000001 00000000 00000000 00000000 00000000
0xe00fffe0: 00000010 00000004 0000000a 00000000 0000000d 00000010 00000005 000000b1
0xE00FFFC0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................
0xE00FFFE0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ................................
Looks like I missed the last words, FWIW they are the same as yours:
0xE00FFFF0: 0000000D 00000010 00000005 000000B1
I replaced the set _CPUTAPID 0x1ba01477 as suggested by tsman in the ...\resources\openocd\st_scripts\target\stm32f1x.cfg file and also had to set the generator options to connection speed 4MHz and reset mode to software. Debugging is now working with STM32CubeIDE
[...]
The dodgy bluepill boards purport to have proper STM32 chips. See attached.
I don't know about an example code library, but STM32CubeMX will auto generate most of the HAL code for you.
"A large number of code use examples are also included making it even easier to get started"
I haven't had a chance to do any further USB testing, but I did get this version of mecrisp Forth with USB serial console working on the "991KA". See if that works and if so perhaps there is a clue in the source code.
>:~/stm32-test$ dmesg | tail
[833568.806235] usb 1-4: config index 0 descriptor too short (expected 67, got 64)
[833568.806240] usb 1-4: config 1 has an invalid descriptor of length 7, skipping remainder of the config
[833568.806245] usb 1-4: config 1 interface 1 altsetting 0 has 1 endpoint descriptor, different from the interface descriptor's value: 2
[833568.807532] usb 1-4: New USB device found, idVendor=0483, idProduct=5740
[833568.807535] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[833568.807537] usb 1-4: Product: Forth Serial Port
[833568.807539] usb 1-4: Manufacturer: Mecrisp (STM32F10x)
[833568.807712] usb 1-4: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
[833568.808141] cdc_acm 1-4:1.0: This device cannot do calls on its own. It is not a modem.
[833568.808149] cdc_acm: probe of 1-4:1.0 failed with error -22
>:~/stm32-test$ dmesg | tail
[833568.806235] usb 1-4: config index 0 descriptor too short (expected 67, got 64)
[833568.806240] usb 1-4: config 1 has an invalid descriptor of length 7, skipping remainder of the config
[833568.806245] usb 1-4: config 1 interface 1 altsetting 0 has 1 endpoint descriptor, different from the interface descriptor's value: 2
[833568.807532] usb 1-4: New USB device found, idVendor=0483, idProduct=5740
[833568.807535] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[833568.807537] usb 1-4: Product: Forth Serial Port
[833568.807539] usb 1-4: Manufacturer: Mecrisp (STM32F10x)
[833568.807712] usb 1-4: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
[833568.808141] cdc_acm 1-4:1.0: This device cannot do calls on its own. It is not a modem.
[833568.808149] cdc_acm: probe of 1-4:1.0 failed with error -22
>:~/stm32-test$ dmesg | tail
[833568.807712] usb 1-4: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
[833568.808141] cdc_acm 1-4:1.0: This device cannot do calls on its own. It is not a modem.
[833568.808149] cdc_acm: probe of 1-4:1.0 failed with error -22
[833613.885577] usb 1-4: USB disconnect, device number 58
[833614.157665] usb 1-4: new full-speed USB device number 59 using xhci_hcd
[833614.269936] usb 1-4: Device not responding to setup address.
[833614.473905] usb 1-4: Device not responding to setup address.
[833614.678026] usb 1-4: device not accepting address 59, error -71
[833615.198306] usb 1-4: new full-speed USB device number 60 using xhci_hcd
[833615.310424] usb 1-4: device descriptor read/64, error -71
>:~/stm32-test$ dmesg | tail
[833568.807712] usb 1-4: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
[833568.808141] cdc_acm 1-4:1.0: This device cannot do calls on its own. It is not a modem.
[833568.808149] cdc_acm: probe of 1-4:1.0 failed with error -22
[833613.885577] usb 1-4: USB disconnect, device number 58
[833614.157665] usb 1-4: new full-speed USB device number 59 using xhci_hcd
[833614.269936] usb 1-4: Device not responding to setup address.
[833614.473905] usb 1-4: Device not responding to setup address.
[833614.678026] usb 1-4: device not accepting address 59, error -71
[833615.198306] usb 1-4: new full-speed USB device number 60 using xhci_hcd
[833615.310424] usb 1-4: device descriptor read/64, error -71
[ 69.229951] usb 1-5: new full-speed USB device number 6 using xhci_hcd
[ 69.490083] usb 1-5: New USB device found, idVendor=0483, idProduct=5740, bcdDevice= 2.00
[ 69.490087] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 69.490089] usb 1-5: Product: Forth Serial Port
[ 69.490091] usb 1-5: Manufacturer: Mecrisp (STM32F10x)
[ 69.490092] usb 1-5: SerialNumber: 1D686BD9
[ 69.507525] cdc_acm 1-5:1.0: ttyACM0: USB ACM device
I am also having similar problems with USB enumeration and recent STM32 blue pill boards.
I did however find that using the opencm3 CDC example compiled in Platformio/VSC, ....
1 0.000000000 host -> 55.0 USB 64 GET DESCRIPTOR Request DEVICE
2 0.000044000 55.0 -> host USB 64 GET DESCRIPTOR Response DEVICE[Malformed Packet]
3 0.000060000 host -> 55.0 USB 64 GET DESCRIPTOR Request DEVICE
4 0.000149000 55.0 -> host USB 82 GET DESCRIPTOR Response DEVICE
5 0.000178000 host -> 55.0 USB 64 GET DESCRIPTOR Request DEVICE QUALIFIER
6 0.000242000 55.0 -> host USB 64 GET DESCRIPTOR Response DEVICE QUALIFIER[Malformed Packet]
7 0.000268000 host -> 55.0 USB 64 GET DESCRIPTOR Request DEVICE QUALIFIER
8 0.000338000 55.0 -> host USB 64 GET DESCRIPTOR Response DEVICE QUALIFIER[Malformed Packet]
9 0.000361000 host -> 55.0 USB 64 GET DESCRIPTOR Request DEVICE QUALIFIER
10 0.000431000 55.0 -> host USB 64 GET DESCRIPTOR Response DEVICE QUALIFIER[Malformed Packet]
11 0.000455000 host -> 55.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
12 0.000524000 55.0 -> host USB 64 GET DESCRIPTOR Response CONFIGURATION[Malformed Packet]
13 0.000547000 host -> 55.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
14 0.000598000 55.0 -> host USB 73 GET DESCRIPTOR Response CONFIGURATION
15 0.000616000 host -> 55.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
16 0.000694000 55.0 -> host USB 73 GET DESCRIPTOR Response CONFIGURATION[Malformed Packet]
17 0.000723000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
18 0.000798000 55.0 -> host USB 68 GET DESCRIPTOR Response STRING
19 0.000815000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
20 0.000883000 55.0 -> host USB 64 GET DESCRIPTOR Response STRING[Malformed Packet]
21 0.000886000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
22 0.000977000 55.0 -> host USB 100 GET DESCRIPTOR Response STRING
23 0.000980000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
24 0.001017000 55.0 -> host USB 64 GET DESCRIPTOR Response STRING[Malformed Packet]
25 0.001020000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
26 0.001114000 55.0 -> host USB 104 GET DESCRIPTOR Response STRING
27 0.001117000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
28 0.001154000 55.0 -> host USB 64 GET DESCRIPTOR Response STRING[Malformed Packet]
29 0.001157000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
30 0.001431000 55.0 -> host USB 64 GET DESCRIPTOR Response STRING[Malformed Packet]
31 0.001434000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
32 0.001471000 55.0 -> host USB 64 GET DESCRIPTOR Response STRING[Malformed Packet]
33 0.001474000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
34 0.001752000 55.0 -> host USB 66 GET DESCRIPTOR Response STRING[Malformed Packet]
35 0.001768000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
36 0.001811000 55.0 -> host USB 66 GET DESCRIPTOR Response STRING[Malformed Packet]
37 0.001833000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
38 0.002035000 55.0 -> host USB 66 GET DESCRIPTOR Response STRING[Malformed Packet]
39 0.002052000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
40 0.002126000 55.0 -> host USB 66 GET DESCRIPTOR Response STRING[Malformed Packet]
41 0.002143000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
42 0.002374000 55.0 -> host USB 64 GET DESCRIPTOR Response STRING[Malformed Packet]
43 0.002391000 host -> 55.0 USB 64 GET DESCRIPTOR Request STRING
44 0.002459000 55.0 -> host USB 64 GET DESCRIPTOR Response STRING[Malformed Packet]
45 0.002612000 host -> 55.0 USB 64 SET CONFIGURATION Request
1 0.000000000 host -> 90.0 USB 64 GET DESCRIPTOR Request DEVICE
2 0.000114000 90.0 -> host USB 82 GET DESCRIPTOR Response DEVICE
3 0.000141000 host -> 90.0 USB 64 GET DESCRIPTOR Request DEVICE QUALIFIER
4 0.000200000 90.0 -> host USB 64 GET DESCRIPTOR Response DEVICE QUALIFIER[Malformed Packet]
5 0.000224000 host -> 90.0 USB 64 GET DESCRIPTOR Request DEVICE QUALIFIER
6 0.000278000 90.0 -> host USB 64 GET DESCRIPTOR Response DEVICE QUALIFIER[Malformed Packet]
7 0.000300000 host -> 90.0 USB 64 GET DESCRIPTOR Request DEVICE QUALIFIER
8 0.000359000 90.0 -> host USB 64 GET DESCRIPTOR Response DEVICE QUALIFIER[Malformed Packet]
9 0.000386000 host -> 90.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
10 0.000423000 90.0 -> host USB 64 GET DESCRIPTOR Response CONFIGURATION[Malformed Packet]
11 0.000446000 host -> 90.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
12 0.000507000 90.0 -> host USB 73 GET DESCRIPTOR Response CONFIGURATION
13 0.000531000 host -> 90.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
14 0.000564000 90.0 -> host USB 64 GET DESCRIPTOR Response CONFIGURATION[Malformed Packet]
15 0.000568000 host -> 90.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
16 0.000660000 90.0 -> host USB 64 GET DESCRIPTOR Response CONFIGURATION[Malformed Packet]
17 0.000663000 host -> 90.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
18 0.000816000 90.0 -> host USB 131 GET DESCRIPTOR Response CONFIGURATION
19 0.000822000 host -> 90.0 USB 64 GET DESCRIPTOR Request STRING
20 0.000917000 90.0 -> host USB 68 GET DESCRIPTOR Response STRING
21 0.000921000 host -> 90.0 USB 64 GET DESCRIPTOR Request STRING
22 0.001030000 90.0 -> host USB 90 GET DESCRIPTOR Response STRING
23 0.001034000 host -> 90.0 USB 64 GET DESCRIPTOR Request STRING
24 0.001166000 90.0 -> host USB 116 GET DESCRIPTOR Response STRING
25 0.001190000 host -> 90.0 USB 64 GET DESCRIPTOR Request STRING
26 0.001291000 90.0 -> host USB 74 GET DESCRIPTOR Response STRING
27 0.001769000 host -> 90.0 USB 64 SET CONFIGURATION Request
28 0.001801000 90.0 -> host USB 64 SET CONFIGURATION Response
29 0.003141000 host -> 90.0 USBCOM 71 SET LINE CODING Request
30 0.003192000 90.0 -> host USB 64 URB_CONTROL out