Initial state of GPIO pins

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?

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.

“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?)

I guess i still continue this monologue :slight_smile:

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 :stuck_out_tongue: 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.