8 Replies Latest reply on Jan 8, 2016 5:34 AM by content.librarian

    PSoc 4200M unexpected behaviour

    content.librarian

      Please can somebody on this list enlighten me on the following problem:

         

      New to the PSoC devices I am trying to understand how they work.

         

      Made a simple program (software) to blink two LEDS where one LED is on the other is off.

         

      This worked as I aspect.

         

      Then I wanted to do the same in hardware (no programming involved)

         

      Put two dividers in serial, connected one LED directly  on the output of the second divider.

         

      In front of the other LED I put an NOT gate and connected the input of the NOT gate also

         

      with the output of the second divider.

         

      Expected behavior: One LED on the other LED off and vice versa.

         

      But both LEDS  blink at the same time (LED 1 on = LED 2 on etc.)

         

      See schematic attached,

         

       

         

      Thanks in advance for any entlightment,

         

      Giel Peters

        • 1. Re: PSoc 4200M unexpected behaviour
          user_1377889

          Welcome in the forum, Giel!

             

          Best to check your project is to provide us with *ALL* informations. Can you post your complete project, 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.

             

          A hint on which board you use (self-made? Development/Prototyping Kit? Which one??) can help us furthermore.

          • 2. Re: PSoc 4200M unexpected behaviour
            user_78878863

            Its interesting that this project compiles - I thought that all inputs of the dividers need to be connected (EN=high, Reset=low). Otherwise I can see no direct reason why this would occur.

               

            I would first check the wiring to see if its really as in the schematic (maybe you can share a photo?) (Btw: 10k seems quite high, that's less than 0.5mA LED current).

               

            (Also, its more effective to use a counter or a PWM component since it uses less resources than two dividers with such a high factor)

               

            A debugging hint: you can names to the nets (right-click, 'set name and width'). After a compile, you can open the *.rpt file which has the routing information, and the configuration of the UDBs / macro cells in it. I did this with a project done after your image, and it indeed says led2=!led1, so the NOT gate is clearly in there.

            • 3. Re: PSoc 4200M unexpected behaviour
              content.librarian

              I am using the kit: CY8CKIT-043 with the PSoC 4200M CY8C4247AZI-M485

                 

              I attached the projects workspace bundle (the name is misleading as I tried to implement this with a PWM module at first)

                 

              And yes 10k is a bit high but being in a learning fase (and some bad experiences) I am very fond keeping my board (chip) working.

                 

              Kind regards,

                 

              Giel Peters

              • 4. Re: PSoc 4200M unexpected behaviour
                user_1377889

                I just ran your project on my -044 Kit and all was well.

                   

                Where do you get the second LED from? there is only one user LED on the board??

                   

                 

                   

                Bob

                • 5. Re: PSoc 4200M unexpected behaviour
                  content.librarian

                  @ user_2273 You where right, checking the hardware (the schematic from the board) revealed that the led is connected with the cathode at Ground. I presumed (hearing the echo of one of my teachers: Never presume! Always check  and check once more!) that the LED on board was connected with the cathode at 5V. My own LED was connected with the cathode on 5V. So the line up was correct. When I removed the NOT-gate in the line to "my own" LED everything works as aspected!

                     

                  I tried to accomplish this with a PWM but until now to no avail. I shall examine some examples to see what I do wrong.

                     

                  Thanks for the comment and both of your time,

                     

                  Regards,

                     

                  Giel Peters

                  • 6. Re: PSoc 4200M unexpected behaviour
                    user_78878863

                    When I look back at all the errors in my projects, probably 90% of them where when I made assumptions and did not check the for correctness...

                       

                    For the PWM: just create a PWM component, feed it with your 12KHz clock, set the period to 12000 and the compare value to 6000. This should give you a 1Hz signal with 50% duty cycle.

                    • 7. Re: PSoc 4200M unexpected behaviour
                      user_1377889

                      When you have the choice between two wires to select the right one, the probability for a failure is 50%. But I can assure you that these 50% are used up to at least 100%     ,-)

                         

                       

                         

                      Bob

                      • 8. Re: PSoc 4200M unexpected behaviour
                        content.librarian

                        "Just" creating a PMW and act like you said is not enough. Because that is what I started with, to no avail. But examining the datasheet from the PWM revealed that you have to start it... (PWM_Start();) so adding this line of code to the main.c did the trick. Nice example of "looking further then a nose length" (I don't no if this is a correct translation of the Dutch saying: "verder kijken dan je neus lang is"...)