This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Very basic question about GPIO



Hi, folks.

I have very basic question about GPIO configuration. My board is Stellaris Launchpad with LM4F120H5QR and I'm trying to run simple code like this below:

 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
 GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, 0xFF);
 GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0,  0x01 );

Result of this code is 0 at pin 0 of port D. I have same problem with other ports B, F, E works correct rest not at all. I've tried that on three different boards and result was the same 0.

Where is my mistake ? That ports need pull-ups or other not common actions ?

I have made HD44782 driver symilar to this project LCD PROJECT but running in 8-bit mode. When I'm using Port B as databus (DB0 - DB7) and Port D as systembus (for RS, RW, E signals) then my LCD Display not working but when I'm using Port E as systembus then all works correct.

  • Krzysztof Chojnacki said:
    have very basic question about GPIO configuration

    Such "very basic" questions are quickly/easily answered by review of the many programming examples w/in StellarisWare.  Careful review will reveal that code you've presented is indeed necessary - but insufficient.  Your "missing link" is a call to "GPIOPinConfigure()". 

    This assumes that all of the other, necessary MCU "housekeeping" (i.e. System Clock - perhaps few others) has been properly implemented.  (code posted does not reveal)

    Such, "level of detail" - never (ok rarely) found in lesser 8/16 bit MCUs - is the price we pay for, "great assortment of functional choice - per MCU pin."  You/others will make this mistake early in your learning curve - not often thereafter...

    By the way - "HD44782" Lcd Controller would be most unique - of course you mean HD44780.  I'd bet that the ports you report as "working" include, "GPIOPinConfigure()..."