1 2 Previous Next 21 Replies Latest reply on Nov 16, 2018 3:07 AM by srnt

    2-stage boot loader seems not work!

    decai.wang_2529456

      Dear Sir,

       

      I compile Fx3BootAppGcc project( which is provided by SDK1.33  ) and download it into internal SRAM by control center and after re-enumerate, center show this picture,

       

      app title is "CYpress FX3 USB BulkloopExample Device", is it right?

       

      2-stage-bootloader.png

        • 1. Re: 2-stage boot loader seems not work!
          srnt

          Hello,

           

          - Please let know what is the boot mode that you have set in the Fx3BootAppGcc firmware. The macro definition decides the boot mode.

          - In case you have chosen I2C or SPI boot and loaded the Bulkloop firmware into an I2C EEPROM/ SPI flash, the second stage boot-loader takes the firmware content directly from the EEPROM/Flash.

           

          Best regards,

          Srinath S

          • 2. Re: 2-stage boot loader seems not work!
            decai.wang_2529456

            Dear Sir,

             

            The Macro just use USB_BOOT, no any change is made, I just compile this project and down load it into internal SRAM by control center.

             

            /*

            ## Cypress FX3 Boot Firmware Example Source file (main.c)

            ## ===========================

            ##

            ##  Copyright Cypress Semiconductor Corporation, 2011-2012,

            ##  All Rights Reserved

            ##  UNPUBLISHED, LICENSED SOFTWARE.

            ##

            ##  CONFIDENTIAL AND PROPRIETARY INFORMATION

            ##  WHICH IS THE PROPERTY OF CYPRESS.

            ##

            ##  Use of this file is governed

            ##  by the license agreement included in the file

            ##

            ##     <install>/license/license.txt

            ##

            ##  where <install> is the Cypress software

            ##  installation root directory path.

            ##

            ## ===========================

            */

             

             

            #include "cyfx3usb.h"

            #include "cyfx3device.h"

            #include "cyfx3utils.h"

            #include "cyfx3gpio.h"

             

             

            /* GPIO to be used for testing. */

            #define FX3_GPIO_TEST_OUT               (50)

            #define FX3_GPIO_TO_LOFLAG(gpio)        (1 << (gpio))

            #define FX3_GPIO_TO_HIFLAG(gpio)        (1 << ((gpio) - 32))

             

             

            /* Enable this for booting off the USB */

            #define USB_BOOT

            #ifdef USB_BOOT

            extern void

            myUsbBoot (

                    void);

            extern uint8_t glCheckForDisconnect;

            extern uint8_t glInCompliance;

            #endif

             

             

             

             

            /* Enable this for booting off the SPI Flash */

            /* #define SPI_BOOT */

            #ifdef SPI_BOOT

            extern CyFx3BootErrorCode_t initSpi (void);

            extern CyBool_t bootFromSpi (void);

            #endif

             

             

            /* Enable this for booting off the I2C EEPROM. */

            /* #define I2C_BOOT */

            #ifdef I2C_BOOT

            extern CyBool_t

            MyI2cBoot (

                    void);

            #endif

             

             

            /****************************************************************************

            * main:

            ****************************************************************************/

            int

            main (

                    void)

            {

                CyFx3BootErrorCode_t status;

                CyFx3BootIoMatrixConfig_t  ioCfg;

                CyFx3BootGpioSimpleConfig_t gpioCfg;

             

             

                /* HW and SW initialization code  */

                CyFx3BootDeviceInit (CyTrue);

             

             

                ioCfg.isDQ32Bit = CyFalse;

                ioCfg.useUart   = CyFalse;

                ioCfg.useI2C    = CyTrue;

                ioCfg.useI2S    = CyFalse;

                ioCfg.useSpi    = CyTrue;

                ioCfg.gpioSimpleEn[0] = 0;

                ioCfg.gpioSimpleEn[1] = 0;

             

             

                status = CyFx3BootDeviceConfigureIOMatrix (&ioCfg);

                if (status != CY_FX3_BOOT_SUCCESS)

                {

                    CyFx3BootDeviceReset ();

                    return status;

                }

             

             

            #ifdef SPI_BOOT

                /* Enable this for booting off the SPI */

                status = initSpi ();

             

             

                if(status != CY_FX3_BOOT_SUCCESS)

                {

                    return status;

                }

             

             

                bootFromSpi ();

            #endif   

             

             

            #ifdef I2C_BOOT

                /* Try booting from I2C and fall back to USB if it fails. */

                MyI2cBoot ();

            #endif

             

             

                /* Initialize the GPIO module. Force GPIO[50] low. Then request to retain GPIO state across boot. */

                CyFx3BootGpioOverride (FX3_GPIO_TEST_OUT);

                CyFx3BootGpioInit ();

             

             

                gpioCfg.outValue    = CyFalse;

                gpioCfg.driveLowEn  = CyTrue;

                gpioCfg.driveHighEn = CyTrue;

                gpioCfg.inputEn     = CyFalse;

                gpioCfg.intrMode    = CY_FX3_BOOT_GPIO_NO_INTR;

                status = CyFx3BootGpioSetSimpleConfig (FX3_GPIO_TEST_OUT, &gpioCfg);

                if (status != CY_FX3_BOOT_SUCCESS)

                    return status;

             

             

                CyFx3BootRetainGpioState ();

             

             

            #ifdef USB_BOOT

                /* Enable this for booting off the USB */

                myUsbBoot ();

            #endif

             

             

                while (1)

                {

            #ifdef USB_BOOT

                    /* Enable this piece of code when using the USB module.

                     * Call the new wrapper function which handles all state changes as required.

                     */

                    CyFx3BootUsbHandleEvents ();

            #endif

             

             

                    /* If there are any other tasks that this application needs to perform, they can be called from here. */

                }

             

             

                return 0;

            }

            • 3. Re: 2-stage boot loader seems not work!
              decai.wang_2529456

              Dear Sir,

               

              it is very curious I had rewrite PID with other char, recompile again, select right .img file to download it into internal SRAM, not spi flash memory(PMODE is still in usb boot ),  it is still show " Cypress X3 USB Bulkloop Example Device" in control center.

               

              Best regards,

              • 4. Re: 2-stage boot loader seems not work!
                decai.wang_2529456

                Dear Sir,

                 

                The PID in Fx3BootAppGcc project is 0x00F0, and I found it in cyusb.inf ,it will show "VID_04B4&PID_00F0.DeviceDesc="Cypress FX3 USB BulkloopExample Device" in Control center.

                 

                is it right?

                 

                BUT I cannot use control center download any img while Fx3BootAppGcc is working, can Control center work well with Fx3BootAppGcc ?

                 

                Thanks.

                • 5. Re: 2-stage boot loader seems not work!
                  srnt

                  Hello,

                   

                  - It is right that USB Bulkloop Example Device comes up because of the VID/PID combination in the INF file of the CYUSB3.SYS driver.

                  - In the CyFx3BootUsbStart() API, modify the 'no_ReEnum' parameter to CyFalse. Doing this would force the re-enumeration after the loading of main firmware. When this is set to CyTrue, the new firmware gets loaded but there will be no re-enumeration therefore the older descriptor details are retained.

                   

                  Best regards,

                  Srinath S

                  • 6. Re: 2-stage boot loader seems not work!
                    decai.wang_2529456

                    Dear Sir,

                     

                    I change PID into 0x4720,which is in cyusb.inf, and also change no_ReEnum  into CyFalse, just like following,

                     

                    apiRetStatus = CyFx3BootUsbStart (CyFalse, myUsbEventCallback);

                     

                    BUT it seem no change, Control center still show "Cypress FX3 USB BulkloopExample Device", and then I use control center to download img to internal SRAM, but show programming fails.

                     

                    Can you share me a workable 2-stage boot loader project ?

                     

                    Thanks.

                    • 7. Re: 2-stage boot loader seems not work!
                      decai.wang_2529456

                      Dear Sir,

                       

                      it is very strange :

                       

                      1: some times 2-stage bootloader can down my app firmware .img into internal SRAM very quickly, show " Programming Sucessded" and my app firmware run normally.

                       

                      2: some times  2-stage bootloader can down my app firmware .img into internal SRAM very slowly ,maybe take 3-4 seconds, show " Programming Sucessded" and my app firmware run normally.

                       

                      3: 2-stage bootloader can not down my app firmware .img into internal SRAM ,after 10 seconds, show " Programming failed" and then I  use control center to download img. the first time, control center will show “Please reset your device to download firmware", but I don't touch reset button, just execute  download RAM operation, control center show the dialogue window and I select img to download.

                       

                      so, can you give me some advice?

                       

                      Thanks! 

                      • 8. Re: 2-stage boot loader seems not work!
                        srnt

                        Hello,

                         

                        - I have attached a USB boot enabled 2-nd stage boot-loader firmware. Please do find the same.

                        - Does the 2-nd stage boot-loader show the mentioned three different behaviors for the same main firmware or for different main firmware IMG files?

                         

                        Best regards,

                        Srinath S

                        • 9. Re: 2-stage boot loader seems not work!
                          decai.wang_2529456

                          Dear Sir,

                           

                           

                          Thanks for your support!

                           

                          How to debug this issue? I had enabled UART port , it maybe output some debug info. please compare the attached 2-stage boot loader with original version (SDK 1.33 included), and download it into your CX3 board .

                           

                          I hope to get support from you further.

                           

                           

                           

                          Thanks.

                          • 10. Re: 2-stage boot loader seems not work!
                            decai.wang_2529456

                            Dear Sir,

                             

                            Can you reproduce these three behavior in your CX3 or FX3 board?

                             

                            Thanks.

                            • 11. Re: 2-stage boot loader seems not work!
                              decai.wang_2529456

                              yes!

                               

                              There are similar behavior with mine.

                              • 12. Re: 2-stage boot loader seems not work!
                                srnt

                                Hello,

                                 

                                - With the .IMG file that you have shared, I do not find failures. I am able to successfully download the main firmware.

                                - Please let me know if you had tried the .IMG file that I have shared and let me know the results. In case there are failures, please share the USB trace captured using a protocol analyzer like USBLyzer.

                                 

                                Best regards,

                                Srinath S

                                • 13. Re: 2-stage boot loader seems not work!
                                  decai.wang_2529456

                                  Dear Srinath,

                                   

                                  I had tried the img you shared days ago, it has similar behaviors with my own, I also fund another new behavior: the control center show " programming success" but I cannot see any trace information from UART,my firmware doesn't run.

                                   

                                  I add some trace in myVendorCmdHandler() for debug purpose.

                                   

                                  ROM boot loader can down my firmware into internal SRAM successfully every time. whatever cold power up or warm reset by reset button.

                                   

                                  Is there some different codes between ROM boot loader and 2-stage boot loader? Can I use Bus Hound to record the inter action?

                                   

                                  Thanks.

                                  • 14. Re: 2-stage boot loader seems not work!
                                    srnt

                                    Hello,

                                     

                                    - UART debug prints will be available only if the UART block is enabled in the firmware. Kindly, ensure this in your firmware.

                                    - In the first place, please confirm if the device is re-enumerating with the new VID/PID that is present in the main firmware descriptors after it is loaded using the 2nd stage boot-loader.

                                     

                                    Best regards,

                                    Srinath S

                                    1 2 Previous Next