Arduino Forum

Using Arduino => Networking, Protocols, and Devices => Topic started by: azi on Mar 05, 2013, 06:20 pm

Title: ShiftPWM SPI Clock signal noise
Post by: azi on Mar 05, 2013, 06:20 pm
Hello,
I am using arduino mega 1280 with shiftpwm library to run couple of shiftregisters with uln2003 that drives high power leds. I had some noise problems with >2 registers connected. I suspected the CLK signal so I disconnected all the registers and plugged usbee logic analyzer straight into the clock pin. The latch and data signal looks good (probably because it's lower frequency), but the clock signal has lots of saw spikes here is image of it http://masz.in/spi_shift/clock%20signal.jpg (http://masz.in/spi_shift/clock%20signal.jpg)
The clock is running @ 4Mhz. I guess that the longer cable the worst signal this is probably why the more registers i add the bigger noise i have. Do you have any idea how to resolve this issue? Schmitt Trigger? Low Pass/High Pass filtering? Help!
Title: Re: ShiftPWM SPI Clock signal noise
Post by: pylon on Mar 05, 2013, 07:16 pm
On this picture Digital 0 is the clock signal and Bus is the data signal? What's the sample rate of your USBee? More than 10MS/s? Doesn't look that bad to me. From the speed I'd guess you're using the hardware SPI, aren't you?

Can you define "noise problems"? How do these show up?
Title: Re: ShiftPWM SPI Clock signal noise
Post by: CrossRoads on Mar 05, 2013, 08:29 pm
Do you have decoupling caps on the shift register Vcc pins (0.1uF cap from +5 to Gnd near the Vcc  pin)?

You could also look at terminating the clock line to clean it up.
http://www.fairchildsemi.com/an/AN/AN-393.pdf
Title: Re: ShiftPWM SPI Clock signal noise
Post by: azi on Mar 06, 2013, 10:03 am

On this picture Digital 0 is the clock signal and Bus is the data signal? What's the sample rate of your USBee? More than 10MS/s? Doesn't look that bad to me. From the speed I'd guess you're using the hardware SPI, aren't you?

Can you define "noise problems"? How do these show up?


Both signals are clock, one is "analog" reading the other is digital. Usbee runs at 16mbps.

http://m.youtube.com/#/watch?v=SR9LhPwdWqg this is how it looks like. There should be one triangle lit up at one time.

And yes its hardware SPI that ShiftPWM uses on Mega its 52,51 and 8 for latch
Title: Re: ShiftPWM SPI Clock signal noise
Post by: azi on Mar 06, 2013, 10:07 am

Do you have decoupling caps on the shift register Vcc pins (0.1uF cap from +5 to Gnd near the Vcc  pin)?

You could also look at terminating the clock line to clean it up.
http://www.fairchildsemi.com/an/AN/AN-393.pdf


Yes I do have decoupling, on power line 100nF, 1uF, 10uF. Also on the 595 chips between vcc and gnd 100nF just on top of the register.
By terminating you mean for ex. from last clock 10k resistor to gnd?
Title: Re: ShiftPWM SPI Clock signal noise
Post by: pylon on Mar 06, 2013, 06:20 pm
16Ms/s is not enough to get a realistic picture of a 4MHz clock signal.

The lower part of the picture is very strange because the digital interpretation and the analog signal curve doesn't look synchronized. Is this offset normal for the USBee or are these different signals?
Title: Re: ShiftPWM SPI Clock signal noise
Post by: CrossRoads on Mar 06, 2013, 06:24 pm
"By terminating you mean for ex. from last clock 10k resistor to gnd?"
Yes, or look at some of the examples in the article
Your image capture might also look worse than it really is, can be impacted by things like where your probe grounds were connected.