AnsweredAssumed Answered

STM32F042F4: using PA11 and PA12 as IO

Question asked by van_weerd.bastiaan on Aug 11, 2015
Latest reply on Aug 12, 2015 by waclawek.jan
I'm trying to use PA11 and PA12 on a TSSOP20 STM32 as output to understand how this remapping and configuring works. Until now I'm unable to get it to work, the pins do not toggle.

Can someone point me to the mistake I'm making?

Here's what I did:

/* Remap PA11 and 12 */
RCC->APB2ENR |= RCC_APB2ENR_SYSCFGCOMPEN;
SYSCFG->CFGR1 = SYSCFG->CFGR1 & SYSCFG_CFGR1_PA11_PA12_RMP;
 
/* Set to outputs */
RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
GPIOA->MODER = (GPIOA->MODER & ~(GPIO_MODER_MODER11 | GPIO_MODER_MODER12))\
                 | (GPIO_MODER_MODER11_0 | GPIO_MODER_MODER12_0);
 
/* Try to toggle outputs */
GPIOA->ODR ^= GPIO_ODR_11;
GPIOA->ODR ^= GPIO_ODR_12;

Outcomes