2-stage boot loader seems not work!

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
dawa_2529456
Level 4
Level 4
5 sign-ins 5 solutions authored First solution authored

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

0 Likes
1 Solution

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

View solution in original post

21 Replies
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

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

0 Likes

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;

}

0 Likes

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,

0 Likes

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.

0 Likes

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

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.

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! 

lock attach
Attachments are accessible only for community members.

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

0 Likes
lock attach
Attachments are accessible only for community members.

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.

0 Likes

Dear Sir,

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

Thanks.

0 Likes

yes!

There are similar behavior with mine.

0 Likes

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

0 Likes
lock attach
Attachments are accessible only for community members.

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.

0 Likes

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

0 Likes

Dear Srinath,

I had enabled UART and if you download my img. will show "2-stage boot loader ...!" .

I change replace the PID value with 47 20,because the original PID show "Cypress FX3 Bulkloop example device “ in control center.

I will try Bus Hound to capture the interaction. and feedback to you.

Thanks.

0 Likes

Dear Sir,

ROM boot loader is working at usb2.0,but 2-stage boot loader is working at USB3.0,How to enforce  2-stage boot loader work at USB2.0?

Maybe working at USB2.0 is more stable?

Thanks.

0 Likes
lock attach
Attachments are accessible only for community members.

Dear Sir,

I capture a whole fail process by usb BUS hound, and attached below, also also UART will output " 3333....!",  which is added in myVendorCmdHandle().

Can you give me more suggestion?

Thanks.

0 Likes
lock attach
Attachments are accessible only for community members.

Dear Sir,

I capture a trace:  control center show” programming sucess", UART also output" 1111...!", but my firmware doesn't run.

0 Likes
lock attach
Attachments are accessible only for community members.

Dear Sir,

This is another fail trace, uart doen't output  "1111...!",which is different with fail1.txt, in fail1,txt, uart output "3333...!"

0 Likes

bulkin stream test.pngDear Sir,

I test a bulk in demo by streamer, it works well and stable. does it mean USB3.0 work well?

if yes, 2-stage boot loader shall work well at USB3.0, is it right?

Thanks.

0 Likes

Hello,

- The CyFx3BootUsbConnect() API parameters determine whether the 2-nd stage boot-loader is running in USB3.0 mode or 2.0 mode. When the second parameter of the above API is set to CyTrue, the 2-nd stage boot-loader runs in the USB3.0 mode.

- In the firmware that you have shared, there is no code that prints the debug statements. Can you please re-check once if you have shared the updated firmware?

- Also, mention if you are using the Cypress FX3 SuperSpeed Explorer Kit or is it your own custom design.

EDIT: Please test using the SuperSpeed Explorer Kit if possible. The issue is not found with the firmware that you have shared.

Best regards,

Srinath S

0 Likes