1 2 Previous Next 20 Replies Latest reply on Mar 14, 2015 11:23 PM by user_14586677

    Power Surge on a Pin connected After Counter

    petar.petrov

      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?

        • 1. Re: Power Surge on a Pin connected After Counter
          user_14586677

          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.

          • 2. Re: Power Surge on a Pin connected After Counter
            petar.petrov

            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.

            • 3. Re: Power Surge on a Pin connected After Counter
              user_1377889

              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

              • 4. Re: Power Surge on a Pin connected After Counter
                user_14586677

                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.

                • 5. Re: Power Surge on a Pin connected After Counter
                  user_1377889

                  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 

                  • 6. Re: Power Surge on a Pin connected After Counter
                    user_14586677

                    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.

                    • 7. Re: Power Surge on a Pin connected After Counter
                      user_1377889

                      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

                         
                      • 8. Re: Power Surge on a Pin connected After Counter
                        user_14586677

                        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.

                        • 9. Re: Power Surge on a Pin connected After Counter
                          petar.petrov

                          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???

                          • 10. Re: Power Surge on a Pin connected After Counter
                            user_14586677

                            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.

                            • 11. Re: Power Surge on a Pin connected After Counter
                              user_1377889

                              "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

                              • 13. Re: Power Surge on a Pin connected After Counter
                                petar.petrov

                                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 :)

                                • 14. Re: Power Surge on a Pin connected After Counter
                                  petar.petrov

                                  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?

                                  1 2 Previous Next