2010-09-28 09:28 AM
hi
i am just in the begnnig of proraming the stm32 discovery. i try to simply direct all of port c to output and put out ''1'' at all the ports so i wrote the following code: #include ''stm32F10x.h'' int main(void) { GPIOC->CRL=0x333333; GPIOC->CRH=0x333333; while(1) { GPIOC->ODR=0xffff; } } but it does not work. why? thanks for your help.2010-09-28 10:34 AM
Hi,
I think you'd enable PORTC clock:
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
have a look on examples:
http://www.st.com/stonline/products/support/micro/files/stm32f10x_stdperiph_lib.zip
brazov
2010-09-28 12:10 PM
if you don't want to use library functions, the register to set is RCC_APB2ENR (I think, don't have a manual in front of me).
so something like RCC_APB2ENR |=GPIO_GPIOCEN; (I may not have the names right so check the header file).2010-09-28 12:36 PM
Virtually everything has to be 'turned on' by writing to RCC before it'll work. This got me too :)
2010-09-28 02:52 PM
most of the Cortex-Mx chips are like that, going back as far as the Luminary days.
the only exception that I know of is the LPC1768: the ports are clocked upon boot-up.2010-09-28 11:27 PM
thanks .
it works!.