On STM32CubeProgrammer trying to connect to ST-Link module on STM32H7B3LI, I get this:
ST-LINK error (DEV_CONNECT_ERR)
Error: Problem occurred while trying to connect
I already tried installing the firmware here but it doesn't help: https://www.st.com/en/development-tools/stsw-link007.html
Update: I had skipped a necessary step in the firmware install process. However, I wanted to connect because the board has been refusing to connect by other means due to software messing with power settings, and so there's another error:
16:54:40 : ST-LINK SN : 0035002E3438510534313939
16:54:40 : ST-LINK FW : V3J8M3
16:54:40 : Board : STM32H7B3I-DK
16:54:40 : Voltage : 3.28V
16:54:41 : ST-LINK error (DEV_CONNECT_ERR)
16:54:41 : ST-LINK SN : 0035002E3438510534313939
16:54:41 : ST-LINK FW : V3J8M3
16:54:41 : Board : STM32H7B3I-DK
16:54:41 : Voltage : 3.28V
16:54:41 : Error: ST-LINK error (DEV_CONNECT_ERR)
When software reset is selected:
16:55:24 : ST-LINK SN : 0035002E3438510534313939
16:55:24 : ST-LINK FW : V3J8M3
16:55:24 : Board : STM32H7B3I-DK
16:55:24 : Voltage : 3.28V
16:55:24 : No STM32 target found!
16:55:24 : ST-LINK SN : 0035002E3438510534313939
16:55:24 : ST-LINK FW : V3J8M3
16:55:24 : Board : STM32H7B3I-DK
16:55:24 : Voltage : 3.28V
16:55:24 : Error: No STM32 target found!
I know this is an old question, but I had a similar problem, and I wasted 2 hrs solving it on Linux...
There are 2 potential causes for this:
Problem with a physical connection
Missing udev rule
Udev rule
What I found is that STM32CubeProgrammer is not adding the udev rules necessary for the controller...
From this post: https://wiki.st.com/stm32mpu/wiki/STM32CubeProgrammer#Preparing_the_USB_serial_link_for_flashing
#Install libusb
sudo apt-get install libusb-1.0-0 #For debian distributions
#Get udev rules from the STMCube
cd <your STM32CubeProgrammer install directory>/Drivers/rules
sudo cp *.* /etc/udev/rules.d/
#reload udev rules
sudo udevadm control --reload-rules
This worked for me on STM32CubeProgrammer 2.8.0 under Ubuntu 20.04, I hope it helps someone.
Related
Trying to debug ESP32-S3 with PlatformIO on VSCode with macOS on M1.
Installed ftdi drivers from their website. (installed the VCP drivers, not the D3XX ones as I couldn't find a way to compile and install them).
As ESP32-S3 has an internal debugger, I just created a USB that connects D-/D+ pins to the board gpio 19 and 20 (and grd). BTW, when I connect it to the macbook, I dont see any additional port under /dev/*
Getting the following error, regardless of my platform.ini configuration.
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
adapter speed: 5000 kHz
Info : tcl server disabled
Info : telnet server disabled
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'
.pioinit:11: Error in sourced command file:
Remote connection closed
My platformio.ini:
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
upload_port = /dev/cu.wchusbserial553C0085431
monitor_speed=115200
build_type = debug
debug_init_break = tbreak setup
;debug_tool = esp-builtin
debug_tool = esp-prog
Removed and installed the ftdi drivers.
Got a similar error when trying with ESP-IDF.
Any thoughts?
If you are connecting the USB conector directly on esp32s3 module, you should try to change the board parameter from esp32-s3-devkitc-1 to esp32s3-builtin. This way you specify that you are using the built-in debugger.
I have already read this, this and this but noone of them match my issue.
When I launch the debug option on the STM32CubeIDE 1.10.1 everything works well, the code is flashed, it works and I can easily debug everything. The only issue is that while flashing, I got the following message
Break at address "0x8002664" with no debug information available, or outside of program code.
To actually run the code after having flashed it, I have to press Resume (F8). The code, after having flashed it, should have a default breakpoint on the int main(void) { line. For some reason, my breakpoint is set at HAL_NVIC_ClearPendingIRQ(SysTick_IRQn); where
int main(void) {
//unsigned char a = 1;
uint32_t i = 0;
/* USER CODE BEGIN 1 */
//__disable_irq();
HAL_NVIC_ClearPendingIRQ(SysTick_IRQn);
My strtup file is correctly added under Startup folder as startup_stm32f091vbtx.s
The output of the debugger (I'm using a ST-Link/V2) is
STMicroelectronics ST-LINK GDB server. Version 7.0.0
Copyright (c) 2022, STMicroelectronics. All rights reserved.
Starting server with the following options:
Persistent Mode : Disabled
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled
InitWhile : Enabled
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
-------------------------------------------------------------------
STM32CubeProgrammer v2.11.0
-------------------------------------------------------------------
Log output file: C:\Users\...\STM32CubeProgrammer_a11308.log
ST-LINK SN : 55FF6D066684564926401687
ST-LINK FW : V2J39S7
Board : --
Voltage : 3.19V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x442
Revision ID : Rev 1.0
Device name : STM32F09x/F030xC
Flash size : 128 KBytes
Device type : MCU
Device CPU : Cortex-M0
BL Version : --
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a11308.srec
File : ST-LINK_GDB_server_a11308.srec
Size : 75.89 KB
Address : 0x08004000
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [8 45]
Download in Progress:
File download complete
Time elapsed during download operation: 00:00:03.654
Verifying ...
Download verified successfully
Shutting down...
Exit.
When i use ESP-IDF, use esp32-c3 board, i can`t frash, it show
OpenOCD Exit with non-zero error code 1
and output:
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
force hard breakpoints
adapter speed: 5000 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 6010, description '*', serial '*' at bus location '*'
❌ Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'
[Stopped] : OpenOCD Server
[how it was wrong][1]
[1]: https://i.stack.imgur.com/YushI.jpg
I try to rebuild and frash and it doesn`t word correctly.
How to fix it?
I managed to program and debug an STM32F4 Microcontroller, did some simple operations and wrote small scripts.
The setup
Microcontroller : STM32F405RG
Debug probe: I am using an old JTAGKEY2 by Amontec
Toolchain : openOCD & GDB on port 3333
I am not using any GUI and any specific soft tool.
The goal
Now I'd like to level up a little bit.
My project consists of 3 MCUs on a PCB working in redundancy.
I would like to debug Two or more STM32F4 and do some operations in one MCU while the others are halted. Here is an example :
Program all the devices (let's call them MCU1 & MCU2 ) with the same .elf .
Run.
Halt MCU1 & MCU2 at a specific timing ( like 10sec after running ).
Modify r4 of MCU1 only
Resume all targets.
For one MCU, I call the target config file smt32f4x.cfg.
For two MCUs, I read OpenOCD User's Guide and it seems that I have to create a new tap.
But first, I wanted to try to debug both MCU1 & MCU2 with the same config.
I wired the system in order to chain the MCUs on the bus, opened a terminal and typed openocd in my project folder.
The Issue
As expected I get this message:
Info : JTAG tap: STM32F405RGTx.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
Info : JTAG tap: auto0.tap tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: auto1.tap tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 4 -expected-id 0x4ba00477"
Warn : AUTO auto1.tap - use "jtag newtap auto1 tap -irlen 5 -expected-id 0x06413041"
Info : STM32F405RGTx.cpu: hardware has 6 breakpoints, 4 watchpoints
adapter speed: 2000 kHz
Info : JTAG tap: STM32F405RGTx.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: STM32F405RGTx.bs tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
Info : JTAG tap: auto0.tap tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4)
Info : JTAG tap: auto1.tap tap/device found: 0x06413041 (mfg: 0x020 (STMicroelectronics), part: 0x6413, ver: 0x0)
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000910 msp: 0x20020000
What happens then is that only one MCU is programmed.
So I think I might create a board config file and use
jtag newtap auto0 tap -irlen 4 -expected-id 0x4ba00477
and use one DAP per TAP ...
As I'm not confident with my skills I didn't manage to start my own config file from scratch.
And I didn't find config examples with several microcontrollers nor examples in gdb to give debug commands to different commands to different MCU on the bus.
The Questions
Where can I find Board config examples with several MCU?
Is it possible to give debug commands to only one of the devices under debug? How?
I did it using serial numbers of multiple st-links.
#To invoke without this script: openocd -s /share/openocd/scripts -f interface/stlink-v2-1.cfg -f target/stm32f1x.cfg
gdb_port 3334
tcl_port 6667
telnet_port 4445
#To run: openocd -s /share/openocd/scripts and then telnet localhost 4445
#To erase type into telnet: flash erase_sector 0 0 127
#To read device ID and Flash size type into telnet: flash probe 0
source [find interface/stlink-v2-1.cfg]
hla_serial \x56\x3F\x6E\x06\x66\x3F\x48\x55\x38\x57\x09\x67
transport select hla_swd
source stm32f1x-nores.cfg
reset_config none srst_nogate
Look at the hla_serial line. Each MCU has it's own st-link connected over SWD and each st-link has own oocd configuration with serial number and own port. Then launch oocd for each one and you will get GDB server per each MCU.
You can get serial number of st-link using lsusb -v command on Linux. Some clones do not have serial number and some need to be upgraded. Google will help you.
I was able to figure out how to program two micro controller using Openocd
I am currently using USB Bus Blaster V4 Dev Board which contains FT2232 USB to JTAG Converter IC.
My Setup consist of 2 STM32 MCU in daisy Chain configuration.
Since both the MCU have same tap IC i made board config file as suggested by the user guide on page number 22 section 6.2.1 as follows:
set CHIPNAME stm32master
source [find target/stm32f4x.cfg]
-# Chip #2: STM32F405 for Slave STM32, little endian
set CHIPNAME stm32slave
source [find target/stm32f4x.cfg]
gdb_memory_map disable
reset_config srst_only```
The command used for starting openocd is as follows:
sudo openocd -d2 -f interface/ftdi/dp_busblaster_kt-link.cfg -f board/stm32trail.cfg -c init -c scan_chain -c targets
My output after executing the above command in terminal is as follows:
The sequence in which I executed commands in telnet local host are as follows:
targets stm32master.cpu
halt
targets stm32slave.cpu
halt
flash erase_sector 0 0 7
flash write_image erase /home/nikhil/Downloads/Red_Led_C13.hex
verify_image /home/nikhil/Downloads/Red_Led_C13.hex
reset
targets stm32master.cpu
halt
flash erase_sector 0 0 7
flash write_image erase /home/nikhil/Downloads/Red_Led_C13.hex
verify_image /home/nikhil/Downloads/Red_Led_C13.hex
reset
I was able to program both MCU successfully .
I am trying to flash a blue-pill clone with a CS32F103C8T6 chip using the AC6 SystemWorkBench and a ST-LINK v2 device. It is a project built from STM32CubeMX - I am using a MacOS Mojave machine. Here is the output when trying to flash the device.
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 JTAG v31 API v2 SWIM v7 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.162004
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Warn : UNEXPECTED idcode: 0x2ba01477
Error: expected 1 of 1: 0x1ba01477
in procedure 'program'
in procedure 'init' called at file "embedded:startup.tcl", line 495
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked
I have googled and found some similar posts about it, but have no luck solving it.
Does anyone have an idea ?
mvh
Ole K Hornnes
In the OpenOCD config file, you need to add:
set CPUTAPID 0x2ba01477
I've never used AC6 SystemWorkbench and I don't now how you configure the board and the debug adapter in it. So I can't really tell where to look for the config file.
OpenOCD comes with an entire directory of board configurations, usually in a directory OpenOCD / scripts / board. It contains a script called stm32f103c8_blue_pill.cfg, which might be used in your case. Start there...
set CPUTAPID 0x2ba01477 ; Will work for the clone but not for the genuine STM32…
Instead use: set CPUTAPID 0
The zero tells OpenOCD to ignore the id number, so any MCU will then work…
Information Source: OpenOCD TAPs
C:\Ac6\SystemWorkbench\plugins\fr.ac6.mcu.debug_2.5.0.201904120827\resources\openocd\st_scripts\target\stm32f1x.cfg
add this line before first if statement
set CPUTAPID 0
it solves all openocd stlink id errors