cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 - Unable to use PA15 as GPIO output pin

FredB
Associate II

I'm using an STM32H725ZE chip. I know that PA15 defaults to JTAG pin JTDI, but the datasheet for the part specifically says this:

In SW-DP mode, the unused JTAG lines JTDI, JTDO and nJTRST can be used for other

functions.

I'm in SWD mode because it's a custom PCB, and there are only two lines in the JTAG header and they are PA13 (SWDIO) and PA14 (SWCLK).

I'm using the LL library to control the GPIO. This is what I am using to set PA15 to be a GPIO output pin:

LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
 
   LL_GPIO_ResetOutputPin(GPIOA, GPIO_PIN_15);
 
   GPIO_InitStruct.Pin = GPIO_PIN_15;
   GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
   GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
   GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
   GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
   LL_GPIO_Init(GPIOA, &GPIO_InitStruct);

To test, I use this code. Yes, I know it's HAL code below and the init code is LL, but as you can see I am also toggling PA3 in this code and that works fine. This is just test code to see the pin wiggle, not what I'll do in the final code.

while(1){
        HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_15);
        HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_3);
        HAL_Delay(100); //delay 100ms
    }

The problem is PA15 doesn't change at all. PA3 toggles perfectly on my scope, but PA15 does nothing. Even more annoying, in the HAL toggle function it reads the output register and I can see the value correctly changing between 0 and 32768 (bit 15) on each call.

I've searched this forum and found nothing specific that helps. Can someone help me get PA15 to actually toggle?

5 REPLIES 5

Do you measure directly on pins (read: bad solder joint, disconnected jumpers)?

Read out and check/post content of GPIO registers.

JW

EmmanuelB
Associate

Hello,

I have a similar problème. Do you find a solution to toggle pa15?

Thanks

liaifat85
Senior III

Here I found a discussion about a similar problem.

https://www.stm32duino.com/viewtopic.php?t=713

Thank you for your help.

In the discussion the problem was solved with the use of enableDebugPorts();

This fonction allows to released PA15 from SWD. But when i try this on my STM32L4 it doesn't work => not declared in this scope.

does it need a specific lib?

 

 

Don' t hijack threads.

Start a new thread, stating what hardware and software are you using, what are the symptoms and how are they different from expectations.

JW