+Vorticon Posted April 22, 2015 Share Posted April 22, 2015 Hi. Since I'm constantly working on some wacky interfacing project or other, I figured I'll start a thread on the subject since I have a question. I have been working on connecting the TI's parallel port to a Raspberry Pi equipped with the Pi camera to capture a picture on the TI. Since the Rpi is a 3.3V system, I have had to figure out how to achieve bidirectional logic level shifting between 3.3 and 5 volts. I found this 74LVC245 8-bit logic level shifter on Adafruit and I created a primitive communication protocol between the TI and the Rpi to control it. It worked quite well, and I am able to send data and control signals bidirectionally, but the thorny problem I am currently encountering is spurious signals generated somewhere triggering unwanted events and messing up the synchronization of the data transfers. Each byte of the image captured by the Rpi is transmitted to the TI upon receipt of a HANDSHAKEOUT high signal from it to port 23 on the Rpi, and the cycle subsequently repeats until all the bytes are sent. What is happening is that there are spurious HSKOUT high signals somehow being generated, wreaking havock with the process. As a test, I set up the TI side to hold HSKOUT low after receiving the first byte, and yet the Rpi kept trying to send new bytes in for a few cycles before stopping and waiting. It's almost reminiscent of key bounce, except that there are no physical keys or switches involved here. I have connected all the unused inputs of the 245 to ground or Vcc without any noticeable improvement, and I am currently at a loss as to how to eliminate that problem. If anyone here has any suggestions, I would be very grateful to hear them. I am running out of hair to pull! Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted April 22, 2015 Share Posted April 22, 2015 I'm curious, are you using a flat ribbon cable? Is it RF insulated? Might it be running in parallel to other cables? A flat lead RF choke or a couple of twists in the cable MAY make a difference. Give it a shot before any more complicated actions... if you have not already done so. You have nothing to lose. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 22, 2015 Author Share Posted April 22, 2015 I am in fact using the standard TI ribbon printer cable for this project, and it is fairly long. I did look up ribbon cable ferrite cores and ordered one. We'll see if that solves the issue. Thanks for the suggestion! Quote Link to comment Share on other sites More sharing options...
marc.hull Posted April 22, 2015 Share Posted April 22, 2015 Try pulling you buss high and let the ic sink the zeros. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 22, 2015 Author Share Posted April 22, 2015 Try pulling you buss high and let the ic sink the zeros. Marc, could you please elaborate on that? I'm a self-taught amateur when it comes to electronics and I'm not sure how to do what you suggested... Quote Link to comment Share on other sites More sharing options...
marc.hull Posted April 22, 2015 Share Posted April 22, 2015 Marc, could you please elaborate on that? I'm a self-taught amateur when it comes to electronics and I'm not sure how to do what you suggested... I think we are all amateurs if truth be known . If whatever you are using as your clock signal to the Rasberry ever goes hi Z or is otherwise undefined at some point then the logic gate on the 245 will output an unknown. If you put a resistor between the 245 output and 3.3v then that will ensure the output is always high or driven low only when it's supposed to be low. This assumes an active low signal. If active high the connect your resistor to gnd. Of course this is conjecture, the problem may lie else where. . Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 22, 2015 Author Share Posted April 22, 2015 Ah! Well it's certainly worth a try. I'll test it out tonight. Thanks Quote Link to comment Share on other sites More sharing options...
Stuart Posted April 22, 2015 Share Posted April 22, 2015 HSKOUT is generated by the TI using 5V logic, and needs to go to the RPi using 3.3V logic? Try doing the voltage conversion for this signal using a simple resistor potential divider rather than an IC. [http://www.savagecircuits.com/attachment.php?attachmentid=286&d=1372033234] Also try putting a 22 Ohm resistor in series at the TI end (after the potential divider) to minimise ringing on the line if it's a long cable. May make absolutely no difference but simple to try. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 22, 2015 Author Share Posted April 22, 2015 The Rpi also sends data and signals to the TI, so the outgoing voltages need to be upconverted from 3.3 to 5V. The IC is bidirectional and can be placed in high Z when not needed. Using voltage dividers for 8 data lines and 4 control lines will make for a rat's nest of components, not to mention the problem of isolating outgoing and incoming signals from each other. My circuit is a little more complicated than I described, with separate bi-directional level shifter ICs for control and data lines, thus allowing me to send or receive data while sending or receiving control signals simultaneously. It seemed much simpler to use dedicated ICs for this process. Is there a way to add some kind of circuit to the end of the ribbon cable to filter out noise? Quote Link to comment Share on other sites More sharing options...
marc.hull Posted April 23, 2015 Share Posted April 23, 2015 I don't think you need to tie your address and data lines but if you are shifting your control wires through the 245's then they should be tied on both sides unless you can guarantee they will not float at unoportune times and with two async machines I doubt that is feasible. Can you post a schematic or sketch? Quote Link to comment Share on other sites More sharing options...
Tursi Posted April 23, 2015 Share Posted April 23, 2015 Marc's theory on randomly floating is probably the easiest one to test (especially since it's one line you've isolated -- if you prove it on that line, then you can examine the others). With a long cable like that interference is also possible - chokes may or may not help. If you have a scope you could probably check for that - scope the HSKOUT line and toggle the line physically next to it, see if you are getting anything. /Might/ even be able to do it with a meter, but it won't be as easy to tell how large the interference is. The other possibility is reflections, especially with a long cable. While there's a science to figuring out the right value to dampen them, you can likely absorb them without killing the signal with a 100 ohm resistor on the line (as a quick way to test). Quote Link to comment Share on other sites More sharing options...
Stuart Posted April 23, 2015 Share Posted April 23, 2015 HSKOUT is generated by the TI using 5V logic, and needs to go to the RPi using 3.3V logic? Try doing the voltage conversion for this signal using a simple resistor potential divider rather than an IC. [http://www.savagecircuits.com/attachment.php?attachmentid=286&d=1372033234] Also try putting a 22 Ohm resistor in series at the TI end (after the potential divider) to minimise ringing on the line if it's a long cable. May make absolutely no difference but simple to try. I was meaning just try this on the HSKOUT line to see if it improved the "the RPi keeps on sending data" problem. If it made no difference then nothing lost. If it did improve things then it might point to a problem with the level shifting IC circuit and you could investigate further. Quote Link to comment Share on other sites More sharing options...
marc.hull Posted April 23, 2015 Share Posted April 23, 2015 Perhaps I misunderstood so to clarify... You are coming straight off the side port and not the parallel port? Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 23, 2015 Author Share Posted April 23, 2015 Perhaps I misunderstood so to clarify... You are coming straight off the side port and not the parallel port? No, I'm using the parallel port. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 23, 2015 Author Share Posted April 23, 2015 Well, I tried all of the above suggestions except for the ferrite block which I ordered, all to no avail. An interesting observation was that sometimes just touching the metal case of the TI triggered a pulse! Below is a picture of the project and a block diagram of sorts. It's a rat's nest I know, and I wouldn't be surprised if some of the interference is coming from the Voyager 1 probe . Eventually, assuming I can get it to work reliably, all this will be converted to a PCB. Any other thoughts guys? 2 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted April 23, 2015 Share Posted April 23, 2015 Well, I tried all of the above suggestions except for the ferrite block which I ordered, all to no avail. An interesting observation was that sometimes just touching the metal case of the TI triggered a pulse! Below is a picture of the project and a block diagram of sorts. It's a rat's nest I know, and I wouldn't be surprised if some of the interference is coming from the Voyager 1 probe . Eventually, assuming I can get it to work reliably, all this will be converted to a PCB. Any other thoughts guys? That pulse from touching the case may indicate an improper ground. ...lee 1 Quote Link to comment Share on other sites More sharing options...
Omega-TI Posted April 23, 2015 Share Posted April 23, 2015 Well, I tried all of the above suggestions except for the ferrite block which I ordered, all to no avail. An interesting observation was that sometimes just touching the metal case of the TI triggered a pulse! Any other thoughts guys? Touching the un-connected metal case of the TI caused a pulse? Wow, there is so much unshielded square-wave activity going on in that rats maze I dunno where to start! I would suggest checking for a ground loop in that mess, you may have a couple of different potentials going on there that manifest when you touch ground. Quote Link to comment Share on other sites More sharing options...
marc.hull Posted April 23, 2015 Share Posted April 23, 2015 Do you have a shared ps ground? Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 23, 2015 Author Share Posted April 23, 2015 Do you have a shared ps ground? No. I am using the 5V from the parallel port to power the 125 chips and the 3.3V from the Rpi to power the 245 and the inverter chips, and they each have separate grounds being on different breadboards. Should I have a shared ground? Quote Link to comment Share on other sites More sharing options...
marc.hull Posted April 23, 2015 Share Posted April 23, 2015 Yes. Try connecting a logic ground from the TI PIO and a logic ground from the pi. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 24, 2015 Author Share Posted April 24, 2015 Creating a common ground seems to have eliminated the occasional triggers when the TI case is touched. It unfortunately did not have an effect on the HSKOUT issue though. Another observation I made was that I get a burst of spurious HSKOUT high signals right after the first byte is sent and received by the TI for maybe a second (probably even less), and then nothing, almost like an oscillating process that dampens out with time. I am able to trigger the Rpi at that point by manually connecting the HSKOUT line to Vcc, so I know the program on the Rpi side is working as intended. It seems to me that the problem mostly lies on the TI side of things. Over the next few days, I'm going to systematically step through the process with the circuit connected to my oscilloscope and logic analyzer, paying particular attention to the output end of the parallel cable. I'm going to ferret out this bug one way or another! I'm also going to start laying out a PCB for the circuit since eliminating the rat's nest of wires will likely be helpful. One question here: should I use pull-up or pull-down resistors on the unused inputs? Also, should the unused outputs also be clamped as well? I'll post a schematic when I have it completed. Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted April 24, 2015 Share Posted April 24, 2015 Well, I hope you do not run into much resistance in your efforts. I see you as a transformer of sorts and suspect you can rectify the problem and bridge it into something for which you might be inducted. I diode your phone to help you ferrite out the problem. Alas, I lacked the capacitance to remember your number. 1 Quote Link to comment Share on other sites More sharing options...
marc.hull Posted April 24, 2015 Share Posted April 24, 2015 If you have ungrounded, unused inputs then that could be your current issue (no pun intended.) Tie unused inputs to ground (don't need a resistor.) Don't worry about unused outputs. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 24, 2015 Author Share Posted April 24, 2015 Well, I hope you do not run into much resistance in your efforts. I see you as a transformer of sorts and suspect you can rectify the problem and bridge it into something for which you might be inducted. I diode your phone to help you ferrite out the problem. Alas, I lacked the capacitance to remember your number. Nicely put Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 24, 2015 Author Share Posted April 24, 2015 If you have ungrounded, unused inputs then that could be your current issue (no pun intended.) Tie unused inputs to ground (don't need a resistor.) Don't worry about unused outputs. Ok I'll do that. Thanks. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.