---

** [tickets:#337] OpenOCD in endless-loop after supply drops on USB adapter**

**Status:** new
**Milestone:** 0.10.0
**Labels:** FTDI USB 
**Created:** Fri Feb 18, 2022 12:48 PM UTC by Andreas Müller
**Last Updated:** Fri Feb 18, 2022 12:48 PM UTC
**Owner:** nobody


Dear OpenOCD developer team,

you've made a good tool and I got really far with it.
I don't like to claim about errors that I saw, and of course at first I think, 
I'm too stupid.
And searched a lot to find a reason or solution. But even Google couldn't find 
anything...

Well, I'm using OpenOCD to debug an STM32F407 via an FTDI UM232H.

At first: It's working. :-)

Now I want to make some startup-tests, the STM32F407 and FTDI UM232H are 
powered down.

It's clear, that OpenOCD reports an error and exits.
So I have to restart it again.



But I see the following behaviour:

If I start the OpenOCD with not-supplied target, the answer is:
~~~
pi@raspberrypi:~/openocd$ sudo openocd -f ./openocd_ST32_R3_232h.cfg
Open On-Chip Debugger 0.11.0+dev-00418-g918811529 (2021-10-12-13:34)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 500 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', 
serial '*' at bus location '*'

pi@raspberrypi:~/openocd$
~~~

That's clear, and all is OK.

Starting with supplied target, is also OK:

~~~
pi@raspberrypi:~/openocd$ sudo openocd -f ./openocd_ST32_R3_232h.cfg
Open On-Chip Debugger 0.11.0+dev-00418-g918811529 (2021-10-12-13:34)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 500 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 500 kHz
Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM 
Ltd), part: 0xba00, ver: 0x4)
Info : JTAG tap: stm32f4x.bs tap/device found: 0x06413041 (mfg: 0x020 
(STMicroelectronics), part: 0x6413, ver: 0x0)
Info : stm32f4x.cpu: Cortex-M4 r0p1 processor detected
Info : stm32f4x.cpu: target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f4x.cpu on 3333
Info : Listening on port 3333 for gdb connections
~~~

Well, everything is fine - till now.


But now I stop the power supply (a weak connection brings the same result) and 
then I'm trapped in an n-loop.
Even typing CTRL+C or CTRL+X doesn't stop it:
~~~
Error: ftdi device did not accept all data: 0, tried 75
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
Error: error while flushing MPSSE queue: -4
Error: libusb_handle_events() failed with LIBUSB_ERROR_NO_DEVICE
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
Error: error while flushing MPSSE queue: -4
Polling target stm32f4x.cpu failed, trying to reexamine
Error: libusb_handle_events() failed with LIBUSB_ERROR_NO_DEVICE
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
Error: error while flushing MPSSE queue: -4
Error: libusb_handle_events() failed with LIBUSB_ERROR_NO_DEVICE
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
Error: error while flushing MPSSE queue: -4
Error: libusb_handle_events() failed with LIBUSB_ERROR_NO_DEVICE
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
Error: error while flushing MPSSE queue: -4
Error: libusb_handle_events() failed with LIBUSB_ERROR_NO_DEVICE
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
Error: error while flushing MPSSE queue: -4
Error: libusb_handle_events() failed with LIBUSB_ERROR_NO_DEVICE
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
Error: error while flushing MPSSE queue: -4
Error: libusb_handle_events() failed with LIBUSB_ERROR_NO_DEVICE
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_NO_DEVICE
Error: error while flushing MPSSE queue: -4
......
~~~

The same with debug info:
~~~
Debug: 198 1646 command.c:201 script_debug(): command - mww 0xE0042008 6144
Debug: 199 1649 command.c:201 script_debug(): command - flash init
Debug: 200 1650 tcl.c:1387 handle_flash_init_command(): Initializing flash 
devices...
Debug: 201 1651 command.c:201 script_debug(): command - nand init
Debug: 202 1652 tcl.c:498 handle_nand_init_command(): Initializing NAND 
devices...
Debug: 203 1652 command.c:201 script_debug(): command - pld init
Debug: 204 1653 pld.c:206 handle_pld_init_command(): Initializing PLDs...
Debug: 205 1653 command.c:201 script_debug(): command - tpiu init
Info : 206 1654 gdb_server.c:3539 gdb_target_start(): starting gdb server for 
stm32f4x.cpu on 3333
Info : 207 1654 server.c:312 add_service(): Listening on port 3333 for gdb 
connections

Error: 208 13221 mpsse.c:930 mpsse_flush(): ftdi device did not accept all 
data: 0, tried 75
Debug: 209 13221 mpsse.c:423 mpsse_purge(): -
Error: 210 13221 mpsse.c:431 mpsse_purge(): unable to purge ftdi rx buffers: 
LIBUSB_ERROR_NO_DEVICE
Error: 211 13221 ftdi.c:656 ftdi_execute_queue(): error while flushing MPSSE 
queue: -4
Error: 212 13221 mpsse.c:925 mpsse_flush(): libusb_handle_events() failed with 
LIBUSB_ERROR_NO_DEVICE
Debug: 213 13221 mpsse.c:423 mpsse_purge(): -
Error: 214 13221 mpsse.c:431 mpsse_purge(): unable to purge ftdi rx buffers: 
LIBUSB_ERROR_NO_DEVICE
Error: 215 13221 ftdi.c:656 ftdi_execute_queue(): error while flushing MPSSE 
queue: -4
Debug: 216 13221 target.c:1838 target_call_event_callbacks(): target event 0 
(gdb-halt) for core stm32f4x.cpu
User : 217 13221 target.c:3054 handle_target(): Polling target stm32f4x.cpu 
failed, trying to reexamine
Debug: 218 13221 target.c:1838 target_call_event_callbacks(): target event 19 
(examine-start) for core stm32f4x.cpu
Error: 219 13221 mpsse.c:925 mpsse_flush(): libusb_handle_events() failed with 
L~~~
IBUSB_ERROR_NO_DEVICE
Debug: 220 13221 mpsse.c:423 mpsse_purge(): -
Error: 221 13221 mpsse.c:431 mpsse_purge(): unable to purge ftdi rx buffers: 
LIBUSB_ERROR_NO_DEVICE
Error: 222 13221 ftdi.c:656 ftdi_execute_queue(): error while flushing MPSSE 
queue: -4
Error: 223 13221 mpsse.c:925 mpsse_flush(): libusb_handle_events() failed with 
LIBUSB_ERROR_NO_DEVICE
Debug: 224 13221 mpsse.c:423 mpsse_purge(): -
Error: 225 13221 mpsse.c:431 mpsse_purge(): unable to purge ftdi rx buffers: 
LIBUSB_ERROR_NO_DEVICE
Error: 226 13221 ftdi.c:656 ftdi_execute_queue(): error while flushing MPSSE 
queue: -4
Error: 227 13222 mpsse.c:925 mpsse_flush(): libusb_handle_events() failed with 
LIBUSB_ERROR_NO_DEVICE
.....
~~~

It seems there is an endless-loop between the modules, but no shutdown if this 
error occures.
I looked for a forgotten parameter or setting, so that OpenOCD stops. But 
without success...

I'm a hardware developer, managed to configure OpenOCD to a working state. 
But I'm not a software developer.  I can't find the error and distribute it.
Could you please help me?

Best regards

Andreas Müller


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to