2
\$\begingroup\$

I ran out of pins on my MCU, and for that reason I want to share one pin, so it act as an input (data from a sensor) in certain part of my program, and as an output (chip select for SPI) in another part of my program.

I have used this TI SN74LVC1G125, Single buffer with 3-state outputs, as in the diagram below: schematic

  1. The MCU shared pin is marked as MULTI_DO_SD
  2. The input pin is marked CSI_D0
  3. The output pin is marked SD_CS

When signals comes in on CSI_DO, it sets OE high, preventing data going from A to Y. When MULTI_DO_SD is used for output, D1 prevents data to run to CSI_DO, and inadvertently set OE high. R8 keeps OE low, allowing the output to go through to SD_CS.

It worked "fine" without R23, but SD_CS was jumping up and down. The datasheets says that Y is "undefined" when OE is high, so I tried to add R23, pulling the line down, but then SD_CS doesn't go high at all.

datasheet

What am I missing?

EDIT 1

The MCU pin is on a ESP32: ESP32

The Input pin is a data channel (0) on a CSI Camera: Camera Connection

The Output pin is a Chip Select for a SD Card: SD Card Slot

EDIT 2

I have update the table above to the wanted outcome in red: enter image description here

\$\endgroup\$
6
  • 1
    \$\begingroup\$ To further understand what you even want to achieve, please show also the pin you want to multiplex and the two subcircuits that are multiplexed. \$\endgroup\$ Commented Aug 31, 2022 at 10:05
  • 1
    \$\begingroup\$ Please create a table (like the one above) that shows all inputs and desired outputs of the circuit. \$\endgroup\$ Commented Aug 31, 2022 at 11:42
  • \$\begingroup\$ Google "I/O expander". There are chips available to do what you want without you having to reinvent the wheel \$\endgroup\$ Commented Aug 31, 2022 at 14:24
  • 1
    \$\begingroup\$ The CS signal of SD cards is active low, so your R23 should go to VCC. How will you distinguish that from your input CSI_D0? \$\endgroup\$ Commented Aug 31, 2022 at 20:37
  • \$\begingroup\$ @KyleB, I don't want to use an I/O expander, because I then have to rewrite somebody else's SD and Camera libraries. \$\endgroup\$ Commented Sep 1, 2022 at 7:36

1 Answer 1

1
\$\begingroup\$
CSI_D0         MULTI_D0_SD output: SD_CS                    
L L L
L H H
H L L
H H L

This is a NOR gate with one inverted input. You could combine an inverter and a NOR gate, but you have the complete function in the (SN)74LVC1G97.

\$\endgroup\$
0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.