5 Replies Latest reply on Jul 26, 2018 1:29 AM by ricky.thomson_2593216

    Problems using 2nd Stage Bootloader

    ricky.thomson_2593216

      Hi,

       

      So I'm trying to understand the use of the 2nd Stage Bootloader and I'm having the following issue.

       

      I program the 2nd Stage Bootloader into the I2C EEPROM for the FX3 and set up the jumpers so that it will attempt EEPROM first. This part of the project works, as on startup, the device enumerates as my custom bootloader with custom serial number and ect... However when programming the 2nd stage bootloader with my final firmware (a modified FIFO) the success rate is typically only about 80%. The only modification I have made to the Fx3BootAppGcc, is switching CyFx3BootUsbStart (CyTrue, myUsbEventCallback); to CyFx3BootUsbStart (CyFalse, myUsbEventCallback);, so to enable booting from the USB once the 2nd stage bootloader has enumerated.

       

      Any advice on the poor success rate of programming my 2nd Stage Bootloader would be much appreciated!

       

      Kind Regards

        • 1. Re: Problems using 2nd Stage Bootloader
          aani

          Hi Ricky Thomson,

           

          Please go through the below link which specks about working of second stage bootloader.

          "Working of Second Stage Bootloader in FX3™ - KBA90266 "

           

           

          Best Regards,

          Anil Srinivas.

          • 2. Re: Problems using 2nd Stage Bootloader
            ricky.thomson_2593216

            Hey Anil,

             

            I've been through that document when initially setting up my FX3 firmware. I did find it a bit confusing where it says "Therefore, the bootloader must have the same descriptors as the main firmware.". Does this imply that my main firmware and my 2nd stage bootloader firmware must have the same descriptors (VID, PID, Manufacturer, Product)? If this is the case then my device would then be recognised as a bootloader device, rather than a streamer application device.

             

            Kind Regards

             

            • 3. Re: Problems using 2nd Stage Bootloader
              aani

              Hi,

               

              The ways of using the second stage bootloader:

              1. The first parameter of CyFx3BootUsbStart is CyTrue:

              - In this case there won't be re-enumeration when the final firmware starts executing.

              - You can jump back to second stage bootloader whenever required during the execution of the main firmware

              (Details of how to do it is mentioned in the KBA pointed in the previous post)

              - So, in this case, since there is no re-enumeration in the final firmware, the second stage bootloader should supply the descriptors of the main firmware during it's enumeration.

               

              2. The first parameter of CyFx3BootUsbStart is CyFalse:

              - In this case there will be re-enumeration when the final firmware starts executing.

              So, in this case, the bootloader need not have the same descriptors as the final firmware.

              - Jump to second stage bootloader during final firmware execution is also not possoible.

               

              Hope this is clear.

               

              Having, said the same, if you intend to use CyFalse in your second stage bootloader, then please let us know what problem you are facing?

               

              Regards,

              Anil Srinivas.

              • 4. Re: Problems using 2nd Stage Bootloader
                ricky.thomson_2593216

                Hey Anil,

                 

                Thanks for the reply. So my design is using option number 2 that you mentioned above. My problem occurs when loading my main firmware onto the fx3, whilst my 2nd stage bootloader is running (through the Cy Control Centre). Most of the time, the programming of the ram works correctly and re-enumeration occurs. However about 1/4 attempts to program the RAM will yield a "Programming Failed" result in the Cy Control Centre.

                 

                Thanks for clarifying the descriptor confusion.

                 

                Cheers

                • 5. Re: Problems using 2nd Stage Bootloader
                  ricky.thomson_2593216

                  I might also add, that it doesn't seem to be a hardware issue or a problem with my final firmware. As I've connected Jumper J$, so that the Fx3 loads the default bootloader. Then I can continue to load my main firmware into ram, with 100% success rate.