2011-11-19 06:02 AM
All,
I`m fairly new to the STM32 family, not new to C or other micros: I use: Keil Lite: V4.22.22.0, 4.22a with an ST-Link, this all works and compiles etc. I can run code on my board no problem !! Now I`m trying to do something simple, ie to toggle pins on PORTC, nothing I have tried \ so far helped. here is my code simple strait-up (not all declerations are shown): void main(void) { RCC_Configuration(); NVIC_Configuration(); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_SetBits(GPIOC, GPIO_Pin_All); !!!!Nothing the port pins are ALWAYS low } I used the EXAMPLE project as well in the Keil directory... I also tried DeInit etc.... Any suggestions ? Also what I would like to know is that once a port is configured, how do you make changes to that port/pins without affecting the whole port structure? Will it change the whole port if I call same GPIO_Init(GPIOC, &GPIO_InitStructure) function with different pins and configurations ? Can`t find any reference to that in the documentation2011-11-19 08:37 AM
Make sure you enable the GPIOC clock.
Fill in all the fields of the GPIO Init structure.2011-11-19 08:39 AM
Have you turned on the clock to GPIO port C? By default (after reset) the clock is turned off.
2011-11-20 12:39 AM