6 Replies Latest reply on May 1, 2019 5:55 PM by BiBi_1928986

    Useage of GPIO Pins of target AND KitProg board in one program


      Good evening!


      I am using the PSoC 5LP CY8CKIT-059 controller.

      In the past I used the GPIOs of the target board only. I could work with these pins in the PSoC Creator 4.0.

      Now I would like to extend my program and need more GPIOs than the target board can provide.

      I have seen, that the KitProg Board has more GPIOs which I would like to use in my program (together with the GPIOs of the target board).

      Especially the header J8 has many GPIOs.


      My question:

      How can I use the pins of the KitProg Board in PSoC creator?

      I did not find out, how I can allocate I/O Pins of my TopDesign to the GPIO Pins of the KitProg board (only the target board was possible).

      Maybe a better question: How can I use also the pins of the header J8 and J9 (KitProg Board) and not only of the header J1 and J2 (target board)?


      Thank you for the support!


      Best Regards

        • 1. Re: Useage of GPIO Pins of target AND KitProg board in one program

          The headers J8 and J9 are connected to the CY8C5868LTI-LP039 on the KITPROG section of the CY8CKIT-059, not the main target CY8C5888LTI-LP097. Schematic is here <https://www.cypress.com/file/443786/download >


          All of the target pins are available on the main part of the board. If you want more pins to use from one application you will need to switch to a larger part such as the CY8C5868AXI-LP035 on the CY8CKIT-050 or the Sparkfun FreeSoC2 <FreeSoC2 Development Board - PSoC5LP - DEV-13714 - SparkFun Electronics >, or you could write a separate program for the KITPROG part.

          • 2. Re: Useage of GPIO Pins of target AND KitProg board in one program

            There's no simple way to show/add KitProg GPIO's to the top level design using Creator that I can think of.  After all, it is another 5LP, considered an external component relative to the target 5LP.


            That said, it's actually quite easy to use KitProg GPIO's and communicate with target 5LP.


            I highly recommend reading KitProg User Guide.  There's a section on writing your own bootloadable application and how to program it into KitProg 5LP.  BTW, you will loose the ability to program the target 5LP when you do this, but you can always recover the KitProg programmer provided you don't wipe out KitProg bootloader.  That's why your KitProg application has to bootloadable.  If you do loose the bootloader, then you'll need MiniProg3 to re-image the bootloader.


            So, as you've likely noticed, KitProg 5LP is connected to target 5LP using both UART and I2C.  The signals are hard-wired on pcb tracks that sneak in between the programming header pins.  The signals are brought out on KitProg J9 (just in case you've snapped KitProg off and wish to re-connect these signals).


            My opinion, write a simple application on KitProg to emulate an I2C slave GPIO expander chip.  There's a Creator component that will do all the hard work for you.  Or, you can use the built-in I2C fixed function.  Or, you could use UDB's and do the whole thing in hardware.


            If you need more flexibility, then go for the UART interface and design a protocol to communicate between the two processors.  A bit more complex, but gives more options.  The KitProg 5LP could even share some processing power, if needed.


            In both options, you'll need some code for target 5LP.


            Yes, this will drop 2 GPIO's from the target 5LP to implement a comm path, but you'll gain 6 GPIO's from KitProg J8 and 1 GPIO from J9.  If you're good at soldering, you can solder wires to KitProg 5LP un-used GPIO's.  That'll get you another 21 GPIO's (if I counted right).


            The downside, there will be a delay to change the GPIO state.  Serial communication takes time.  I2C (on 5LP) can support 1Mbit speed.  The UART component can support up to 4Mbps.


            I hope this helps.


            • 3. Re: Useage of GPIO Pins of target AND KitProg board in one program

              Thank you very much for your answers.


              This was not clear for me, that the KITPROG is a second device and is not an extension of the target board.

              Bill, your proposals are good and I have checked the KitProg User Guide.


              I have thought about this again. I can split my program and would program one part of the program on the KitProg Board and the second part on the target board.


              Unfortunately I can't program my program on the KitProg board.

              First of all, I changed in the PSoC Creator the device (new device: CY8C5868LTI-LP039). Then I tried to program the code on the PSoC and read in the output window, that the CY8C5888LTI-LP097 was programmed (and not the KitProg). --> I tested it and verified, that the GPIOs in the target board were used.


              Then I found the chapter 3.3 „Programming Using PSoC Programmer“ in the KitProg User Guide. I saved the program in creator, closed the creator, started the PSoC programmer and loaded the .hex file of the project.

              I selected the KitProg board as the device, set the Auto Detection off and tried to program it.
              Unfortunately that was not possible (please check the first attached screenshot – Auto Detection off).


              I tested also the behavior, if I set the Auto Detection to on (please check the second screenshot)

              Then the programmer chose the target board (CY8C5888LTI-LP097) automatically and I got a second fault code. I don’t know, why the programmer chose the target board automatically.

              Then it is clear, that the .hex file is not matching with the acquired device, because I have changed in PSoC creator the device to the KitProg board (info should be in the .hex file).


              Especially the first screenshot is unclear for me. I checked also the help in the programmer.

              I supplied the PSoC via the PC USB port. That was the reason, why I chose the programming mode „reset“.


              How can I program the KitProg board?


              Thank you for your help again!




              KitProg, Autodetection off.PNG


              KitProg, Autodetection on.PNG

              • 4. Re: Useage of GPIO Pins of target AND KitProg board in one program

                Hello Elias.


                You're almost there.  Just need some tweaking to your programming method.


                The programming procedure to program the KitProg 5LP, is different from programming the target 5LP on KIT-059.


                See KitProg User Guide chapter 7 (I'm referencing doc version G), Developing Applications.  The programming method uses Creator, Tools, Bootloader Host....  You select the files just as before, .hex, .elf, but for both your application and for the Bootloadable application.


                KitProg 5LP has a USB Bootloader installed when purchased.  It's very important to not wipe this out.  So, you need to create you application as a Bootloadable application.  This also means you need to add a Bootloadable component to your schematic.  This will increase your overall code size, but, that's how it's done.


                Follow chapter 7 and you'll be fine.  There are a few other details in chapter 7 to follow, but you can read them.  Nothing tricky.


                \When you go to program KitProg 5LP, there's a switch on the KitProg circuit board that you have to keep pressed (for about 1 second) as you connect it to the USB port.  Sometimes, I find it configures quicker if I connect it to the USB port before opening the "Bootloader Host..." window.  After it's been configured once, it doesn't seem to matter which order to follow for the next time.  Oh, and I never seem to get the same USB PID/VID values as shown in the guide.  Don't worry about it.  It still seems to work just fine.


                As a 1st attempt, make a simple app to blink the green LED (P3.1).  Drive a 1 to turn it ON.  That'll quickly verify your programming procedures.


                I'm familiar with the bootloader method because I also use Kit-049-4200.  It's programmed with this bootloader method.


                Let us know how it goes.



                • 5. Re: Useage of GPIO Pins of target AND KitProg board in one program

                  Hello Bill,


                  Thank you very much for your support.

                  Now it works and I can program the target board and KitProg Board. As you said, it is described in KitProg User Guide chapter 7.



                  1. 1. Finding of the KitProg_Bootloader.elf and KitProg_Bootloader.hex file in kit installer directory. These files are not available for the PSoC 5LP. I downloaded the layout files of the Kit-042 and used there the .hex and .elf files.

                  Topic is described: https://www.element14.com/community/thread/27067/l/psoc-5lp-programmer-firmware

                  1. 2. If I program a code on the KitProg (bootloader mode) and would like to switch back to the KitProg programing mode (Programming of the target board), the KitProg code will be deleted. Of course, it was possible to switch to the bootloader mode back and program the KitProg code again.
                    This programming order is needed:

                  a) Program the target board

                  b) Program the KitProg board


                  Bill maybe you know, how I can save the code on the KitProg Board and don't lose it, if I activate the programmer mode again.

                  If not, it is ok for me and I can work with this.





                  • 6. Re: Useage of GPIO Pins of target AND KitProg board in one program

                    Hello Elias.


                    Happy to hear about your progress.  Yes, it's a bit of a learning experience.  Once you've gone through the coding/programming a few times, you'll be very confident about it.  It also helps to keep good notes about the sequence of doing things.


                    To keep the new app in KitProg AND the original KitProg programmer code, it is possible to have a dual boot.  For dual boot, you typically read a GPIO input at power ON to decide which app to execute.  You can customize the Boot code to perform this function and then jump to the appropriate app.


                    Do a search on the PSoc 4 and PSoC 5 forums to find details about dual boot from other discussions.  I've not done this myself, but I've read about it in the forum somewhere.


                    I would recommend reading:

                    1) Introduction to Bootloaders, AN73854, it has a chapter on dual boot applications,

                    2) cy_boot Component documentation for both PSoC 4 System Reference Guide and 5 (002-12713 System Reference Guide) (2 documents, 1 for each processor),

                    3) "Bootloader and Bootloadable" component datasheet that you can fetch from Creator when you double-click on the bootloadable component in the schematic.


                    BTW, KitProg 5LP can run at 67MHz.  Whereas target 5LP can run 80MHz.


                    Best of luck with your project.