Skip to main content
Rob Meades
Senior
August 22, 2021
Solved

Solved; STM32F437VG: remove AF for a JTAG pin (pin 0x0F) make it be a GPIO.

I use `HAL_GPIO_Init()` to configure my GPIO pins, setting my `GPIO_InitTypeDef` structure initially to zero and then configuring the Pin, Mode, Pull and Speed parameters as I require but leaving Alternate at 0 since I do not want an Alternate function, I want a GPIO.

This works fine for all of my pins except for pin 0x0f which is pre-assigned to use Alternate function 0 (for JTAG): calling `HAL_GPIO_Init()` as described above does nothing useful for this pin, it never becomes the output I'm trying to make it (the pin remains firmly at 0 V when measured after having been set to high with `HAL_GPIO_WritePin()`). I guess this is because it is by default using Alternate function zero and somehow needs to be told NOT to use that Alternate function, to just be a GPIO please.

How do I achieve that? The config settings I am passing to `HAL_GPIO_Init()` to try to set this pin to be an open-drain output are as below.

Pin	0x8000	
Mode	0x11
Pull	0x00	
Speed	0x00	
Alt	0x00

I've searched these forums and find mentions of functions/macros that disable JTAG but a search of the HAL (v1.25.0) for "jtag" finds no such functions. What am I missing?

This topic has been closed for replies.
Rob Meades
Rob MeadesBest answer
Senior
August 22, 2021

S'OK turns out that it *was* working, just that the HW attached to that pin needed push-pull not open drain output. All solved!

1 reply

Rob Meades
Rob MeadesAuthorBest answer
Senior
August 22, 2021

S'OK turns out that it *was* working, just that the HW attached to that pin needed push-pull not open drain output. All solved!