FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: VNC2 Firmware Update over USB  (Read 1758 times)

TylerTiede

  • Newbie
  • *
  • Posts: 4
    • View Profile
VNC2 Firmware Update over USB
« on: May 03, 2018, 07:25:18 PM »

Hello Everyone,

I am using the VNC2 chip on a custom board. I have successfully implemented the firmware update and reflasher rom onto the board (the firmware update app code is given below). I have a customer I send updates to regularly, but we have run into a problem where the firmware update will not work occasionally. We have narrowed it down to the call:
       file = fopen("FWUPDATE.ROM", "r");

This command won't open the file because there is not enough heap space left. We believe this to be the case due to it working after reducing a couple stack sizes on our threads. Is there a way to allocate the heap space on startup for the fopen command? Is there a way to separate the firmware update over USB completely from the application code (ie on bootup it selects between update or app code)?

My understanding is when using firmware updates, the ROM size is cut in half. One half is for the current loaded ROM, and the other half is to upload the new firmware. This observation is based on the offset used when flashing the reflasher ROM following AN_159. Is there a way to limit the size of my app ROM file, and if so what is the max ROM file size before the reflasher code gets overwritten? I have also had the problem of my ROM being too large and overwriting the reflasher code. 

void Firmware_Update(void){
   unsigned char status;
   usbhost_device_handle_ex ifDev;
   usbhost_ioctl_cb_t hc_iocb;
   usbhost_ioctl_cb_class_t hc_iocb_class;
   // BOMS device variables
   msi_ioctl_cb_t boms_iocb;
   boms_ioctl_cb_attach_t boms_att;
   // FAT file system variables
   fat_ioctl_cb_t fat_ioctl;
   fatdrv_ioctl_cb_attach_t fat_att;
   FILE *file;
   hBOMS = boms_attach(hUSBHOST_1, VOS_DEV_BOMS);

         if (hBOMS == NULL)
         {
            
         }
         else
         {
            hFAT_FILE_SYSTEM = fat_attach(hBOMS, VOS_DEV_FAT_FILE_SYSTEM);

            if (hFAT_FILE_SYSTEM == NULL)
            {
         
            }
            else
            {
               // lastly attach the stdio file system to the FAT file system
               fsAttach(hFAT_FILE_SYSTEM);

               // now call the stdio runtime functions
            problem---->   file = fopen("FWUPDATE.ROM", "r");

               if (file == NULL)
               {
         
               }
               else
               {
            
                  //printf("Calling firmware update\n");
         
                  status = FirmwareUpdateFATFile(file, REFLASHER_OFFSET);

                  //printf("Returned %d\n", status);

                  fclose(file);
               }

               fat_ioctl.ioctl_code = FAT_IOCTL_FS_DETACH;

               vos_dev_ioctl(hFAT_FILE_SYSTEM, &fat_ioctl);
               vos_dev_close(hFAT_FILE_SYSTEM);
            }

            boms_iocb.ioctl_code = MSI_IOCTL_BOMS_DETACH;

            vos_dev_ioctl(hBOMS, &boms_iocb);
            vos_dev_close(hBOMS);
         }
}
Logged

FTDI Community

  • Administrator
  • Sr. Member
  • *****
  • Posts: 341
    • View Profile
Re: VNC2 Firmware Update over USB
« Reply #1 on: May 04, 2018, 01:46:08 PM »

Hello,

Please see AN_151 Vinculum II User Guide for all available functionality.

You can also use the IDE's help menu to easily search. This function might be useful to you:



If you have any further detailed questions which might need involvement from R&D, please contust us directly.

Best Regards,
FTDI Community
Logged