2014-04-30 03:41 AM
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); delay(); } return 0;}2014-04-30 05:06 AM
Change first argument of GPIO_Init to GPIOC.
The discovery board has some reserved I/O (example 6 I/O reserved for touch sensing that are not easily accessible).