GPIO pin P15[5] in Hi-Z Analog mode still outputting square wave

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I'm using a CY8C5568LTI.  I have pin 61 P15[5] connected to a 1K resistor, which in turn connects to the center point of a stack of 100K resistors from a regulated 2V down to ground.

   

I use instructions

   

PIN_SetDriveMode(PIN_DM_ALG_HIZ); // Set as Hi-Z input,
PIN_Write(0); // Really no impact since we're in Hi-Z input mode

   

To put this pin into high impedance mode.  Neverthelss, I'm seeing a square wave at the center point of the resistor stack, varying from 0.9V to 1.1V.  The resistor stack is seeking 1.0V, and the pin is injecting current to cause this +/- 0.1V change. The square wave period is about 120ms (8.3Hz).  Whether I do DC analysis (101K to ground) or AC analysis (resistor network 51K), I come up with 1 to 2 uA of current coming out or going into this pin that's supposed to be high impedance.

   

So I check the CY8C55 Family Datasheet. Table 11-6 for GPIO DC Specifications says input leaking max 2nA. That's a far cry from 1 to 2uA. I do find more leaking on SIO pins, but this is definitely a GPIO pin.

   

So why do I seem to have 500 to 1000 times more current coming from/to the pin that the datasheet says?

   

Note also that I found a knowledgebase article at http://www.cypress.com/?id=4&rID=33792 about a similar subject. It says a resistor of "few tens of K" will fix the problem noted.  But that also implies a leakage current much larger than the datasheet says.

   

So what's up and how can I fix this offensive pin?

   

Thanks.

0 Likes
1 Solution
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I have changed my mind about coupling based on the fact

   

you posted square wave as < 10 Hz, stray C of 5 pF at 10

   

Hz is ~ 318 Mohms, so it cannot be coupling.......

   

 

   

Your scope is not aliasing due to improper sweep settings ?

   

 

   

So what is running in your design at this low frequency ?

   

 

   

Regards, Dana.

View solution in original post

0 Likes
32 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When there is something that should not be it is always better for us to have the complete project to check. Using the "Create Workspace Bundle" function and uploading the resulting archive would do.

   

Are you using an own PCB or have you got a kit (which one)?

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Possibly the following -

   

 

   

1) The DC offset, due to tolerance of 100K's and 2 V supply ? If 100K's are

   

5%, then two R's could be 10% off.

   

 

   

2) The pin is adjacent to Vddio pin, would not be unusual for it to have a few hundred

   

mV of noise on it, and via parasitic C coupling induce a sq wave on adjacent HiZ pin.

   

 

   

Regards, Dana.

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Analog pins are always bi-directional. High-Z just means that they don't impose any load an connected outputs (or at least just a small load). But since you observe only a small signal (200mV peak-to-peak) I think Dana is right: you just observe a signal coupled in from somewhere. This might be from the outside, or even from the inside of the PSoC.

   

To check the latter, you can use the analog wire viewer in the design wide resources editor. There you can check how P15[5] is routed internal, and where it might cross a digital signal.

   

Otherwise it might come from the outside. 100k resistors won't do much to prevent noise from coupling in...

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I may be mistaken but I do not think the analog viewer shows topologically

   

the physical layout, it is more a symbolic route view ? I could be wrong on this.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I have changed my mind about coupling based on the fact

   

you posted square wave as < 10 Hz, stray C of 5 pF at 10

   

Hz is ~ 318 Mohms, so it cannot be coupling.......

   

 

   

Your scope is not aliasing due to improper sweep settings ?

   

 

   

So what is running in your design at this low frequency ?

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 Bob, Dana, and hli:

   

Thanks very much for your suggestions.  Here's some itemized followup.  Your own followup from this is GREATLY appreciated.

   

Back to fundamentals, if the noise *is* coming from the PSoC5, then is there something I can do to lessen the drive strength?

   

I can't provide the project because of it's proprietary nature.

   

The board is custom.

   

FYI, I've been doing this type of work for over 20 years, so a snafu like scope settings, while always possible, is very unlikely.

   

I removed the 1K resistor and the offending signal on the 100K stack went away.  The 1K resistor connects to the PSoC5 and nowhere else.  The the injection must be occurring on the electrical node that is the trace from the 1K resistor to the PSoC5. Now, this trace does go out to a test connector that currently has a plug in it with 5" pigtails.  However, I'm pretty sure the type of square wave signal seen, much less at 8Hz, can't ge generated by this extra baggage on this electrical node.  In fact, I'm pretty sure it can't be generated by anything else outside the PSoC5, such as capacitive coupling to another signal.  This trace does repond appropriately when I intentionally drive it low or high, which are two other configurable states for the output.  So it's not likely shorted to something else.  Furthermore, I'm not intentionally doing anything as slow as 8Hz.  (And, of course, it's a square wave, so please think again and it can't be resistor tolerances.)  

   

I've attached an annotated photo of two test conditions.  The top is with the 1K in place.  You see it's definitely a square wave, with 1uA being inserted + and -.  The bottom is after the 1K is removed, probing the open resistor pad that is the same node as the PSoC5 pin.

   

Regarding induced voltages from nearby, I calculate the induced current would have to be 1 to 2 uA.  Maybe this could be an induced voltage, but from where?  The 8Hz square wave nature shouldn't be anywhere else on the board.  I'm not prepared to get to this point YET, but the board is layed out such that I could cut this line very close to the PSoC5 pin and then measure the pin directly.  This would definitively eliminate all sources other than the PSoC5 itself, if I continue to assume it can't be noise on the scope, which is an extremely safe assumption under these conditions.

   

The biggest question may be from where does the 8Hz come?  I'm not intentionally running anything that slow.  And the square wave is so relatively "square", that it's not some beat-down or low frequency harmonic of a higher frequency signal.  It's simply an 8Hz square wave, nothing more and nothing less.  I don't think I have such signals outside the PSoC5.  I have an 8MHz crystal on the PSoC5.  There's a 32.768 clock crystal on the PSoC5, and another on a DS1305 real time clock chip.  Inside the PSoC5, everything should be in the kHz range.  So, frankly, I don't see how the PSoC5 can be generating it, either.  But it must?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Helmut, I am stumped.

   

 

   

One other possibility, no linear regulator is oscillating in and out of thermal shutdown ?

   

I have had that happen, and it is usually a Hz rate due to die thermal mass considerations.

   

 

   

If you power everything off, 8 Hz gone ? Are you in a flourescent lighting environment, if so

   

turn those off. Any other light dimmers off. Coffee pot heater turned off.......

   

 

   

Just guessing now........

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Helmut, are you yourself generating the 8 Hz, from something you ate or drank ?

   

 

   

Concerned, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Is there a chance that you copy the project and reduce module-by-module until the error vanishes or the project has reached a state that is so common that you may publish it.

   

Oh, and did you try to power your board with a battery?

   

 

   

quivering with 8Hz

   

Bob

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored
        I tried to reproduce this. Unfortunately neither the -001 nor the -050 kit has pin P15[5] on a header, so I used my -050 and used pin P4[0] (with a CY8C5588AXI-060ES1 on it). I added a Vref, and used a Opamp as buffer to get it on a pin P4[1] (not using the Opamp meant that adding the 200k load would drop its voltage from 1V to about 200mV...). I then configured a second analog pin on P4[0], and routed it to a DelSig ADC (so it won't get optimized out). But measurements showed no voltage drop, and I could not observe any signal (apart from the noise I could observe otherwise on the scope). Especially there was no square signal to be seen.   
0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored
        Could it be that you switch some component on and of in a regular fashion? The signal to be seen in your image seems to have rather slow rise and fall times (several µs), it doesn't look like a real square wave. And it doesn't look like 50% duty cycle too.   
0 Likes
Anonymous
Not applicable

1. Do you have any routine that would run at this frequency? ie a counter/timer ISR? 

   

2. Would it change if you change all the internal clocks to a different frequecy? 

   

3. If all failed. May be try a different chip. 

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        Hi there, I have made a similar Pin and observe it. Yes, I can see 8Hz noise at the scope. So, for more detail try to see it on analyzer scope. I guess that is from utility power supply. Doubled frequency of 60Hz, 120Hz. It shows -76dBV, around 100uV. It was measured Battery supplied PSoC5 board, On well grounded Iron table however. There are many noise source around.   
0 Likes
Anonymous
Not applicable

@PSoC73. 8hz is sub-mulitples of the power line frequency, not the harmonics. Did you have the noise with a battery supply? Is your configuation just setting the input and do nothing?

0 Likes
Anonymous
Not applicable

@Helmut,

   

Would there any other location of code accesing the pin? ie reading or writing?

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        Yeah HL-san, "Konnitiwa" Yes the board drived by battery and do nothing. Measured pin is P0-0, output of op-amp.   
0 Likes
Anonymous
Not applicable
        [ 8Hz noise ] -> [ 8m.sec noise ]   
0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        Oh! I'm quite confused at all. Actual noise is here. And analysis of 0 to 50Hz is next. No particular noise around 8Hz. If you worry of noise, have to use OP-amp output pin.   
0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
0 Likes
Anonymous
Not applicable

@PSoC73.

   

1. The original post is haveing the pin as a HI-Z input not an op-amp output.

   

2. The period of the square wave from  Helmut is around 120mS, not 8ms.

   

3. The noise is a square wave of around .1V pp, yours is lower and is of different shape.

0 Likes
Anonymous
Not applicable

@Helmut.  I guess you already check the type setting of the pin to analog only.

   

The loading at the pin is either has a high impedance or a high capacitor as the square wave have a slow rising. It could be a leakage from adjacemnt pin or track or inside the chip.

   

Have you try to swap the pin with another pin and see if that nosie goes away?

0 Likes
Anonymous
Not applicable

Dana: you made me laugh.  Thanks.  An engineer's joke later in this post.

   

All others: great conversation, generating many ideas.  I was hopeful that PSoC73 was reproducing, but I believe you folks eliminated that.  Bottom line, I believe the best path is the reduction route suggested by Bob (who's helped me before).  This is both (1) consistent with my favored divide and conquer approach to solving inexplicable problems, and (2) if it doesn't lead to a solution will lead to a simplified example I can share with others.  So that's what I'll do next when back on this task.

   

The following is pure EE humor, provided in as dull a manner as I can.  Have you ever had something working, and as soon as the boss comes in to see it, it quits?  Well, this is due to "aura flux".  Think of the right hand rule, and how magnetic field lines moving across a conductor will induce a current, up or down.  Well, the boss has an aura.  When the boss comes in, the aura flux lines cross your project and push it down, to fail.  Then, when the boss leaves, the aura flux lines cross in the other direction and pushes your project up, and it starts working again.  The near homonym to "flux" is intended.  Aura Flux!

   

-Helmut

0 Likes
Anonymous
Not applicable

Nasty junk!
If person of seriously who should be
upload a bundle-project and wave form.      

0 Likes
Anonymous
Not applicable

RESOLVED.

   

Dana wrote, "Your scope is not aliasing due to improper sweep settings ?"

   

I wrote, "FYI, I've been doing this type of work for over 20 years, so a snafu like scope settings, while always possible, is very unlikely."

   

...I did say "always possible".

   

After whittling down the project to almost nothing, I discovered a 5Hz clock on my board feeding a circuit that worked but couldn't possibly work with such a slow clock. Knowing what the clock should be, I then discovered the 5Hz waveform was really 500kHz. Scope aliasing! That clock line was running parallel to my offending signal line.   I have a noise isolation resistor before my point of use, but it wasn't enough.  Now knowing it was 500kHz and not 5Hz, a reasonable capacitor value could be added to my point of use, piggybacked on the 100K to ground, thus temporarily curing the problem.  The final fix is to make a true home for the cap and change the routing so those two lines aren't parallel.

   

Doh!

   

Thanks for all your help.

   

-Helmut

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored
        Glad you got it resolved. Congratulations! And as usual, Dana was right on the spot 🙂   
0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Side by side I have a 2 Ghz DSO and a 1 Ghz fully analog scope, and use

   

them all the time, especially to have the analog scope verify the DSO. Saved

   

my rear end many times on things I did not understand the DSO was telling me.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 For those poor guys that can't afford to get those scopes. any suggestion to avoid this trap?

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

To avoid the aliasing problem with a DSO, start always with the fastest time scale, and work down from there until you see ther waveform you want to analyze. For a nice explanation look here: http://readingjimwilliams.blogspot.de/2012/09/vintage-scopes-are-better-part-5.html

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

The DSO (LeCroy 7200A) cost me used $ 250, the analog (Tek 7104) ~ $ 200.

   

They are boat anchors but very usable. The DSO I repaired, the Tek was

   

operational.

   

 

   

The Tek 7000 series mainframes have many plugins, its 1970's/1980's  technology,

   

and super useful. The 7854 has a CPU and performs many measurements, and can

   

do equivalent time sampling, good to 500 Mhz. 7104 a fully 1 Ghz analog scope. Still

   

a lot of used ones available. Both supported on Yahoo groups for repair and cal.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable
        Wow, $200 and $250. Dana was a nice shopping. I didn't know Tek7104 has 1GHz bandwith. My most high frequency is 4GHz sampling DSO upto 500MHz bandwith. And 400MHz analog, Tek2466B.   
0 Likes
Anonymous
Not applicable
        4GHz ---> 2GHz   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked
        This example perfectly shows the math power behind the "divide et conquera" method: When the project goes down to zero and the error persists it is independent of your project. Nice work! Bob (small window)   
0 Likes