|
From: Leonardo S. d. S. <leo...@gm...> - 2017-04-02 12:10:28
|
Hello Paul, Sorry for hijacking this thread, but I ran into this exact situation a while ago and hopefully you can give me some pointers. On Sun, Apr 2, 2017 at 9:53 AM, Paul Fertser <fer...@gm...> wrote: > > Some target firmware might require you to connect under reset or to > connect while the target stays in the bootloader. For the former, you > need to connect hardware SRST line between the adapter and the target > and add -c "reset_config srst_only connect_assert_srst" before -c > "program..." parameter. For the latter, just pull the BOOTx pins > accordingly externally with jumpers. > The smaller STM32L0 parts have what's called empty device detection (if Flash is empty, run the factory bootloader regardless of BOOT0 pin state). On the lowest pin-count package (TSSOP14) the bootloader firmware *apparently* reconfigures the SW debug lines to an alternate function, so the options are connect under reset or not at all. I've generally had trouble connecting under reset without using "hacks". One trick that has worked is holding the reset button and releasing it just as OpenOCD executes the reset halt command. Using connect_assert_srst causes a timeout during reset halt (I've seen this in different STM32 parts). Attached part of a -d3 output below. The MCU is an STM32F103 (it's what I have on the bench right now) using OpenOCD 0.10.0 with an inexpensive cmsisdap adapter. Any suggestions of possible causes / things to try? Regards, Leonardo -------------------------------------------------------------------------- ..... Debug: 757 516 cmsis_dap_usb.c:599 cmsis_dap_swd_run_queue(): Executing 2 queued transactions Debug: 758 516 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): AP write reg 4 e0001058 Debug: 759 517 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): AP write reg c 0 Debug: 760 519 cmsis_dap_usb.c:599 cmsis_dap_swd_run_queue(): Executing 0 queued transactions Debug: 761 519 cmsis_dap_usb.c:599 cmsis_dap_swd_run_queue(): Executing 5 queued transactions Debug: 762 519 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): AP write reg 0 a2000002 Debug: 763 520 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): AP write reg 4 e000edf0 Debug: 764 520 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): DP write reg 8 10 Debug: 765 520 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): AP read reg 0 0 Debug: 766 521 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): DP read reg c 0 Debug: 767 523 cmsis_dap_usb.c:677 cmsis_dap_swd_run_queue(): Read result: 1010001 Debug: 768 523 cmsis_dap_usb.c:677 cmsis_dap_swd_run_queue(): Read result: 1010001 Debug: 769 523 target.c:2802 target_wait_state(): waiting for target halted... Debug: 770 524 cmsis_dap_usb.c:599 cmsis_dap_swd_run_queue(): Executing 2 queued transactions Debug: 771 524 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): AP read reg 0 0 Debug: 772 524 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): DP read reg c 0 Debug: 773 526 cmsis_dap_usb.c:677 cmsis_dap_swd_run_queue(): Read result: 1010001 Debug: 774 528 cmsis_dap_usb.c:677 cmsis_dap_swd_run_queue(): Read result: 1010001 ...... [the last 5 lines above repeated many times] ..... Debug: 2312 1521 cmsis_dap_usb.c:599 cmsis_dap_swd_run_queue(): Executing 2 queued transactions Debug: 2313 1521 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): AP read reg 0 0 Debug: 2314 1521 cmsis_dap_usb.c:622 cmsis_dap_swd_run_queue(): DP read reg c 0 Debug: 2315 1524 cmsis_dap_usb.c:677 cmsis_dap_swd_run_queue(): Read result: 1010001 Debug: 2316 1524 cmsis_dap_usb.c:677 cmsis_dap_swd_run_queue(): Read result: 1010001 Error: 2317 1524 target.c:2810 target_wait_state(): timed out while waiting for target halted Debug: 2318 1524 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_stm32f0.cpu curstate Debug: 2319 1524 command.c:143 script_debug(): command - ocd_stm32f0.cpu ocd_stm32f0.cpu curstate User : 2320 1525 command.c:544 command_print(): TARGET: stm32f0.cpu - Not halted ..... |