Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPIO Question #59

Open
HomeHomeApp opened this issue May 17, 2020 · 4 comments
Open

GPIO Question #59

HomeHomeApp opened this issue May 17, 2020 · 4 comments

Comments

@HomeHomeApp
Copy link

@raburton
Is it possible to make a gpio high or low when esp8266 starts?

@raburton
Copy link
Owner

Yes it's possible, but not built in - you'd need to add a little code to rBoot to achieve it. Of course rBoot quickly hands control over to the user rom (and all it's SDK code), so I don't know how long any change you make to a GPIO will remain, the SDK could reset it again. I don't know the exact code you'd need to set the GPIO in baremetal mode now, it's been a long time since I looked at this, but have a look at the code that handles checking a GPIO on startup and you'll probably work out what you need to do. See the couple of functions from here https://github.com/raburton/rboot/blob/master/rboot.c#L130

@HomeHomeApp
Copy link
Author

I understood rboot working process in 2 months (never tried a bootloader before)

Your lib is awesome, i am using it with esp-open-rtos. 2 roms configured in 1mb flash (750k+250k) and both roms can be updated with ota.

I think WRITE_PERI_REG will be used but these codes are very complex for me

My problem is relay 1,2,3 are high untill sketch begins.
relay_gpio_1 = 12;
relay_gpio_2 = 5;
relay_gpio_3 = 4;
relay_gpio_4 = 15;

Is there any easy way to make 12,5,4 to low?

@raburton
Copy link
Owner

As I say, I don't know the exact code you'll need (because I haven't looked at GPIO stuff for several years), but you can try writing something based on the code in the function https://github.com/raburton/rboot/blob/master/rboot.c#L162. This checks the state of a GPIO, by pulling it up and then checking if it's been pulled back down by an external connection to ground. So it's setting the state of the pin to high and using it an an input, you want to do the opposite and set it to low as an output. Most of the code to do that will be the same, you'll just need to tweak it a little bit (sorry, but how to do that is the bit you'll need to work out).

@HomeHomeApp
Copy link
Author

Ok, i will work on this today, if i can find a solution i will write here.
Thank you. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants