Error target voltage may be too low for reliable debugging

Trying to flash a board that has one dead motor (even after replacement), I figured I have nothing to lose before I dump it. Getting this on the unlock step: $ openocd -f /usr/share/openocd/scripts...

@yuvadm

Trying to flash a board that has one dead motor (even after replacement), I figured I have nothing to lose before I dump it.

Getting this on the unlock step:

$ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f0x.cfg -c init -c "reset halt" -c "stm32f0x unlock 0" -c "reset run" -c shutdown
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v24 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 1.204813
Error: target voltage may be too low for reliable debugging
Error: init mode failed (unable to connect to the target)
in procedure 'init' 
in procedure 'ocd_bouncer'

The board boots and binds to the controller, just can’t fly due to one dead motor, so I would assume I can at least flash it with this firmware. Am I doing anything wrong?

Getting the same error no matter what pin / power combination I try.

I’m using https://www.banggood.com/ST-LINKV2-ST-LINK-V2CN-STLINK-Debugger-Emulator-Download-Manager-STM8-STM32-p-1099119.html

@silver13

I haven’t seen one of the «proper» st-links used before, but they should work. Are you powering the board with a battery when flashing?

I think you could connect the vcc pin from the st-link to the vcc pad of the board, but make sure it’s 3.3v because 5v will break the board.

Alternatively you could try the «stm32 st-link utility» on windows

@yuvadm

Yes I tried powering both with the VCC/VDD pin, as well as with the battery, and even both together — no working combination. Also weird that the target voltage is jumping up and down between ~1.2 and ~0.4 not exactly sure why.

@silver13

The st-link I use, I’m pretty sure does not have the voltage feature implemented

The ST documents show it uses a «VAPP» pin to detect voltage, I think that should be connected to a 3.3v source. The VDD pin provides power, so if this is connected, you don’t need to connect board battery.

Also remember the pads are marked in reverse on the blue board

@yuvadm

OK, some progress made. I powered the board from the battery, then connected GND-GND, DAT-CLK, CLK-DAT and then +3V-TVCC. After which I got this output:

$ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f0x.cfg -c init -c "reset halt" -c "stm32f0x unlock 0" -c "reset run" -c shutdown
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v24 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.781054
Info : stm32f0x.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
adapter speed: 950 kHz
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0xc1000003 pc: 0xfffffffe msp: 0xfffffffc
Info : device id = 0x10006444
Info : flash size = 16kbytes
Info : Device Security Bit Set
target halted due to breakpoint, current mode: Handler HardFault
xPSR: 0x61000003 pc: 0x2000003a msp: 0xfffffffc
stm32x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
adapter speed: 950 kHz
shutdown command invoked

After a power cycle the board won’t boot at all. Hmm..

@yuvadm

So it looks like it’s actually unlocked. Now trying to flash the actual firmware, getting this:

$ openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f0x.cfg -c init -c "reset halt" -c "flash write_image erase h8blue 0x08000000" -c "verify_image h8blue 0x08000000" -c "reset run" -c shutdown
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v24 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.785857
Info : stm32f0x.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
adapter speed: 950 kHz
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0xfffffffe msp: 0xfffffffc
auto erase enabled
Info : device id = 0x10006444
Info : flash size = 16kbytes
Warn : no flash bank found for address 10000000
wrote 0 bytes from file h8blue in 0.005447s (0.000 KiB/s)
Error: timed out while waiting for target halted
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x81000003 pc: 0xfffffffe msp: 0xffffffd8
Error: error executing cortex_m crc algorithm

@silver13

I’m not sure about this, it’s clearly supposed to use address 0x08000000 for flashing, but it tries address 10000000 for some reason.

I’m afraid this is probably above my pay grade to fix, you could try the st-link utility, I heard it might work under wine, too

@yuvadm

@silver13 no problem, thanks for trying to help out. I’ll just keep this updated for posterity’s sake.

@paulfertser

@yuvadm , just use h8blue.elf directly:
openocd -f interface/stlink.cfg -c "set FLASH_SIZE 32768" -f target/stm32f0x.cfg -c "program h8blue.elf verify reset exit"

@yuvadm

@paulfertser thanks! It’s been a while, will attempt this once I retrieve all the tools from cold storage 😆

@paulfertser

@yuvadm , feel free to ping me on #openocd IRC freenode channel for more interactive support :) I also wonder where that odd 0x10000000 address came from, it’d be interesting to see -d3 output for that case. And btw, I’ve added 3 «pull requests» to this blue board fork, you might want to take a look at it later. I recommend changing the ld script to use full 32KB of flash (device claims just 16 but the firmware already assumes it’s 32 when storing PIDs and calibration data).

Hi!

I am working with the crazyflie using the St-Link V2 and the debug adapter.
In the beginning everything was working fine, I could run «make openocd» and debug from another terminal window using «make gdb», I also run some python scripts that connected to openocd using telnet.

Suddenly and quickly things degraded and openocd started having problems connecting to the cf platform.
According to the openocd printouts it seems that the problem is the target voltage is too low: at most I get 1.54V (just enough to get it to start but then it fails soon after) but it is usually below 1V and close to 0V. I am not sure what it was before since I didn’t pay attention to it but it looks like it should be above 3V. I am not sure this is useful but the value 1.54V is the same that I get if I run «make openocd» and the crazyflie is unplugged. Otherwise with the crazyflie connected the terminal printouts looks something like this:

Code: Select all

openocd -d2 -f interface/stlink-v2.cfg  -f target/stm32f4x_stlink.cfg -c init -c targets -c "$_TARGETNAME configure -rtos auto"
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
WARNING: target/stm32f4x_stlink.cfg is deprecated, please switch to target/stm32f4x.cfg
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v37 API v2 SWIM v7 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 0.001567
Error: target voltage may be too low for reliable debugging
Error: init mode failed (unable to connect to the target)
in procedure 'init' 
in procedure 'ocd_bouncer'

make: *** [openocd] Error 1

or like this (when it manages to connect for short):

Code: Select all

openocd -d2 -f interface/stlink-v2.cfg  -f target/stm32f4x_stlink.cfg -c init -c targets -c "$_TARGETNAME configure -rtos auto"
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
WARNING: target/stm32f4x_stlink.cfg is deprecated, please switch to target/stm32f4x.cfg
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v37 API v2 SWIM v7 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 1.455353
Error: target voltage may be too low for reliable debugging
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 100ms
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 300ms
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f4x.cpu       hla_target little stm32f4x.cpu       unknown
Info : Previous state query failed, trying to reconnect
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, trying to reexamine
Examination failed, GDB will be halted. Polling again in 700ms

Following recommendations from several google searches I tried the following:
— I updated the stlink firmware
— I tried different firmware versions (it could have been some recent low power setting of the MCU, at the beginning I was using an older version of the firmware)
but the problem persists.
I thought it could be some contact in the cables that are wearing out, but everything is very new and seems in good condition.

I am using mac and tried also with your virtual machine but I get the same errors.

One thing that could have cause the problem is that I did try some «wild» and low-level memory writings through openocd, like for example:

but I guess it should be nothing that cannot be fixed by re-flashing the firmware, or am I wrong?
Do you have any guess on what I might have broken and how to fix it?
Any reset more radical than re-flashing the firmware that I could try?

Thanks a lot in advance for any help :)
Claudio


bardi


Posted by bardi
on 2015-07-13 18:02







Hi,

I have created a simple example using CubeMX for my STM32F446 target board. While MCU’s power is 3.3v, OpenOCD stops and says “Target voltage 0.95v , target voltage may be too low for reliable debugging”. Following are the outout console of GDB and OpenOCD.

I’m wondering that does SW 1.2 supports STM32F446 at all?

Could you please help me with this issue?


Thanks in advance

Bardi

—————

GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150304-cvs

Copyright (C) 2014 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law. Type “show copying”

and “show warranty” for details.

This GDB was configured as “host=i686-w64-mingw32 target=arm-none-eabi”.

Type “show configuration” for configuration details.

For bug reporting instructions, please see:

.

Find the GDB manual and other documentation resources online at:

.

For help, type “help”.

Type “apropos word” to search for commands related to “word”.

—————

Open On-Chip Debugger 0.9.0-dev-00415-g2d4ae3f-dirty (2015-04-22-11:10)

Licensed under GNU GPL v2

For bug reports, read

http://openocd.org/doc/doxygen/bugs.html

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

adapter speed: 2000 kHz

adapter_nsrst_delay: 100

none separate

srst_only separate srst_nogate srst_open_drain connect_deassert_srst

Info : Unable to match requested speed 2000 kHz, using 1800 kHz

Info : Unable to match requested speed 2000 kHz, using 1800 kHz

Info : clock speed 1800 kHz

Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748

Info : using stlink api v2

Info : Target voltage: 0.952702

Error: target voltage may be too low for reliable debugging

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

in procedure ‘init’

in procedure ‘ocd_bouncer’

  • Summary

  • Files

  • Reviews

  • Support

  • News

  • Donate

  • Mailing Lists

  • Tickets

  • Code

  • Gerrit Review

Menu

From: Jeff Sponaugle <je…@sp…> — 2019-05-06 18:46:11

I'm not sure if this problem is something that should be reported to the
OpenOCD team, or the OpenSTM32 team.

I ran into an interesting problem when flashing an embedded STM32H750 on
one of my project boards. The flash process works, but an error is reported:

Open On-Chip Debugger 0.10.0+dev-00021-g524e8c8 (2019-04-12-08:42)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : The selected transport took over low-level target control. The
results might differ compared to plain JTAG/SWD
adapter speed: 8000 kHz
adapter_nsrst_delay: 100
Info : clock speed 8000 kHz
Info : STLINK v2.1 JTAG v33 API v2 M25 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 0.022004
Error: target voltage may be too low for reliable debugging
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Info : STM32H750VBTx.cpu0: hardware has 8 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080031ac msp: 0x20020000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
** Programming Started **
auto erase enabled
Info : Device: STM32H7xx 2M
Info : flash size probed value 128
Info : STM32H flash size is 128kb, base address is 0x8000000
wrote 131072 bytes from file Debug/EmboardV1.elf in 1.930074s (66.319 KiB/s)
** Programming Finished **
** Verify Started **
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20020000
verified 12984 bytes in 0.094487s (134.195 KiB/s)
** Verified OK **
** Resetting Target **
Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed
mem_helper.tcl:6: Error:
in procedure 'program'
in procedure 'reset' called at file "embedded:startup.tcl", line 532
in procedure 'ocd_bouncer'
in procedure 'ocd_process_reset'
in procedure 'ocd_process_reset_inner' called at file
"embedded:startup.tcl", line 248
in procedure 'STM32H750VBTx.cpu0' called at file "embedded:startup.tcl",
line 388
in procedure 'ocd_bouncer'
in procedure 'mmw'
in procedure 'mrw' called at file
"/Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/mem_helper.tcl",
line 25
at file
"/Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/mem_helper.tcl",
line 6
shutdown command invoked

Looking at the above trace you can see:
"Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed" is the item of
interest.

If I switch from my project board to a Nucleo STM32H743 based board the
same code flashed without this error. One difference between the boards is
that my board only supports SWD, while the Nucleo board supports both SWD
and JTAG.


After a bit of digging I was able to find the references that were driving
the mem2array calls in stm32h7x.cfg (located at
/Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/target)
which has a number of references to memory locations in the 0x5C00xxxx
range. In looking that the data sheet for the STM32H7xx that memory area is
the hardware debug and trace registers. *The critical thing of note in the
data sheet is the mention that the 0x5C00xxxx addresses are only
addressable from the system data bus. If access is performed from the
‘debug interface’ you need to use 0xE00Fxxxx instead.*

I tried changing all of the memory references in that config file to 0xE00F
from the 0cx5C00 addresses, and the error goes away when flashing my board.

I am suspecting that the error does not occur with the nucleo board because
the JTAG interface allows access via the system bus, while the SWD
interface only allows access via the debug interface.

It would seem a change would need to be made to that config interface to
use the correct addresses based on the particulars of the interface.

Does anyone know if I am understanding this correctly?


Jeff

From: Tarek BOUCHKATI <tarek…@st…> — 2019-05-20 12:20:15

Hi Jeff,


>> ** Resetting Target **
>> Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed


In fact you got the issue, because the DBGMCU CR register cannot be read from AP0 while SRST is asserted.

So maybe you could retry by setting reset_config to none.



>> I tried changing all of the memory references in that config file to 0xE00F from the 0cx5C00 addresses,

>> and the error goes away when flashing my board.



I’m afraid that this does not solve the issue, in fact the DBGMCU registers should be accessed at offset 0x5c001000 if you are using AP0, and if you are willing to use the AP2, the offset 0xe00e1000 should be used.

So just changing the address does not solve the issue, you should select the AP2 also.

Please take a look at this patch : http://openocd.zylin.com/#/c/4742/ that tries to solve this issue.

But this won’t work with the current implementation of ST-Link as HLA adapter (no muti-AP support).



Tarek


From: Jeff Sponaugle <je...@sp...>
Sent: Monday, May 6, 2019 7:21 PM
To: openo...@li...
Subject: [OpenOCD-user] Flashing problem with STM32H750

I'm not sure if this problem is something that should be reported to the OpenOCD team, or the OpenSTM32 team.
I ran into an interesting problem when flashing an embedded STM32H750 on one of my project boards. The flash process works, but an error is reported:

Open On-Chip Debugger 0.10.0+dev-00021-g524e8c8 (2019-04-12-08:42)
Licensed under GNU GPL v2
For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 8000 kHz
adapter_nsrst_delay: 100
Info : clock speed 8000 kHz
Info : STLINK v2.1 JTAG v33 API v2 M25 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 0.022004
Error: target voltage may be too low for reliable debugging
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Info : STM32H750VBTx.cpu0: hardware has 8 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080031ac msp: 0x20020000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
** Programming Started **
auto erase enabled
Info : Device: STM32H7xx 2M
Info : flash size probed value 128
Info : STM32H flash size is 128kb, base address is 0x8000000
wrote 131072 bytes from file Debug/EmboardV1.elf in 1.930074s (66.319 KiB/s)
** Programming Finished **
** Verify Started **
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20020000
verified 12984 bytes in 0.094487s (134.195 KiB/s)
** Verified OK **
** Resetting Target **
Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed
mem_helper.tcl:6: Error:
in procedure 'program'
in procedure 'reset' called at file "embedded:startup.tcl", line 532
in procedure 'ocd_bouncer'
in procedure 'ocd_process_reset'
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 248
in procedure 'STM32H750VBTx.cpu0' called at file "embedded:startup.tcl", line 388
in procedure 'ocd_bouncer'
in procedure 'mmw'
in procedure 'mrw' called at file "/Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/mem_helper.tcl", line 25
at file "/Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/mem_helper.tcl", line 6
shutdown command invoked

Looking at the above trace you can see:
"Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed" is the item of interest.

If I switch from my project board to a Nucleo STM32H743 based board the same code flashed without this error. One difference between the boards is that my board only supports SWD, while the Nucleo board supports both SWD and JTAG.

After a bit of digging I was able to find the references that were driving the mem2array calls in stm32h7x.cfg (located at /Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/target) which has a number of references to memory locations in the 0x5C00xxxx range. In looking that the data sheet for the STM32H7xx that memory area is the hardware debug and trace registers. The critical thing of note in the data sheet is the mention that the 0x5C00xxxx addresses are only addressable from the system data bus. If access is performed from the ‘debug interface’ you need to use 0xE00Fxxxx instead.

I tried changing all of the memory references in that config file to 0xE00F from the 0cx5C00 addresses, and the error goes away when flashing my board.

I am suspecting that the error does not occur with the nucleo board because the JTAG interface allows access via the system bus, while the SWD interface only allows access via the debug interface.

It would seem a change would need to be made to that config interface to use the correct addresses based on the particulars of the interface.

Does anyone know if I am understanding this correctly?



Jeff





From: Jeff Sponaugle <je…@sp…> — 2019-07-06 02:58:11

Thanks for the explanation Tarek.  I didn't catch the multiple access ports
issue, but now it makes sense.  I should have paid more attention to that
part of the data sheet.     Just curious, but the reason I didn't get the
same errors when flashing the same chip on the ST produced Nucleo STM32H743
board is because the config for that board perhaps has the reset_config set
to none?

Thanks for the explanation and suggestions.. much appreciated!

Jeff



On Mon, May 20, 2019 at 4:57 AM Tarek BOUCHKATI <tarek...@st...>
wrote:

> Hi Jeff,
>
>
>
> >> ** Resetting Target **
>
> >> Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed
>
>
>
> In fact you got the issue, because the DBGMCU CR register cannot be read
> from AP0 while SRST is asserted.
>
> So maybe you could retry by setting reset_config to none.
>
>
>
> >> I tried changing all of the memory references in that config file to
> 0xE00F from the 0cx5C00 addresses,
>
> >> and the error goes away when flashing my board.
>
>
>
> I’m afraid that this does not solve the issue, in fact the DBGMCU
> registers should be accessed at offset 0x5c001000 if you are using AP0, and
> if you are willing to use the AP2, the offset 0xe00e1000 should be used.
>
> So just changing the address does not solve the issue, you should select
> the AP2 also.
>
> Please take a look at this patch : http://openocd.zylin.com/#/c/4742/ that
> tries to solve this issue.
>
> But this won’t work with the current implementation of ST-Link as HLA
> adapter (no muti-AP support).
>
>
>
> Tarek
>
>
>
> *From:* Jeff Sponaugle <je...@sp...>
> *Sent:* Monday, May 6, 2019 7:21 PM
> *To:* openo...@li...
> *Subject:* [OpenOCD-user] Flashing problem with STM32H750
>
>
>
> I'm not sure if this problem is something that should be reported to the
> OpenOCD team, or the OpenSTM32 team.
>
> I ran into an interesting problem when flashing an embedded STM32H750 on
> one of my project boards. The flash process works, but an error is reported:
>
>
>
> Open On-Chip Debugger 0.10.0+dev-00021-g524e8c8 (2019-04-12-08:42)
>
> Licensed under GNU GPL v2
>
> For bug reports, read
>
>             http://openocd.org/doc/doxygen/bugs.html
>
> srst_only separate srst_nogate srst_open_drain connect_assert_srst
>
> Info : The selected transport took over low-level target control. The
> results might differ compared to plain JTAG/SWD
>
> adapter speed: 8000 kHz
>
> adapter_nsrst_delay: 100
>
> Info : clock speed 8000 kHz
>
> Info : STLINK v2.1 JTAG v33 API v2 M25 VID 0x0483 PID 0x374B
>
> Info : using stlink api v2
>
> Info : Target voltage: 0.022004
>
> Error: target voltage may be too low for reliable debugging
>
> Info : Unable to match requested speed 8000 kHz, using 4000 kHz
>
> Info : Stlink adapter speed set to 4000 kHz
>
> Info : STM32H750VBTx.cpu0: hardware has 8 breakpoints, 4 watchpoints
>
> Info : Listening on port 3333 for gdb connections
>
> target halted due to debug-request, current mode: Thread
>
> xPSR: 0x01000000 pc: 0x080031ac msp: 0x20020000
>
> Info : Unable to match requested speed 8000 kHz, using 4000 kHz
>
> Info : Stlink adapter speed set to 4000 kHz
>
> Info : Unable to match requested speed 8000 kHz, using 4000 kHz
>
> adapter speed: 4000 kHz
>
> ** Programming Started **
>
> auto erase enabled
>
> Info : Device: STM32H7xx 2M
>
> Info : flash size probed value 128
>
> Info : STM32H flash size is 128kb, base address is 0x8000000
>
> wrote 131072 bytes from file Debug/EmboardV1.elf in 1.930074s (66.319
> KiB/s)
>
> ** Programming Finished **
>
> ** Verify Started **
>
> target halted due to breakpoint, current mode: Thread
>
> xPSR: 0x61000000 pc: 0x2000002e msp: 0x20020000
>
> verified 12984 bytes in 0.094487s (134.195 KiB/s)
>
> ** Verified OK **
>
> ** Resetting Target **
>
> Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed
>
> mem_helper.tcl:6: Error:
>
> in procedure 'program'
>
> in procedure 'reset' called at file "embedded:startup.tcl", line 532
>
> in procedure 'ocd_bouncer'
>
> in procedure 'ocd_process_reset'
>
> in procedure 'ocd_process_reset_inner' called at file
> "embedded:startup.tcl", line 248
>
> in procedure 'STM32H750VBTx.cpu0' called at file "embedded:startup.tcl",
> line 388
>
> in procedure 'ocd_bouncer'
>
> in procedure 'mmw'
>
> in procedure 'mrw' called at file
> "/Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/mem_helper.tcl",
> line 25
>
> at file
> "/Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/mem_helper.tcl",
> line 6
>
> shutdown command invoked
>
>
>
> Looking at the above trace you can see:
>
> "Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed" is the item of
> interest.
>
>
>
> If I switch from my project board to a Nucleo STM32H743 based board the
> same code flashed without this error. One difference between the boards is
> that my board only supports SWD, while the Nucleo board supports both SWD
> and JTAG.
>
>
> After a bit of digging I was able to find the references that were driving
> the mem2array calls in stm32h7x.cfg (located at
> /Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/target)
> which has a number of references to memory locations in the 0x5C00xxxx
> range. In looking that the data sheet for the STM32H7xx that memory area is
> the hardware debug and trace registers. *The critical thing of note in
> the data sheet is the mention that the 0x5C00xxxx addresses are only
> addressable from the system data bus. If access is performed from the
> ‘debug interface’ you need to use 0xE00Fxxxx instead.*
>
> I tried changing all of the memory references in that config file to
> 0xE00F from the 0cx5C00 addresses, and the error goes away when flashing my
> board.
>
> I am suspecting that the error does not occur with the nucleo board
> because the JTAG interface allows access via the system bus, while the SWD
> interface only allows access via the debug interface.
>
> It would seem a change would need to be made to that config interface to
> use the correct addresses based on the particulars of the interface.
>
> Does anyone know if I am understanding this correctly?
>
>
>
> Jeff
>
>
>
>
>
>
>
>
>
>
>

From: Tarek BOUCHKATI <tarek…@st…> — 2019-07-08 15:01:36

I agree setting reset_config to none hides this behavior.
But it does not reset the target before establishing the connection.

If you are curious : I suggest to use this patch #4742 with a NON-HLA adapter (like cmsis-dap)
or apply the adapter-driver patches to be able to use it with stlink (recommended head : #4904)

Tarek


From: Jeff Sponaugle <je...@sp...>
Sent: Saturday, July 6, 2019 3:30 AM
To: Tarek BOUCHKATI <tarek...@st...>
Cc: openo...@li...
Subject: Re: [OpenOCD-user] Flashing problem with STM32H750

Thanks for the explanation Tarek.  I didn't catch the multiple access ports issue, but now it makes sense.  I should have paid more attention to that part of the data sheet.     Just curious, but the reason I didn't get the same errors when flashing the same chip on the ST produced Nucleo STM32H743 board is because the config for that board perhaps has the reset_config set to none?

Thanks for the explanation and suggestions.. much appreciated!

Jeff



On Mon, May 20, 2019 at 4:57 AM Tarek BOUCHKATI <tarek...@st...<mailto:tarek...@st...>> wrote:

Hi Jeff,


>> ** Resetting Target **
>> Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed


In fact you got the issue, because the DBGMCU CR register cannot be read from AP0 while SRST is asserted.

So maybe you could retry by setting reset_config to none.



>> I tried changing all of the memory references in that config file to 0xE00F from the 0cx5C00 addresses,

>> and the error goes away when flashing my board.



I’m afraid that this does not solve the issue, in fact the DBGMCU registers should be accessed at offset 0x5c001000 if you are using AP0, and if you are willing to use the AP2, the offset 0xe00e1000 should be used.

So just changing the address does not solve the issue, you should select the AP2 also.

Please take a look at this patch : http://openocd.zylin.com/#/c/4742/ that tries to solve this issue.

But this won’t work with the current implementation of ST-Link as HLA adapter (no muti-AP support).



Tarek


From: Jeff Sponaugle <je...@sp...<mailto:je...@sp...>>
Sent: Monday, May 6, 2019 7:21 PM
To: openo...@li...<mailto:openo...@li...>
Subject: [OpenOCD-user] Flashing problem with STM32H750

I'm not sure if this problem is something that should be reported to the OpenOCD team, or the OpenSTM32 team.
I ran into an interesting problem when flashing an embedded STM32H750 on one of my project boards. The flash process works, but an error is reported:

Open On-Chip Debugger 0.10.0+dev-00021-g524e8c8 (2019-04-12-08:42)
Licensed under GNU GPL v2
For bug reports, read
            http://openocd.org/doc/doxygen/bugs.html
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 8000 kHz
adapter_nsrst_delay: 100
Info : clock speed 8000 kHz
Info : STLINK v2.1 JTAG v33 API v2 M25 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 0.022004
Error: target voltage may be too low for reliable debugging
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Info : STM32H750VBTx.cpu0: hardware has 8 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080031ac msp: 0x20020000
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
adapter speed: 4000 kHz
** Programming Started **
auto erase enabled
Info : Device: STM32H7xx 2M
Info : flash size probed value 128
Info : STM32H flash size is 128kb, base address is 0x8000000
wrote 131072 bytes from file Debug/EmboardV1.elf in 1.930074s (66.319 KiB/s)
** Programming Finished **
** Verify Started **
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20020000
verified 12984 bytes in 0.094487s (134.195 KiB/s)
** Verified OK **
** Resetting Target **
Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed
mem_helper.tcl:6: Error:
in procedure 'program'
in procedure 'reset' called at file "embedded:startup.tcl", line 532
in procedure 'ocd_bouncer'
in procedure 'ocd_process_reset'
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 248
in procedure 'STM32H750VBTx.cpu0' called at file "embedded:startup.tcl", line 388
in procedure 'ocd_bouncer'
in procedure 'mmw'
in procedure 'mrw' called at file "/Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/mem_helper.tcl", line 25
at file "/Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/mem_helper.tcl", line 6
shutdown command invoked

Looking at the above trace you can see:
"Error: mem2array: Read @ 0x5c001004, w=4, cnt=1, failed" is the item of interest.

If I switch from my project board to a Nucleo STM32H743 based board the same code flashed without this error. One difference between the boards is that my board only supports SWD, while the Nucleo board supports both SWD and JTAG.

After a bit of digging I was able to find the references that were driving the mem2array calls in stm32h7x.cfg (located at /Applications/Ac6/SystemWorkbench.app/Contents/Eclipse/plugins/fr.ac6.mcu.debug_2.5.0.201904120827/resources/openocd/st_scripts/target) which has a number of references to memory locations in the 0x5C00xxxx range. In looking that the data sheet for the STM32H7xx that memory area is the hardware debug and trace registers. The critical thing of note in the data sheet is the mention that the 0x5C00xxxx addresses are only addressable from the system data bus. If access is performed from the ‘debug interface’ you need to use 0xE00Fxxxx instead.

I tried changing all of the memory references in that config file to 0xE00F from the 0cx5C00 addresses, and the error goes away when flashing my board.

I am suspecting that the error does not occur with the nucleo board because the JTAG interface allows access via the system bus, while the SWD interface only allows access via the debug interface.

It would seem a change would need to be made to that config interface to use the correct addresses based on the particulars of the interface.

Does anyone know if I am understanding this correctly?



Jeff





Понравилась статья? Поделить с друзьями:
  • Error target not halted
  • Error target not found arch
  • Error target label does not exist
  • Error target dll has been cancelled debugger aborted
  • Error tale скачать на русском