Bootloader FW not working (successfully send FW to RAM, but does not enumerate after booting)

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

cross mob
ScMu_3165461
Level 1
Level 1

Firstly, I am using the "boot_fw" project in <SDK_ROOT>/firmware/boot_fw as the basis for my bootloader.

My goal is to have our device boot to this bootloader from SPI flash by default when it is turned on. It will then be recognized by the PC, and when our PC software runs, the PC software will quickly upload the latest version of the actual goal firmware that is shipped with our software to the FX3's RAM, and then have the bootloader boot the uploaded goal firmware.

Thus, I am using the USB_BOOT method inside of the "boot_fw" source code.

The only code I have changed are:

* The strings in the USB Device Descriptors (to rename the device).

* The VID and PID values (I have recompiled the host/Windows drivers to find these devices).

The "boot_fw" project was compiled and the image was uploaded to the device's SPI flash, from which it will boot at power up.

I can successfully upload the firmware to the CyFX3Device instance (which is correctly found and opened by the CyAPI library).

CyFX3Device::IsBootLoaderRunning() returns true before I call CyFX3Device::DownloadFw().

Furthermore, the internal method CyFX3Device::DownloadFwToRam() appears to return correctly. All of the downloaded FW data is uploaded back to the PC, and the byte-wise check/comparison shows that the data is correct.

However, as soon as the 0-length packet is sent to the device to tell it to call CyFx3BootJumpToProgramEntry(), Windows emits a "device disconnected" sound and the firmware doesn't seem to boot properly. None of the new device descriptors are sent to the PC, and no "device attached" sounds are emitted.

The device then reboots back to the bootloader firmware that was uploaded to the SPI flash.

The same Firmware image boots perfectly fine by uploading it to RAM using the built-in bootloader on the device.

So here is the general approach I have followed:

1. Use the "boot_fw" source code to compile a custom boot Fw image.

2. Upload this "boot_fw" image to SPI flash to be the default firmware that is booted.

3. Switch the FX3 out of bootloader/programming mode, so it loads the newly flashed "boot_fw" image by default.

4. Use CyAPI to download the intended device firmware to RAM, and have it boot.

Am I not doing something correctly? Should I be flashing my custom "boot_fw" to a different location, or is SPI flash okay?

0 Likes
1 Solution
ScMu_3165461
Level 1
Level 1

Hello,

I actually got it to work correctly.

I had to switch the first parameter of the method:

apiRetStatus = CyFx3BootUsbStart (CyTrue, myUsbEventCallback);

To False:

apiRetStatus = CyFx3BootUsbStart (CyFalse, myUsbEventCallback);

And now it appears to boot the primary FW correctly.

Why is this not set to CyFalse by default?

View solution in original post

0 Likes
2 Replies
ScMu_3165461
Level 1
Level 1

Hello,

I actually got it to work correctly.

I had to switch the first parameter of the method:

apiRetStatus = CyFx3BootUsbStart (CyTrue, myUsbEventCallback);

To False:

apiRetStatus = CyFx3BootUsbStart (CyFalse, myUsbEventCallback);

And now it appears to boot the primary FW correctly.

Why is this not set to CyFalse by default?

0 Likes

Hello,

The first parameter of the CyFx3BootUsbStart () API is a check for re-enumeration and is to set to CyTrue since there is no need for the device to re-enumerate even after loading the new firmware.

In general, the VID and PID of the "boot_fw" and the main firmware are to be kept the same and in this case, even after loading the new firmware, there won't be a need for re-enumeration.

But since you modified the VID and PID, there is a need for the USB block to re-enumerate for the device to come up with the new device VID and PID and to get recognized in the host.

You can keep the VID and PID of the "boot_fw" with your main firmware VID and PID and try using the 'noreenum'  parameter set to CyTrue.


Regards,

Yashwant

0 Likes