SWDIO Signal High by default #11
-
Hello majbthrd, this project helped me a lot, thank you very much! I noticed that the SWDIO pin stays Hi-Z/ in input mode after powering up my board, and only switches to high when I connect via openocd. I guess this behaviour is intended, but it also prevents some target microcontrollers from booting. Thanks for any reply |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You're welcome. line 43 of main.c calls the function DAP_Setup(); this is some of the earliest code to run. Said function can be found in ./bsp/target/DAP_config.h where target is the name of the target you are compiling for (e.g. rp2040, stm32f072disco, etc.). You could modify this to initialize the pins however you want to for your application. Consult the RP2040 datasheet, not me, on the GPIO peripheral (Chapter 19) specifics. I'll just point out that if you are depending on the debugger to control SWDIO so that the board operates, then perhaps the board design needs to be improved? What should make configuring the pins as inputs "safe" is that it should be equivalent to the SWD connector being disconnected. A board design should be able to operate without the debugger connected. Of the top of my head, an example microcontroller that needs special treatment of SWD pins is the Atmel SAMD. In that case, SWCLK needs to be high, and the datasheet has clear instructions (Section 45.7 of the SAM D21/DA1 datasheet) that there should be a 1kOhm pull-up for SWCLK on the board design for "reliable operations". |
Beta Was this translation helpful? Give feedback.
You're welcome.
line 43 of main.c calls the function DAP_Setup(); this is some of the earliest code to run.
Said function can be found in ./bsp/target/DAP_config.h where target is the name of the target you are compiling for (e.g. rp2040, stm32f072disco, etc.).
You could modify this to initialize the pins however you want to for your application. Consult the RP2040 datasheet, not me, on the GPIO peripheral (Chapter 19) specifics.
I'll just point out that if you are depending on the debugger to control SWDIO so that the board operates, then perhaps the board design needs to be improved? What should make configuring the pins as inputs "safe" is that it should be equivalent to the SWD connec…