2015-08-11 05:20 AM
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;
#pa11-pa12-remapping-stm32f042f4
2015-08-12 02:20 AM
SYSCFG->CFGR1 = SYSCFG->CFGR1 & SYSCFG_CFGR1_PA11_PA12_RMP;
&?
In doubts, I often read back the registers and check whether they are set as I expect them to be. This is best done in the debugger (where the writes can be done directly too); I understand that this may not be practical with the 20-pin package.
JW