cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO I/O control help

michel239955_st
Associate II
Posted on February 07, 2008 at 14:57

GPIO I/O control help

4 REPLIES 4
michel239955_st
Associate II
Posted on May 17, 2011 at 09:49

Hi, I use the evaluation board REVA for ST microcontrollers. The ic include was the STR912F. I have a problem. I use some port like the #6 and #4 as bidirectional 16 bits bus. I use the gnu compiler and external circuit. My problem is that when I put the port in out mode :

SCU->PRR1 |= 0x00100000; // release P6 reset

SCU->PCGR1 |= 0x00100000; // clock gating P6

SCU->GPIOOUT[6] |= 0x5555; //normal out for all pin

GPIO6->DIR = 0xFF; // Dir output on GPIO6 for all pins

--

--

GPIO_WRITEDATA(GPIO6, 0xF0); //work fine but when

SCU->GPIOOUT[6] |= 0x0000; //input mode

GPIO6->DIR = 0x00; // Dir input on GPIO6 for all pins

var = (GPIO_READDATA(GPIO6));

There is a problem. The pin of the port #6 stay in output mode. They didn’t return in hiz mode. I couldn’t with the other ic bring the pin to other state. I try to put the port in read mode then in write mode and it work but once in write mode I can’t bring it back to release the pin in hiZ to let other ic on the bus to take control of it. The port ## 8 and 9 work. I just have to switch the dir register and the pin is release. The other ic can put there info on the bus. But with the port 0-7 the pin isn't release.

Those port shoud be input and output. How can I put the pin in hiZ after put it in write mode.

Can someone help me with that.

Thank you for your help

:-[

mark9
Associate II
Posted on May 17, 2011 at 09:49

Your statement

SCU->GPIOOUT[6] |= 0x0000; //input mode

doesn't do anything. You need to also make sure none of the peripherals are driving the outputs (not just the GPIO).

michel239955_st
Associate II
Posted on May 17, 2011 at 09:49

I try to just change the dir register but i didn't see any change in the pin. For the other device i didn't even release them of the reset mode register SCU->PRR1 and SCU->PCGR1. I just release the GPIO function. I try with all port and they do the same thing except for the port 8 and 9. When I switch the dir register they become Hiz state. So the other ic on the bus can drive the bus.

There should have a way to release the output and to let him return to Hiz mode(except to reset the ic). I try to return the port in resret mode then back to work but it didn't work.

I'm sure somebody else had meet the same problem.

Please help...

:o

michel239955_st
Associate II
Posted on May 17, 2011 at 09:49

I install the Ride version 7 and it solve the problem. i can now switch the port from output to input mode. There may have a bud on the version 6. When I install the version 7 the version 6 start to work ????.