Power Surge on a Pin connected After Counter

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I am complete with my design, but I have one remaining issue. Please see attached image of the relevant components. Every time I power the board (  PSoC 4 CY8CKIT-049 42xx ) a LED connected to PO_YELLOW pin briefly flashes. I managed to detect it wit an Osciloscop and triggering on it. Pin PO_YELLOW is configured as Strong Drive (High-1) and PI_J2_SINGLE as high impedance digital (Low-0). Just to clarify PO are output pins and PI are input pins, all digital. PI_J2_SINGLE is used as a jumper to hardware connect to another pin on the chip. I can confirm, however, that the culprit is the Counter, which is 16bit UDB. If I connect PO_YELLOW directly on the comp port of the counter the behavior is replicated. Further info for the counter configuration: Period:5 Compare:1 Mode:EqualTo ClockMode:UpCounter

   

Any advice?

   

Do you want me share the project?

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

Did you config the pin "Initial State" high if you are driving LED low

   

to turn it on ? Or converse if driving pin high to turn on.

   

 

   

If you are in main() when the LED lights then you will have to change

   

code to handle this.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Did you config the pin "Initial State" high if you are driving LED low to turn it on ? Or converse if driving pin high to turn on.

   

- There is 470ohm resistor the led and ground, so i guess driving pin high. If change to strong drive initial low, means practically disabling the pin. Replicated it several times that regardless of how/where the pin is connected it always remains low 😞  Keep in mind I use the same configuration for all the rest of LEDs and none exibit the bahavior.

   

 

   

If you are in main() when the LED lights then you will have to change.

   

 

   

-I don't use main.c to do any logic it is all on the top design. Only enabling logic and setting the PWM to single shots, since the option is not available via its proeprties panel in the top designer.

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

Have a look into this apnote www.cypress.com/ and search for the word "initial".

   

You may set the drive mode to High-Z Digital and later in main() to Strong.

   

 

   

Bob

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

I believe if you set the global properties of a pin, by double clicking

   

it, then after reset is released those properties are invoked. So no

   

need to do any further pin writes unless you want to deviate what

   

you set pin to in its global properties.

   

 

   

From the ap note -

   

Startup and Low-Power Behavior
On reset, all GPIO pins start up in the High Impedance
Analog (HI-Z) mode with input buffers disabled and remain
in that mode until reset is released. Then each pin is set to
its initial configuration before invoking main() .

   

 

   

Regards, Dana.

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

As in the above appnote stated there is something peculiar about the PSoC4's IO-pins.

   

When initially set to low, as it should be done to avoid to flash the LED, the pin is disabled. 

   

To avoid that, some programming must be done.

   

 

   

Bob 

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

From the ap note -

   

 

   

Startup and Low-Power Behavior
On reset, all GPIO pins start up in the High Impedance
Analog (HI-Z) mode with input buffers disabled and remain
in that mode until reset is released. Then each pin is set to
its initial configuration before invoking main() .

   

 

   

1) During reset all GPIO in Hi Z analog

   

2) During reset input buffers disabled

   

3) When reset released each pin is set to its global properties (inferred)

   

4) Then main() is invoked

   

 

   

No other programming needs to be done ?

   

 

   

Regards, Dana.

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

Excerpt from AppNote:

   

 

   

 

   

Note

   

   

 

       

   

 

   

 

   

If you enable the HW Connection and disable the Output Enable (OE) for a digital output pin, the data register controls the pin's OE. The Initial State setting in the Component controls the initial value of the data register. Therefore, in such configuration, you should set the Initial State to High (1). If you set the Initial State to Low (0), the pin is disabled.

   

Bob

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

Seems like one more reason to drive the led on with a low

   

output, eg LED and its R connected to Vdd. In addition to the

   

fact that driving low yields more available current, or trade

   

off for less Pdiss. Eg. low side switch lower Rdson due to

   

no source bulk effect on Vth.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

I'm quite baffeled.

   

For the leds I can drive them low,but for all practical reasons keeping strong-drive initial:0 makes each pin simply disabled. Maybe I need C-API calls for that to work?

   

 

   

However, the big issue is that the leds are simply a visual aid. The real problem is, what if that happens with one of my output pins controling external hardware ? Obviously I cannto switch from driving high to low, since they expect only one mode of operation, let's say high on front.

   

 

   

Can anyone confirm if same behavior is exebited using the psoc 5 series?

   

 

   

To add further to the fire, when I compile in Release mode and deploy, I have now the green led firing in addition to the yellow. For me this is clearly undefined behavior, since nowhere I can find even a hint about this in official docs and not much insight, no offense, from this thread either 😞

   

I guess I can add relays on all outputs to safe-guard, but this will unnecessary add complexity to the final design 😞 anything else i can do???

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

From the beginning of the post you state the counter is the culprit.

   

Consider posting your project so forum can take a look at.

   

 

   

    

   

          

   

“File”                                                             Creator

   

“Create Workspace Bundle”

   

Use Firefox or IE or chrome to post.

   

 

   

 

   

Regards, Dana.

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

"Can anyone confirm if same behavior is exebited using the psoc 5 series?"

   

According to the datasheet this is specific to PSoC4s.

   

This is nothing that should bother you too much.

   

Since at power-on (and before) the pin's state is High-Z. This drive-mode should not be able to drive any signal. To be on the safe side you will have to take actions to externally set a safe voltage-level to such a pin, it will not be good to leave such a pin just floating. When you have an active-low signal you just set the pin to initial high at design-time. When it is an active high signal. set the pin to high-z at design-time and at your own initialization set the pin's output and the drive-mode to your needs.

   

 

   

Bob

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

Here is a project bundle.

0 Likes
Anonymous
Not applicable

I think I figured it out. The problem seems to stem from the way I have implemented the jumpers. I simply connect with an old HDD jumper two of the pins on the board. Inside PSOC creator I've defined the one as input (high impedeance initial:0) and the other pin of the jumper as output (strong drive initial:1). Something is bugging the chip in this configuration and I experienced even more non-expected behavior due to it. I will re-implement them using more standart ground to pin or Vcc to pin and not short-circuit pins on the chip 🙂

0 Likes
Anonymous
Not applicable

I quick question about High Impedance Digital Input pin:

   

Do I need a 10Mohm in serial for such pins, they way the recommend for Arduino?

   

When such pin is configured as default LOW. I keep having random flips to HIGH due to noise when the input is not connected, that is no cabble plugeed in the jack.

   

What is the recommended solution? The only thing I came up is to connect high impedance resistor ~100K in parallel. So activly the noise gets grounded.

   

Maybe I am better off using not high impedance as digital input ? My input is 5V TTL from another machine?

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

If you have a high Z pin connected to logic internally,

   

and leave it floating, then tie a R to ground (or Vdd), and

   

size it such that worst case leakage does not create a legit

   

undesired logic level.

   

 

   

Another way is no R, disconnect pin with a register write, and

   

ignore it. However that is not ideal as the pin could reach a level

   

where input buffer N and P MOS are both turned on, drawing a

   

lot of current in the totem pole. Its also not ideal becuse now the

   

internal route is floating.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Thanks,

   

exactly as I was thinking, but good someone with more exp. to verify it.

   

One thing, which still baffles me is the high-impedance part.

   

I measured the impedance on the cable coming from the external machine, it is 25ohm.

   

Not possible to meassure the resistance of the pin on PSOC side !? 

   

However, there is internal resistor for pins configured as pull up/down digi input, but it seems there is no high-impedance resistor for digital high impedance input pin !? At least it is not shown on the overview schematic in PSOC Creator. I can also assume there is none, otherwise I would not have the effect of easy flipping when pin left hanging.

   

If I connect 1 Mohm in serial, the schematic is not working anymore. So who is taking care of the high impedance ?

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

High impendancce is absence of a resistor an only leakage on the pin. No guaranteed input current min, only max.

   

When something does not work as expected you may upload your complete project here  so that we all can have a look at all of your settings To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.



Bob
 

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

To put it the other way round: High-Z / High-impedance input pin means that the pin itself has a high impedance (so it doesn't put any load to whatever is driving it). It does not mean that the pin can be driven by a high impedance driver - and a 1MOhm resistor is a high-impedance driver.

   

What happens in that case depends on many circumstances - how much impedance the PSoC pin presents in the current situation and how big the driving impedance is. E.g. when the actual input resistance is 1Meg, and you drive the pin with a 1Meg resistor, you have effectively a resistor divider cutting the voltage in half.

   

Btw: impedance is not only the resistance of the cable you have connected, but also the impedance of the circuit driving that cable.

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

If you have a pin that is in Hi Z, but you do not want the pin and its connection

   

to create an illegal logic level, then terminate it with some level of DC resistance.

   

So for example if leakage spec at worst case temp is 1 uA, and you terminate it with

   

1M ohm, then potentially it will either be at 1V from the rail you terminated to. In 5V

   

CMOS that implies you have achieved a 'legal" logic level.

   

 

   

An example is if you where driving the gate of a power MOSFET, and the pin driving

   

the gate was, for what ever reason, put into HiZ a R to ground would absorb the leakage

   

and keep the MOSFET off.

   

 

   

Do NOT place a 1M in series with the pin and its load, that destroys the AC performance

   

of data in/out of  GPIO pin. Typical Cin is 5 pF, so 1M and 5pF = 5 uS, so 5 x RC is 25 uS or 40 Khz,

   

so rise/fall times horrible.

   

 

   

HiZ means both N and P MOSFETS in the driver pinched off, then result is just a leakage

   

component of unknown sign, can be source or sink, no predicting. Also if you config a pin

   

to be HiZ analog in, and your source for the pin is also high impedance, the pin is very

   

subject to noise pickup due to C coupling. Sometimes HiZ can be a blessing, other times

   

a curse. In the latter case you drop the Z to minimize noise impact, but then you sacrifice

   

power by doing so.

   

 

   

Regards, Dana.

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

In case you are a little more curious about leakage, attached.

   

 

   

Regards, Dana.

0 Likes