# Initial state of GPIO pins

**URL:** <https://forums.digi.com/t/initial-state-of-gpio-pins/4149>\
**Category:** Plug N' Play\
**Tags:** gpio-initial-states\
**Created:** [August 2, 2004, 12:15pm UTC](https://forums.digi.com/t/initial-state-of-gpio-pins/4149 "2004-08-02T12:15:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijuma00](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@sijuma00](https://forums.digi.com/u/sijuma00)\
**Post date:** [August 2, 2004, 12:15pm UTC](https://forums.digi.com/t/initial-state-of-gpio-pins/4149/1 "2004-08-02T12:15:49Z")

</div>

Hi there.

I am coding a little remotecontrol solution based on the sample web-server. With the code I can change the state of some GPIO pins with http-form. So at this point I have three checkboxes and state of GPIO1-3 changes according to those.

Additionally I would like to have one \_enable signal, so it wouldn’t matter to the application if the server was rebooted or power-cycled / whatever. I have included this functionality to the code, but:

As the initial state of GPIO pins after reset is 1, this now somehow drives pins 4 and 5 down immediately before it starts to load application. So immediately when i get screen informing of IP settings and saying press any key in 5 seconds to modify these settings… pins 4 and 5 go down (and 1-3 stay high), why? Is there any place where I could change this behaviour?

---

<div class="post-metadata">

**Author:** ![sijuma00](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@sijuma00](https://forums.digi.com/u/sijuma00)\
**Post date:** [August 3, 2004, 7:16am UTC](https://forums.digi.com/t/initial-state-of-gpio-pins/4149/2 "2004-08-03T07:16:52Z")

</div>

To add something:

I thought this behaviour could be caused because of the booleans to those three pins are presented in the web-page (and the fourth one wasn’t). I did a test and added a similar checkbox and code for the GPIO4, and the “feature” stays. GPIO 1-3 are high, and 4&5 low. Already checked through reg\_def.h, but there doesn’t seem to be anything related to this.

---

<div class="post-metadata">

**Author:** ![sijuma00](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@sijuma00](https://forums.digi.com/u/sijuma00)\
**Post date:** [August 9, 2004, 8:50am UTC](https://forums.digi.com/t/initial-state-of-gpio-pins/4149/3 "2004-08-09T08:50:56Z")

</div>

“Problem” seems to be there with every application I tried, so are those GPIO registers used to some threadx stuff / initialization during boot-up? I am interested is this a default behavior so can I count on it that those three pins are “1” at every bootup?)

---

<div class="post-metadata">

**Author:** ![sijuma00](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@sijuma00](https://forums.digi.com/u/sijuma00)\
**Post date:** [August 9, 2004, 11:38am UTC](https://forums.digi.com/t/initial-state-of-gpio-pins/4149/4 "2004-08-09T11:38:46Z")

</div>

I guess i still continue this monologue 🙂

Problem solved. There is a line in src/bsp/platform/connectme/bsp.c which should setup the register with “current values”, if I understood it correctly:

store-\>porta = narm\_read\_reg(NARM\_PORTX\_REG, NARM\_PORTA\_ADDR, data);

Anyway, even all of the GPIO pins were tied to pull-up, this didn’t work 😛 Commented it out and replaced with my own register initialization which drives all GPIO pins to “1” and changes modes to output and now it works as expected.
