This page will reveal some topics on certain issue going along with the programming of the STM32F4 microcontroller.
1. How to access PA15 or other JTAG, JTDI etc. pins as output/input/analog pin
PA13, PA14 and PA15 are assigned by the “system alternate function” to serve as programming or JTAG/JTDI etc. pins. So are some others. If you do not need them in their desired mode as debugging or so pins and would like to use them as “normal” pin you have to address them by the MODER register. The problem is: AF setting in MODER is defined as 0b11 in the two bit part of the register for each pin. Thus for PA15
GPIOA-->MODER |= (1 << (15 << 1));
will not work as you don’t reset the two bits completely by the “|=” operator.
You have to reset the two bits before and then set MODER register to the desired bit value you need for the respective mode.:
GPIOA->MODER &= ~(1 << (15 << 1)); GPIOA->MODER &= ~(1 << ((15 << 1) + 1)); GPIOA->MODER |= (1 << (15 << 1));
(to be continued)