zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.75k stars 6.56k forks source link

SWD not working on STM32F405 #53385

Closed xingrz closed 1 year ago

xingrz commented 1 year ago

Describe the bug

branch: v3.2 board: adafruit_feather_stm32f405

While running the hello_world sample application on STM32F405, the SWD debug port stops responding any commands. I've learnt something like CONFIG_GPIO_STM32_SWJ_DISABLE on STM32F1, which was used to remap SWJ ports to GPIOs. But this config is not available on STM32F4. Was I missed something?

To Reproduce

cd samples/hello_world
west build -b adafruit_feather_stm32f405
west flash -r dfu-util
pyocd reset --pack=/path/to/Keil.STM32F4xx_DFP.2.16.0.pack --target stm32f405rg -vv

Expected behavior

The MCU should be reset.

Impact

This stop me from using pyocd as a runner, unless manually pulling up BOOT0 to enter DFU mode.

Logs and console output

0001375 D Project directory: *** [session]
0001983 D Project directory: *** [session]
0001989 D CMSIS-DAP v2 probe ***: firmware version 0258, protocol version 2.1.0 [dap_access_cmsis_dap]
0002027 D flash algo: [code=0x14c] [b1=0x150,0x550] [b2=0x550,0x950] [stack=0x2950; 0x2000 b] (ram=0x20000000, 0x20000 b) [flash_algo]
0002030 I Target type is stm32f405rg [board]
0002035 D Board: TILE TILEDAP [cmsis_dap_probe]
0002035 D Target: STMicroelectronics STM32F103RB [cmsis_dap_probe]
0002036 D Running task load_svd [sequencer]
0002090 D Running task pre_connect [sequencer]
0002091 D Running task dp_init [sequencer]
0002091 D Running task lock_probe [sequencer]
0002091 D Running task get_probe_capabilities [sequencer]
0002091 D Running task connect [sequencer]
0002160 D Default wire protocol selected; using SWD [dap]
0002172 D Sending deprecated SWJ sequence to select SWD [swj]
0002174 I DP IDR = 0x2ba01477 (v1 rev2) [dap]
0002174 D Running task clear_sticky_err [sequencer]
0002174 D Running task power_up_debug [sequencer]
0002175 D Running task check_version [sequencer]
0002175 D Running task unlock_probe [sequencer]
0002175 D Running task create_discoverer [sequencer]
0002175 D Running task discovery [sequencer]
0002175 D Running task find_aps [sequencer]
0002177 D Running task create_aps [sequencer]
0002177 D Running task create_ap.0 [sequencer]
0002178 I AHB-AP#0 IDR = 0x24770011 (AHB-AP var1 rev2) [ap]
0002179 D AHB-AP#0 default HPROT=3 HNONSEC=0 [ap]
0002180 D AHB-AP#0 implemented HPROT=3 HNONSEC=0 [ap]
0002181 D Running task find_components [sequencer]
0002181 D Running task init_ap.0 [sequencer]
0002182 E Transfer error while reading AHB-AP#0 ROM table: No ACK received [ap]
0002183 D Running task create_cores [sequencer]
0002183 D Running task set_default_reset_type [sequencer]
0002184 D Running task create_components [sequencer]
0002184 D Running task check_for_cores [sequencer]
0002184 D uninit session <pyocd.core.session.Session object at 0x10e907d30> [session]
0002184 C No cores were discovered! [__main__]

Environment (please complete the following information):

xingrz commented 1 year ago

Oops, it turns out my SWD cables were just too long! Sorry about that. Thank you for your help and sorry for the inconvenience.