large custom led 7 segment display and driver CONTINUED...

Discussion in 'The Projects Forum' started by davidhoff, Jul 23, 2012.

  1. davidhoff

    Thread Starter Active Member

    Sep 19, 2008
    66
    0
    This is a continuation of this old thread. I took too long working on this project, and it won't let me reply to the old thread anymore.
    http://forum.allaboutcircuits.com/showthread.php?t=58189

    Hello again everybody. I've finally picked this project back up recently, and I'm very close to being done now. I'll post some pictures when I get it all wrapped up (hopefully this week). It works about 99% right now. Here is the pesky 1% issue. When a light is supposed to be on, it is. When a light is supposed to be off, it almost is. It will remain just barely visibly on. It took me a while to even notice it next to the lights that are on. At first I thought it was light reflecting back at the led's, but on closer inspection, I found it really is on. When the output enable is switched off (high, since it's active low on the stpic595), all the lights go completely out as they should. I can't think of what this could be. I have a picture showing how each segment is connected. I don't see anything in the physical circuit that should make it behave this way, but that doesn't mean there isn't something I missed.[​IMG]

    So maybe it's a code problem? Here is how I'm talking to it. CLR is always connected to +5v through a resistor. All the communication with the shift register is +5v or 0v signals. G (output enable) is controlled elsewhere in the program, so it can be turning on and off while data is shifting around.

    1. Set RCK low
    2. Set SER-IN high or low for the bit
    3. Set SRCK high
    4. Set SRCK low
    5. Repeat steps #2-4 7 more times (or more if chaining multiple SRs
    6. Set RCK high

    There are some slight differences to how the datasheet shows the communication (they only turn on G when data is done transferring, RCK is only pulsed momentarily in their diagram (whereas I leave it high when not sending data), they actually use CLR). I don't think these should matter if I'm understanding it correctly, though. So any ideas?
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Your link to the image didn't work, so I found it and uploaded it to the forum:
    [​IMG]

    What's the clock speed of your uC?
    If it's pretty zippy (say, 20MHz) then you might be seeing the ghosting due to propagation delays in the STPIC6C595. According to the datasheet, worst-case propagation delay is 130nS, or 0.13uS.

    You might try simply add a few NOPs in your code before setting RCK high, then low again.

    If the "ghosting" problem is really bad, that's usually an indication of the sequence of instructions being incorrect; where minor ghosting can be due to propagation delays/minor timing problems. It could also be that your compiler has performed optimization of your code that sends instructions to the port all at once instead of two separate commands.

    Adding some NOPs in there should help.
     
  3. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    I don't see any attempt here to determine whether this is a static or dynamic effect. What I mean is, if you had the display sitting there with the segments off ,and no digital action occurring, would you see any lights slightly on? If you did, it would indicate leaky drivers in the stpic555 chips, or current going where it shouldn't by some other route.

    On the other hand, if the effect only occurs when there's switching going on, you need to look for some kind of timing problem of the type that SgtWookie is talking about.
     
  4. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    I wonder if there may be some interaction between the latch (RCK) and output enable (G) signals?

    I've used the TPIC6C595 and I did not experience the problem you're describing but I used the PWM pin on a PIC to drive both the latch (RCK) and output enable (G) lines and I loaded the shift register only while those lines were high.

    Please tell us which IC you're using? There are several TPIC variants.

    Regards, Mike

    <added> picture is of a prototype 16F1823 Serial LED/LCD Backpack using TPIC6C595 drivers for LED displays running at 2% brightness level...
     
    Last edited: Jul 24, 2012
  5. davidhoff

    Thread Starter Active Member

    Sep 19, 2008
    66
    0
    It's an stpic6d595.
    http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00163738.pdf
    Sorry, my late night proofreading isn't the best. My microcontroller is only running at 8MHz, so I would doubt that I'm sending commands too fast. Would this only cause ghosting while actually sending data, or even when sitting idle between data transfers? As for the static vs dynamic problem, data is only shifted in when user input is recieved. The output enable pin is happily toggling away all the time though. So I am seeing the ghosting while it's not sending new data, but I'll have to try setting the output enable to a constant state, to see what that does. Thanks for the ideas.
     
  6. davidhoff

    Thread Starter Active Member

    Sep 19, 2008
    66
    0
    It seems to be related to PWMing the output enable on the chip. If I set the output enable at a constant value, everything works fine with no ghosting. Does anyone know what it could be about switching the output enable on and off that causes issues? The pwm frequency is 1kHz. I don't want to give up the ability to adjust brightness by getting rid of the pwm.
     
  7. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Re the dynamic effect, hah. That's the sort of test to make--try it with no digital level changes happening.

    This is a puzzle. Could it be that the chip simply has an error in it?

    But some questions. How is your circuit constructed? I'm imagining a possibility of poor grounding. Suppose that you blip the G input and that causes some number of high-current outputs to change state. The chip has only 1 ground pin, so could there be a ground bounce, with a momentary glitch transmitted to the logic so the LEDs turn on briefly where they should stay off? I'm thinking the weak point of these chips might be that there's no separation between power and logic circuits.

    Also, do say that there's a capacitor connected close to the power supply of each driver chip, meaning connected near to that chip's power and ground pins. With major currents (transient, at that!) flowing right by the logic, you need all the filtering you can get.
     
  8. davidhoff

    Thread Starter Active Member

    Sep 19, 2008
    66
    0
    Other thoughts... I don't have the option to change the pwm frequency since lots of other stuff in my code relies on the same timer as the pwm for this pin. I can't switch pins because all the others are in use and that is how the board is made. If I can't switch the output enable to control brightness, could I tie it to ground and use a mosfet to switch the high side of power to the leds with pwm? I would have to modify the board somewhat, but I think I could cram it all in there.
     
  9. davidhoff

    Thread Starter Active Member

    Sep 19, 2008
    66
    0
    I've never heard of ground bounce before. I'll try to read up on it. I didn't think I would need to worry about filtering the power to each chip on the board when I'm using a regulator and the board is small, but hey it's worth a shot. It is a fair amount of power being switched around, and I guess the small board could be a bad thing with the power and signals so near each other. What size caps would you recommend?
     
  10. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    For filter capacitors, 0.1uF is the most common value. It's important to place the caps as close to the pins of the chip as possible, and it's good practice to run the power connection to the cap first, and then the i.c.

    Wikipedia has a pretty good article on ground bounce. What I'd be concerned about is that large currents might cause voltage drop in your ground trace, and that could affect what's seen as 1's or 0's by the digital logic. If you have the chips tied to a ground plane, that would be ideal. But if you have have narrow ground traces, or if the board is hand-wired with small wire, that would definitely be a worry.
     
  11. davidhoff

    Thread Starter Active Member

    Sep 19, 2008
    66
    0
    0.1uF caps next to all the chips didn't change anything. For a while I thought I ruined the board after I added the caps, but eventually I tracked down a broken trace... Stupid flimsy homemade board... Still looking for ideas how to get this ghosting issue resolved. What do you guys think of tying the output enable low and switching the high side of the led power with a mosfet instead?
     
  12. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    You should probably post a schematic.

    You should be able to control brightness using a PWM signal on the /G pin. Here's a couple drawings showing PWM brightness control with my MacMux driver method (no ghosting problems) using the TPIC6C595, which appears to be very similar to the STPIC6D595 (same pinout, signal rules, etc.);
     
    Last edited: Jul 26, 2012
  13. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Instead of loading the shift register as described above, have you tried clocking the RCK pin like this?

     
  14. davidhoff

    Thread Starter Active Member

    Sep 19, 2008
    66
    0
    Yes I have tried that. There was no discernible change. MMcLaren, from the schematic you posted it looks like you have output enable and latch hooked together? And are those switches just so you can control it manually? I had big problems trying to run the stpic6d595 using buttons to control the inputs (button bounce?). Did you have any issues with that? Anyway, schematic attached.
     
  15. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Yes, I mentioned this in my earlier post. This is a major feature of the MacMux method. In this case the PWM signal is doing triple duty... (A) it provides PWM brightness control, (B) it allows re-tasking the display column driver lines when PWM goes high (display off) for use as <clk> and <dat> lines to load the driver IC shift registers, and (C) it automatically latches the driver IC shift register data onto the driver outputs when PWM goes high (display off).

    The switches have nothing to do with the display. I'm simply using the column driver lines from the display to drive the switch matrix. Multiplexing the switches this way allows using a single pin to read the switches.
     
    Last edited: Jul 27, 2012
  16. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Thank you. You're not multiplexing the displays so the examples I posted probably don't make much sense. Sorry!

    May I ask if you're using the Arduino software or something else? And please forgive me if you've already mentioned that.

    Regards, Mike
     
  17. davidhoff

    Thread Starter Active Member

    Sep 19, 2008
    66
    0
    I am using the arduino software. I'm running off the internal 8MHz oscillator.
     
  18. davidhoff

    Thread Starter Active Member

    Sep 19, 2008
    66
    0
    Anyone have any more ideas of stuff to try? I'm really stuck here. Is there a way I can try to diagnose it somehow? Seems like a scope might tell me what's going on here, but I don't have one. Can anybody recommend a good scope for a hobbyist? Or how about just switching to another type of shift register? It seems there are many variants that should be drop in replacements.
     
  19. davidhoff

    Thread Starter Active Member

    Sep 19, 2008
    66
    0
    So, I got it working, but not the way I would have liked. I suppose it's good enough for now. Thought I'd post it here to see if I've done anything terribly wrong.[​IMG]
    Here is the datasheet link from where I bought the mosfet. http://www.vishay.com/docs/91092/91092.pdf. The number doesn't match the part exactly, but the data is very similar to a datasheet I found with the exact part number. It's probably way overkill, but it's what I already had at home.
    It seems to be working, but is this a correct or good way of doing it? Basically, I attached the output enable pin to ground, and ran the pwm signal to an npn transistor through a diode to protect the micro from higher voltage (just in case) which drives the gate of a p channel mosfet to either 18v or 8v (Vgs = 0 or -10). The mosfet switches the high side of the leds. I'll have to change my code so that a high signal means the leds are on now instead of a low one. Comments? Concerns?
     
  20. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    It can be frustrating to find a workaround when you really wanted to understand and fix a problem. But the prime directive is "Get it working" and you've done that. So congratulations.

    The diode really shouldn't be necessary, but if it gives you confidence, it's harmless.
     
Loading...