/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / gpio issue

Username:     
Password:     
             

Forum

# 1   2009-06-15 16:34:37 gpio issue

dianna.liu
New member
Registered: 2009-06-08
Posts: 3

gpio issue

I'm writing a simple program to use one of the GPIO pins to toggle an LED. I'm not using the Circle OS target, but wrote the code to target the device, STM32F103VET6 directly. What I have so far does not toggle my LED. Can someone else? I'm using Port C, pin 6, which should go to one of the LEDS. I am not using BSRR, but ODR.

#define GPIOC_CRL (*(u32*)0x40011000) //PORT C address
#define GPIOC_CRH (*(u32*)0x40011804)
#define GPIOC_ODR (*(u32*)0x4001180C) //Address of output

int main( void )
{
    GPIOC_CRL = 0x2222; //set all to outputMode @2MHz, General Purpose push-pull
    GPIOC_ODR = 0x0000; //Clear all GPIOC pin
    for(;wink
   {
       GPIOC_ODR=0x40; //turn on pin6 to toggle LED
    }
return 0;
}

Offline

 

# 2   2009-06-15 16:36:18 gpio issue

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: gpio issue

I believe that you need to configure the clock too. The clock must be supplied specifically to each use periperal (including GPIOs).

Offline

 

Board footer