Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Switching between two SPI devices on one GPIO pin

Status
Not open for further replies.

mik3ca

Member
I thought I figured it out but apparently not.

Since my board has two soundcards installed, I ran tests. The problem is that the second chip isn't turned on (first one is always turned on), yet my system is supposed to check each chip in turn.

So I did a simple test. If I remove the chip from the left (chip U$1) from the circuit (as in remove the chip from its socket), then the system will think the chips are missing even if the chip on the right is inserted. If I insert the chip on the left, then the system will think both chips are installed regardless of whether the chip on the right (chip U$2) is present or not.

So I did some voltage measurements while the left chip was inserted and with the right one (U$2) not inserted.

For the inserted chip, the voltage measurements at its SS are 0V, then 1.91V.
For the removed chip, the voltage measurements at its SS are 4.97V then 0.04V.

I deliberately slowed down my program so that my cheeeep multimeter can read the voltages.

What am I doing wrong? Is R3 supposed to be lower? I want to use as little current as possible yet still have this transistor as an effective inverter.

circuit.png
 
It sounds like you may have MICRO_GPIO configured as an open drain output, so it can only sink, and not source, current. You want to make it a totem pole output, so that it drives the output solidly, either to Vcc, or to GND.

If you do that then R3 can be left open.

To further reduce operating current, R1 and R2 can be made much larger. I would use 47K.
 
The base of the transistor will be 0.7V when it's turned on. R2 and R3 are acting as a voltage divider. Try swapping them around.

Mike.
Edit, assuming OC output.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top