I'm trying to use PC14 and PC15 on Nucleo F401RE board, as inputs using this simple code:
RCC_LSEConfig(RCC_LSE_OFF);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE);
// initialize ID pins as inputs
GPIO_InitTypeDef gpio_init_struct;
GPIO_StructInit(&gpio_init_struct);
gpio_init_struct.GPIO_Mode = GPIO_Mode_IN;
gpio_init_struct.GPIO_PuPd = GPIO_PuPd_UP;
gpio_init_struct.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_Init(GPIOC, &gpio_init_struct);
// read ID pins
uint8_t inputs_state = 0;
inputs_state |= GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_13);
inputs_state |= GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_14) << 1;
inputs_state |= GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_15) << 2;
Unfortunately, while PC13 works as expected, PC14 and PC15 always stay high in case of pull-up configuration or low in case of pull-down.
The reference on page 155 states:
The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general-purpose PC14 and PC15 I/Os, respectively, when the LSE oscillator is off. The PC14 and PC15 I/Os are only configured as LSE oscillator pins OSC32_IN and OSC32_OUT when the LSE oscillator is ON. This is done by setting the LSEON bit in the RCC_BDCR register. The LSE has priority over the GPIO function.
So I'm setting LSE off, but still no result. What am I missing?