2024-11-19 04:15 PM - edited 2024-11-21 01:20 PM
Hi,
at the moment on the STM32U5G9 we have the SWD pins (SWDIO and SWCLK) set to DEBUG, but we would like to also use them as GPIO after programming.
How do we switch them to GPIO at runtime?
Thank you
Solved! Go to Solution.
2024-11-23 03:35 AM
Dear @Ricko ,
You can by software anytime at your application change the GPIOA_MODER to either Input or Output as below
then also to remove or keep the internal pull-up/down resistors . Routing these signals also is important at PCB as they share with Debug connector or test points .
hope it helps you,
STOne-32
2024-11-23 03:35 AM
Dear @Ricko ,
You can by software anytime at your application change the GPIOA_MODER to either Input or Output as below
then also to remove or keep the internal pull-up/down resistors . Routing these signals also is important at PCB as they share with Debug connector or test points .
hope it helps you,
STOne-32
2024-11-23 05:00 AM
You can use normal init as for any other pins, but on moment init is executed, debuger lost connection.
2024-11-23 05:46 AM
@Ricko wrote:we would like to also use them as GPIO after programming.
I would strongly advise against doing that!
as @MM..1 said, that means you will have no debug access.
If you must, then be sure to include access to NRST in your debug connector - otherwise you won't even be able to connect for programming.
Also, put in a time delay after startup before you re-purpose the pins - to give a chance to connect.
2024-11-23 01:53 PM
Thank you all ! :)
Good point about the NRST. I do have it connected already because I thought you always need it for programming.