Ok I have my robot working now but it was a battle with what I connected to what pin before it would work on startup or reset.
Some background. It is a basic 2 wheel drive robot with drag caster wheel. The motors have quadrature encoders and the H-Bridge(L9110S) that I am using uses PNP so the H-bridge works backward (I need to pull INA pin to ground to active it and pull to high to turn off the H-Bridge)
This is what I found if I connected and H-bridge GPIO9 then when I reset it was pulled to ground and it would startup a motor.
Also if I connect the encoder (off memory GPIO01, GPIO03, GPIO13) then the ESP8266 wouldn't boot (i assume it is becuse the encoder is either pulling that pin to high or low)
I assume it is because it is because som e of these pins have a second purpose. Does anyone know which pins have startup critical purposes??
strange start behavoiur on vertain pins
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: strange start behavoiur on vertain pins
The pins GPIO6-GPIO11 are used internally for the flash memory chip, and you should never connect anything to them.
The pin GPIO15 needs to be pulled down on startup for the board to boot into normal mode. Most development boards have a pull-down resistor on it. You can connect things to it as long as it won't be pulled high on boot.
The pins GPIO2 and GPIO0 need to be pulled up on startup for normal mode. Dev boards usually have a pull-up resistor on them. You can connect things to them as long as they won't be pulled low on boot. The GPIO0 needs to be pulled low for programming, so you have to also make sure it's not pulled high on boot.
The pins GPIO01 and GPIO03 are connected to the serial to USB chip on most development boards. You need to have them free for programming.
The pin GPIO16 is used by the deep sleep mechanism. If you don't plan to use deep sleep, you can use it for other things. Unlike all the other pins, it doesn't have the optional internal pull-up.
That leaves you pins GPIO4-GPIO5 and GPIO12-GPIO14 for free use.
The pin GPIO15 needs to be pulled down on startup for the board to boot into normal mode. Most development boards have a pull-down resistor on it. You can connect things to it as long as it won't be pulled high on boot.
The pins GPIO2 and GPIO0 need to be pulled up on startup for normal mode. Dev boards usually have a pull-up resistor on them. You can connect things to them as long as they won't be pulled low on boot. The GPIO0 needs to be pulled low for programming, so you have to also make sure it's not pulled high on boot.
The pins GPIO01 and GPIO03 are connected to the serial to USB chip on most development boards. You need to have them free for programming.
The pin GPIO16 is used by the deep sleep mechanism. If you don't plan to use deep sleep, you can use it for other things. Unlike all the other pins, it doesn't have the optional internal pull-up.
That leaves you pins GPIO4-GPIO5 and GPIO12-GPIO14 for free use.
Re: strange start behavoiur on vertain pins
Also note that most development boards use D0-D8 labels on them, which don't correspond to GPIO numbers. You can find the mapping here: https://nodemcu.readthedocs.io/en/maste ... ules/gpio/
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: strange start behavoiur on certain pins
Thanks you very much this explains why I was having the problems that I did.
Yes I have a dev board with crazy pin numbering but have a cheat sheet of what the correct names for pins are
Ok my H-bridge doesn't pull anything up or down but my encoders do depending upon the exact position they r in. So I can connect my h-bridge to GPIO2, GPIO0 and GPIO15 but not my encoders also I can't connect my h-bridge to GPIO16 due to it can't do PWM speed control but it is fine for reading my encoders.
The ESP8266 is a little shy on available GPIO pins and I can see why they added more to the ESP32.
Thanks for your help
Yes I have a dev board with crazy pin numbering but have a cheat sheet of what the correct names for pins are
Ok my H-bridge doesn't pull anything up or down but my encoders do depending upon the exact position they r in. So I can connect my h-bridge to GPIO2, GPIO0 and GPIO15 but not my encoders also I can't connect my h-bridge to GPIO16 due to it can't do PWM speed control but it is fine for reading my encoders.
The ESP8266 is a little shy on available GPIO pins and I can see why they added more to the ESP32.
Thanks for your help