Seperate Node MCU pins

Hi,

I am using a Node MCU in combination with a Mega and some SPI devices.

The Node MCU acts as master. This works.

Problem I now have is that I need to use pins GPIO0(D3), GPIO2(D4) and GPIO15(D8) as slave select outputs (all other usable pins are already occupied, used internal or used during boot or upload if I understand it correctly) and these need to be level shifted from 3,3 to 5V.

These 3 pins need to have a predefined state during boot:

So they should not be influenced by outside pull-ups or other signals.

Which electronic component can I use to only make signals going out and does not transfer any outer signal in (at the blue circled locations)?

This is the schematic, I hope my question makes sense...

Thx,
Jeroen

You can use GPIO 0, 2 and 15 as outputs without a problem. Just keep in mind that GPIO 0 and 2 are pulled high through a 12k resistor, and GPIO15 is pulled low through a 12k resistor. Also, the "program" button is connected to GPIO0 through a 470R resistor to ground.

If you want to use them as inputs, you need to be sure that they are in the right states at boot time:

GPIO15 GPIO0 GPIO2 Mode
0V 0V 3.3V UART Bootloader (programming mode)
0V 3.3V 3.3V Boot sketch (SPI flash, normal running mode)
3.3V x x SDIO mode (not used for Arduino)

Pieter

Hi Pieter, thx, this helps a lot.

So it would also not be an issue if I add 10K pullups on the CS lines ( I updated the drawing above).

Wouldn't the 3.3V side of the level shifter maintain the high signal on GPIO15 that is input from the high (5V) side.

Should I maybe use 100K pull-ups?

As shown in the schematic, GPIO 0 and 2 already have a 12k pullup, no need to add extra 10k resistors (doing this would lower the actual resistance to only 5.5k).
You can't add a pullup to GPIO15, because it already has a 12k pulldown resistor. If you really need a pullup, you can use an NPN transistor as an inverting buffer (GPIO 15 → base resistor → base, emitter → ground, collector → 10k pullup → 5V or 3.3V). Keep in mind that it inverts the signal, though, so you'll have to solve that in software.
Or you can just drive the pin in Lo-Z (output mode) all the time.

I don't think you really need a level shifter for a 3.3V signal to a 5V input, because the HIGH threshold will probably be about 3V (< 3.3V).
The level shifter will just mirror whatever is on the input, so if GPIO 15 is pulled low, the output will be low.

100k pull-ups won't have much effect. GPIO 15 will be at 0.35V instead of 0V, so it's still LOW. Using a 470R pull-up, for example, would work as a HIGH, but this also means that the chip won't boot, so you can't use it.

Pieter

Thx Pieter!!

I think i will give it a go without a level shifter for the mcu output pins, it seems the simpelest solution. I did think of this but i was a bit in doubt if using 3.3v output on a 5 v input is a solid solution...