cancel
Showing results for 
Search instead for 
Did you mean: 

Toggling GPIO port

markol
Associate
Posted on October 11, 2006 at 13:38

Toggling GPIO port

2 REPLIES 2
markol
Associate
Posted on May 17, 2011 at 09:33

Hello,

I am unable to toggle bits on ports 3&6. I am using STR912FW44 cpu.

With this piese of code I want to turn on 8 LED's on port 6

*(unsigned char*)(GPIO6_BASE + 0x3FC) = 0x00;

but only first 4 light's up (firs 4 bits). Second half of port simply don't go to low state and I have no idea why.

Thanks.

M.

ebarker
Associate II
Posted on May 17, 2011 at 09:33

put this in your initialization

//////////////////////////////////////////////////////////////////////////////////////////////////////

SCU_APBPeriphClockConfig(__GPIO6, ENABLE);

// GPIO6 goes to the LEDs

GPIO_DeInit(GPIO6);

GPIO_StructInit(&GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;

GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;

GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;

GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Disable;

GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1;

GPIO_Init(GPIO6, &GPIO_InitStructure);

// //////////////////////////////////////////////////////////////////////////////////////////////////////

and put this in your app

GPIO_Write(GPIO6, display_byte);