AnsweredAssumed Answered

can all pins in stm32l-discovery be configured as gpio?

Question asked by shan on Apr 30, 2014
Latest reply on Apr 30, 2014 by gonzalez.laurent
Hi all, 

I'm trying to do a simple toggling test with STM32L-discovery board and find that I'm not able to toggle some GPIO pins.  In my understanding, we could configure all the I/O pins to output mode.  For example, with the same code, I could toggle PB6 but not PC2...  Why is that?

int main(void)
    GPIO_InitTypeDef        GPIO_InitStructure;

    /* GPIOB Periph clock enable */
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);

    /* Configure PD0 and PD1 or PD3 and PD7 in output pushpull mode */
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
    GPIO_Init(GPIOB, &GPIO_InitStructure);

    while(1) {
        GPIO_ToggleBits(GPIOC, GPIO_Pin_2);

    return 0;