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.

2 spi devices aren't working together with inverter

Status
Not open for further replies.

mik3ca

Member
circuit.png

Here I have a setup in which two ISD1700 series audio devices are connected in sockets in a way where I can control two at once and I can decide which one to choose by setting the SS line.

I hooked the SS lines (that's connected to the base of the NPN) to P1.7 of an 8051 microcontroller. That microcontroller has it where the output is only high-impedance or ground based on my software.

In all tests, Any chip seated in the first socket (where here is chip on the left) works and is recognized, but the chip on the right is never recognized. I swap the chips from the sockets while continuing to connect each chip the correct way in each socket, and I still get the exact same issue (first chip detected successfully but second chip not correct)

How do I fix this issue?
 
This will not work.
The transistor 2N3904, effectively has a diode from base to emitter (GND). So the SS line that connects from your computer and to U1, this line can not go higher than 0.7 volts. So U2 is probably seeing /SS but U2 can not see SS. (voltage goes from 0 to 0.7 volts)
You need to add a base resistor. (cut the base open and add a 10k resistor) This will allow SS to go up to 2.5 volts. Maybe 3 or 4 volts.
upload_2018-2-17_9-33-45.png
 
I thought i could get away without it since the output feeding to ss is ground or high-impedance, but I might as well go for the 10K approach and see what happens
 
I tried solving that problem with a resistor from base to VCC, that way the input will be more a logic 1 or logic 0, or I'm lost?
The resistor to VCC can not pull up much because the transistor holds the SS line down.
This is what you built. The Base-Emitter of the transistor is just like the diode in the picture. SS can not be pulled up to a "high".
upload_2018-2-17_10-34-51.png

The diode limits the SS voltage to no more than 0.7 volts.
The part you are using (data sheet) say that a "low" is defined as VCC*0.3 and a "high" = VCC*0.7.
If you are using a 5 volt supply:
Low= 0 to 1.5V
unknown = 1.5 to 3.5 volts.
High = 3.5 to 5 volts.
Your circuit has SS L=0V H=0.7V Will not work. The 0.7 is below 1.5 so it is a low.
You need H>3.5V.
 
Ok, from this point forward I guess I'll have to use a resistor to the NPN base. It makes me wonder how NPN common emitter amplifiers work if the base is pulled to ground through the internal diode. hmm...
 
I think the SS signal should be driven by an I/O pin on the controller. When the signl to the one connected to the input of the inverter is low that device is selected. When it is high that device is de selected and the other device is selected. (As it's SS input is now low due to the inverter.) Although I have been using SS the signal is NOT SS but I don't know how to put a bar above SS.)

Les.
 
Ok, now it seems I have somewhat success with the inclusion of the 10K resistor ronsimpson suggested. It seems that powering the devices up are ok, but when I try to get the device identification, it only returns general status, instead of the actual identification.

Since I used alot of nops I thought they would help but they don't. The clock for the micro is 3.6Mhz which means fastest serial speed is 307Kbps but I'm going manual so speed is more like 56Kbps at best but more like 19Kbps

Now the SS line switches at different speeds. At the beginning of an SPI transaction, I invert the SS line once or twice in a 6 to 9 microsecond period to ensure the chip is ready. Then I load command and read status then invert SS again to end the transaction.

I'm assuming my transistor circuit setup with the 10K in is acceptable for a 0.1Mhz operation of the SS line. It won't go faster than 1Mhz (If by chance I write miracle code to make it switch that fast). By acceptable, I mean where no noise affects the signal and all that. Also my PCB traces are at least 12 mils wide with 12+mils clearance.

Anyone got any ideas other than me redesign the circuit to use another I/O line?

For now I'm gonna double-switch the SS line to see if that works.
 
Ok, I fixed the issue. Thank god I implemented a data input enable line in my project because I had to literally disable the input enable line when sending data out on the same pin even though the input comes from the same sound chip. I'm guessing the SPI for the sound chip wanted to perform input AND output at the same time which I believe confused the heck out of the micro GPIO pin.

Anyway, its fixed up. at a price of up to say 60uS extra waiting time per soundcard request but at least it works.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top