3

我有新鲜的STM32 L1发现板,它似乎坏了。但我不完全确定。

当通过 USB 将开发板连接到 Linux 机器时,开发板完全正常启动,并且演示工作与供应商描述的一样。

但我无法真正连接到这块板。

➜ lsusb -s 002:074
Bus 002 Device 074: ID 0483:3748 STMicroelectronics ST-LINK/V2

电路板似乎已连接,用于在 ST-LINK 和 DISCOVERY 之间切换的大跳线 (CN3) 设置为 DISCOVERY。但是当我尝试使用我收到的 st-link 实用程序时。

➜  stlink git:(master) ./st-flash --reset erase
libusb_handle_events() timeout
[!] send_recv
libusb_submit_transfer(-6)
[!] send_recv
libusb_submit_transfer(-6)
[!] send_recv
libusb_submit_transfer(-6)
[!] send_recv
libusb_submit_transfer(-6)
[!] send_recv
2015-12-25T19:24:57 INFO src/stlink-common.c: Loading device parameters....
libusb_submit_transfer(-6)
[!] send_recv
libusb_submit_transfer(-6)
[!] send_recv
libusb_submit_transfer(-6)
[!] send_recv
2015-12-25T19:24:57 WARN src/stlink-common.c: unknown chip id! 0
fish: Job 1, './st-flash --reset erase' terminated by signal SIGSEGV (Address boundary error)

OpenOCD 也无法与董事会对话。

openocd -f board/stm32ldiscovery.cfg
Open On-Chip Debugger 0.9.0 (2015-12-25-18:43)
Licensed under GNU GPL v2
For bug reports, read
     http://openocd.org/doc/doxygen/bugs.html
adapter speed: 300 kHz
adapter_nsrst_delay: 100
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : clock speed 240 kHz
Error: reset device failed
in procedure 'init' 
in procedure 'ocd_bouncer'

板载芯片为STM32L152RCT6。我之前使用过 STM32F0..4 并且从未遇到过这样的问题,但是我之前没有使用过 L 系列,所以我不确定这是电路板问题还是我在这里跳过了一些重要的问题。

编辑:使用 OpenOCD 我发现不是预期的行为。在第一次运行时,我收到错误:

Error: init mode failed (unable to connect to the target)

在第二次运行:

Error: reset device failed

然后设备从系统中消失,dmesg留下消息:

[ 1336.080239] usb 2-1.1: reset full-speed USB device number 4 using ehci-pci
[ 1336.154250] usb 2-1.1: device descriptor read/64, error -32
[ 1336.329341] usb 2-1.1: device descriptor read/64, error -32
[ 1336.503334] usb 2-1.1: reset full-speed USB device number 4 using ehci-pci
[ 1336.566330] usb 2-1.1: device descriptor read/64, error -32
[ 1336.741385] usb 2-1.1: device descriptor read/64, error -32
[ 1336.915427] usb 2-1.1: reset full-speed USB device number 4 using ehci-pci
[ 1337.317517] usb 2-1.1: device not accepting address 4, error -32
[ 1337.390532] usb 2-1.1: reset full-speed USB device number 4 using ehci-pci
[ 1337.792623] usb 2-1.1: device not accepting address 4, error -32
[ 1337.793110] usb 2-1.1: USB disconnect, device number 4
[ 1337.855642] usb 2-1.1: new full-speed USB device number 5 using ehci-pci
[ 1337.918651] usb 2-1.1: device descriptor read/64, error -32
[ 1338.093691] usb 2-1.1: device descriptor read/64, error -32
[ 1338.267730] usb 2-1.1: new full-speed USB device number 6 using ehci-pci
[ 1338.330727] usb 2-1.1: device descriptor read/64, error -32
[ 1338.505783] usb 2-1.1: device descriptor read/64, error -32
[ 1338.679823] usb 2-1.1: new full-speed USB device number 7 using ehci-pci
[ 1339.081921] usb 2-1.1: device not accepting address 7, error -32
[ 1339.154935] usb 2-1.1: new full-speed USB device number 8 using ehci-pci
[ 1339.557024] usb 2-1.1: device not accepting address 8, error -32
[ 1339.557168] usb 2-1-port1: unable to enumerate USB device

我认为适配器速度可能存在问题,但我现在不确定。

EDIT2:我尝试使用 Windows ST Link Utility,但无法连接到电路板,电路板导致“检测错误”或“连接错误”,软件建议更改 SWD 频率或模式。我厌倦了几乎所有的组合,但没有一个有效。

EDIT3:如果这对某人有帮助,则板已被退回,我得到的信息表明它实际上已损坏并且我有新的。新的按预期完美运行。

4

1 回答 1

2

有时我在 GNU/Linux 上使用同一个 L1 Discovery 板。texane /stlink和 OpenOCD 都可以完美地检测到它,无需任何修改。你可以看到输出:

$ st-util 
2016-01-08T21:55:59 INFO src/stlink-common.c: Loading device parameters....
2016-01-08T21:55:59 INFO src/stlink-common.c: Device connected is: L1 Med-density device, id 0x10186416
2016-01-08T21:55:59 INFO src/stlink-common.c: SRAM size: 0x4000 bytes (16 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 256 bytes
2016-01-08T21:55:59 INFO gdbserver/gdb-server.c: Chip ID is 00000416, Core ID is  2ba01477.
2016-01-08T21:55:59 INFO gdbserver/gdb-server.c: Target voltage is 2917 mV.
2016-01-08T21:55:59 INFO gdbserver/gdb-server.c: Listening at *:4242...
$ openocd -f board/stm32ldiscovery.cfg 
GNU ARM Eclipse 64-bits Open On-Chip Debugger 0.10.0-dev-00141-g09aeb96-dirty (2015-10-28-11:56)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 300 kHz
adapter_nsrst_delay: 100
Info : The selected transport took over low-level target control. The    results might differ compared to plain JTAG/SWD
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : Unable to match requested speed 300 kHz, using 240 kHz
Info : clock speed 240 kHz
Info : STLINK v2 JTAG v25 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.913980
Info : stm32l1.cpu: hardware has 6 breakpoints, 4 watchpoints

也许你的板子真的坏了,但在回收它之前,我建议你进行两次不同的试验。(a)我认为在您提出问题之后,您还有另一个 ST(如您提到的 STM32F0..4)板,可能带有 ST-LINK 适配器。您可以将其用作外部 ST-LINK(按照例如this)。(b) 尝试使用STSW-LINK005升级您的嵌入式 ST-LINK 固件,它的 java 版本也适用于 GNU/Linux 环境。该板在升级前后对我来说都表现良好。

于 2016-01-08T21:08:44.083 回答