Search code examples
armembeddedstm32microcontrollerzephyr-rtos

target not halted error when flashing sample into stm32


I have the stm32 nucleo board wb55rg and am trying to flash some examples into it like blinky and a custom sample, but when am trying to flash the project into the board after building it, I am getting the same error (timed out while waiting for target halded) and I dont know how to deal with it. I was searching on internet and I found some info's about OCD and I didn't really understand. I am not using STMCubeIDE only zephyr's sample blinky. Can anyone help me with that ? I am using linux OS from VM box and a simple blinky sample from zephyr.

My steps are:

    west build -b nucleo_wb55rg samples/basic/blinky ( building project )
    west flash 

ERROR message

-- west flash: rebuilding
[0/1] cd /home/nikos/Desktop/my_try/bu.../cmake/flash && /usr/bin/cmake -E echo

-- west flash: using runner openocd
-- runners.openocd: Flashing file: /home/nikos/Desktop/my_try/build/zephyr/zephyr.hex
Open On-Chip Debugger 0.10.0+dev-01508-gf79c90268-dirty (2021-03-26-16:13)
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
srst_only separate srst_nogate srst_open_drain connect_deassert_srst

Info : clock speed 500 kHz
Info : STLINK V2J37M26 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.229148
Info : stm32wbx.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32wbx.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32wbx.cpu       hla_target little stm32wbx.cpu       running

Info : Unable to match requested speed 500 kHz, using 480 kHz
Info : Unable to match requested speed 500 kHz, using 480 kHz
Error: timed out while waiting for target halted
TARGET: stm32wbx.cpu - Not halted
FATAL ERROR: command exited with status 1: /home/nikos/zephyr-sdk-0.12.4/sysroots/x86_64-pokysdk-linux/usr/bin/openocd -s /home/nikos/zephyrproject/zephyr/boards/arm/nucleo_wb55rg/support -s /home/nikos/zephyr-sdk-0.12.4/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -f /home/nikos/zephyrproject/zephyr/boards/arm/nucleo_wb55rg/support/openocd.cfg -c init -c targets -c 'reset halt' -c 'flash write_image erase /home/nikos/Desktop/my_try/build/zephyr/zephyr.hex' -c 'reset halt' -c 'verify_image /home/nikos/Desktop/my_try/build/zephyr/zephyr.hex' -c 'reset run' -c shutdown

Solution

  • I have found the problem of this issue. This board was used its previous owner has changed some togle pins on the board. So I searched for the default pins of stm32wb55rg and when I set the default pins the error was solved. Thanks a lot everyone who has made a reply to this post in order to help me find out what was going on.