Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By rudy
#62397 No. Those external pin states has to be there at reset before the first instructions are executed. Your user code is only started after it has made the decision as how to operate.

These pins are typically used for output. I use D0 and D2 as SCL and SDA for I2C communications. The pull-up resistors keeps them high on reset when the operating mode is determined. D0 is shorted to ground when I load code. And for D15 I will use that as an output. Sometimes as a LED indicator. If I use an SD memory card I use it as the chip enable.

If you probably are better off using a port expander chip to get the number of inputs you need.

https://www.aliexpress.com/item/1PCS-PC ... 67843.html

Image
User avatar
By joshbg2k
#62401 Hi, I'm working on executing something based on your comments, but I'm unclear on a couple things -

When you refer to D0, D2, D10, and D15, are you referring to the numberings on the board itself? There is no D15 on the NodeMCU, so I wonder if you are referring to the software GPIO pin values instead.

rudy wrote:On power up some of the I/O lines are used to determine the boot mode. D0 and D2 must be high and D15 must be low in order to run the code to run your code. After the initial start they are available for use.


Do I have control over this in setup() in my Arduino sketch, or do I have to solve this at the circuit level?

rudy wrote:When loading your code D0 has to be low, D2 high, and D10 has to be low at reset.


Does this happen in the setup() function, or does this refer to doing some sort of pin function swapping in the loop() function, preceded by operating on D0, D2, and D15 in setup() in your above quote snippet?

Thank you.
User avatar
By joshbg2k
#62403 OK thanks, looks like we submitted comments at about the same time. It does seem to me that a port expander is probably the way to go. I've got some of those coming in the mail on Monday. Thanks for you your help.

rudy wrote:No. Those external pin states has to be there at reset before the first instructions are executed. Your user code is only started after it has made the decision as how to operate.

These pins are typically used for output. I use D0 and D2 as SCL and SDA for I2C communications. The pull-up resistors keeps them high on reset when the operating mode is determined. D0 is shorted to ground when I load code. And for D15 I will use that as an output. Sometimes as a LED indicator. If I use an SD memory card I use it as the chip enable.

If you probably are better off using a port expander chip to get the number of inputs you need.

https://www.aliexpress.com/item/1PCS-PC ... 67843.html

Image