5 Replies Latest reply on Nov 29, 2016 10:23 AM by brendan_merna_1545636

    Bootloader Tutorial

    bmernax30_1545631

      I'm looking for help on understanding the bootloader and bootloadable components of the PSOC Creator. I've looked at the forums a lot and seen some of the tutorial videos, but I'm still confused on how exactly to implement this.
       

         

      End Goal: Running a CPU with Android on it connected to a PSOC microcontroller and capsense touch pad via I2C. I want to be able to update the firmware of the touchpad controller with a custom driver using the CPU to do I2C writes to the bootloader.

      To get an understanding I'm starting with a simple project using LEDs to indicate switches between the bootloader project to two bootloadable projects on the PSOC 4000 kit.

      I used the Bootloader Example project provided by Cypress and the two bootloadable projects which will simply toggle the red or green LED depending on which one is called by the bootloader. I call the Bootloader_Start() function in my bootloader main.c and then I poll two buttons attached to gnd and an IO. When the button is pressed the I call Bootloader_Exit() with the application ID of one of the bootloadable projects. The project then should begin to run and exit when the button is released.

         

      Things I think I got wrong:

      1.) While debugging the bootloader after I call Bootloader_Start() the code doesn't continue to run into the polling part. How do I properly implement this, so that if none of the buttons were pressed I would theoretically be able load an updated firmware for one of the bootloadables? (Soon I'll get to the point of using the bootloader utils api to create the custom driver to do this, not there yet though)

         


      2.) I've seen some mention in the forums that the PSOC 4000 kit board already goes into a bootloader program and what I'm doing here won't work unless I point the bootloadbles to the bootloader workspace that comes with the kit. Is there away to implement my own bootloader on the PSOC kit, so I can expand my understanding of how this works?

        • 1. Re: Bootloader Tutorial
          bob.marlowe

          The CY8CKit-049xx prototyping kits have got a bootloader pre-programmed. Because the bootloader must be protected from accidentally overwriting it, there is no way to replace it with another version by using the bootloader. What you will need is a MiniProg3 programmer or a KitProg which is the snap-off part of a CY8CKit-043 PSoC4-M Prototyping kit.

             

           

             

          Bob

          • 2. Re: Bootloader Tutorial
            bmernax30_1545631

            I have a Miniprog 3. How can I use that to help this?

            • 3. Re: Bootloader Tutorial
              bob.marlowe

              When you have got a miniprog3 you can write your own bootloader project and flash it into your board. There is an application "Bootloader Host" that interfaces the miniprog3 through an internal I2C - USB bridge with your target board.

                 

               

                 

              Bob

              • 4. Re: Bootloader Tutorial
                jbright_1593366

                "While debugging the bootloader after I call Bootloader_Start() the code doesn't continue to run into the polling part"

                   

                 

                   

                Did you figure this out?  I'd like to implement a "backdoor" to the bootloader as the docs suggest, where it stays in bootloader mode as long as the power-on button is released.  So I think I'd want to call Bootloader_Exit() after the button is released, but the Bootloader_Start() never returns to main, right?  "This method will never return."  So how do you ever use Bootloader_Exit()?

                • 5. Re: Bootloader Tutorial
                  brendan_merna_1545636

                  Ya, I figured this out. If you call Bootloader_Start() it will remain in bootloader mode unless you set a timeout where it goes into an application. That's set in the bootloader component. My application waits in bootloader mode for 2 seconds and then launched into a valid application if there is one.

                  You could poll the power_on button pin. If its pressed for 2sec call Bootloader_Start() if not call Bootloader_Exit()  and launch application.