5 Replies Latest reply on Jan 12, 2019 7:14 AM by pase_853586

    FX3S microcode reload Endpoint Problemm

    pase_853586

      Hello.

       

      I have one problem with using 2-stage bootloader in my device based on FX3S chip.

       

      Specially for demonstrate this I created test project and got the same problem.

       

      In my device I'm using FX3S chip.

      BootLoader is stored in I2C EEPROM.

      PMODE pin is in mode "FROM I2C".

      BootLoader I made from "boot_fw" sample from SDK folder.

      I changed only VID/PID to my own.

       

      Main FW is loading by USB to device RAM throw "DownloadFW" function of CyApi.lib.

      As FW I take the sample "cyfxbulklpmaninout" FROM SDK sample folder.

      I just add handler for backtoBootLoder request (VENDOR REQUEST ReqType=0xC0, Req=0x90).

      The result of my FW project is in attach file. (cyfxbulklpmaninout.rar)

       

      The problem is next:

       

      1) after device power on 2-stage bootloader ("boot_fw") starts OK.

        (It's OK. I can check it by debug string in terminal!)

       

      2) I use "DownloadFW" function from CyAPI.lib with params "cyfxbulklpmaninout.img" and "RAM".

      And the FW ("cyfxbulklpmaninout.rar") is loading into RAM and starts OK.

        (It's OK. I can check it by debug string in terminal!)

       

      3) I need to check that bulk EPs works correctly.

         I send sample packet with size 64 (for example, size is not important) to EP 0x1 (OUT).

        After this  I read 64 bytes from EP 0x81 (IN).

        (It's OK. I can check it by debug string in terminal!)

       

      4) I send VENDOR request (ReqType=0xC0, Req=0x90) to EP0 (Control) to call "JumpBackToBooter".

         And the code jump to bootloader ("boot_fw") succesfully.

        (It's OK. I can check it by debug string in terminal!)

       

      5) I use "DownloadFW" function from CyAPI.lib AGAIN to load the same file as in first time.

         FW ("cyfxbulklpmaninout.rar") is loading into RAM and starts OK again.

        (It's OK. I can check it by debug string in terminal!)

       

      6) And now if I try to send packet any size to EP 0x01 (OUT) the request will be not succesull!!

       

      But if I don't send the packet to EP 0x01 on step 3 and just make jump to bootloader then my checking of EP 0x01 on step 6

      will be successfull. But on the next reload the same FW I get the same problem as on step 6 in my sample.

       

      The problem as I can see the next: Endpoints which was using in previouse time of FW loading will not works anymore after the microcode reload  .

       

      You can check this problemm on you side.

       

      How to solve this problem?

        • 1. Re: FX3S microcode reload Endpoint Problemm
          YiZ_31

          Hi,

           

          As I have checked using our USB control center software, the firmware can't be loaded to RAM if I2C boot is used. So my understanding is that if you want to download firmware into RAM then you should use USB boot.

           

          Regards,

          Eddie

          • 2. Re: FX3S microcode reload Endpoint Problemm
            pase_853586

            Thank for your attention.

             

            But I think you are doing mistake.

            If you just try to load attached FW through Control Center it is another situation.

            Becouse "JumpBackToBooter" works ONLY if it was load from Booter with "no_Renum" options!

             

            To repeat the situation you need to write in I2C (or SPI EEPROM, I thhink it's does not matter) boot_fw sample with "USB_BOOT" mode and try.

             

            I will try to describe the situation more detailed.

             

            About Boot loader:

             

            1) PMODE pins is set to "LOADING FROM I2C".

            2) BootLoader is stored in I2C EPPROM which connected to FX3S by I2C bus.

            3) BootLoader is a replica of "boot_fw" sample from install directory of FX3 SDK.

            3) In this way BootLoader loaded correctrly and the device enumerated. There is no problem with it. PMODE pins works correctly.

             

            Afer this I use DonloadFW function from CyAPI.lib.

            This fucntion loading the MainFW to RAM and jump to Entry Point by using vendor specific commands from bootloader.

            PMODE pins does not matter in this time!

            My MainFW project is in attached file.

            And in the first time MainFW loaded successfull and all endpoints worked correctly.

            If I call "JumpBackToBooter" by sending request  (ReqType=0xC0, Req=0x90) to EP0 (Control) to MainFW I succesfully back to booter. And I can load MainFW and start it again!

             

            I can repeat it so time as I need. But! If I send any packet to any other EndPoint for example EP 0x01, in next time of Loading MainFW this Endpoint will be halted!

             

            The problem not in loading booter from I2C EPPROM but in multytimes loading MainFW and how EndPoints work between it.

            • 3. Re: FX3S microcode reload Endpoint Problemm
              SrinathS_16

              Hello,

               

              I am able to reproduce the mentioned issue at my end. As a possible workaround, please 'Abort' and 'Reset' the endpoints after the firmware is loaded into the RAM successive times. I find that the transfers are failing after the switch to second stage boot-loader because of a possible HALT condition on the endpoints. I shall try to identify the cause of the HALT condition and update you.

               

              The USB Control Center utility has got the 'Abort Pipe' and 'Reset Pipe' buttons which can be used to abort the pending transactions and clear any error conditions on the endpoint. Please use the code corresponding to these buttons as a reference for your implementation. The USB Control Center source code can be downloaded from the FX3 SDK webpage under the CyUSB3_Suite_Source.zip file.

               

              Best regards,

              Srinath S

              • 4. Re: FX3S microcode reload Endpoint Problemm
                pase_853586

                Thank's a lot. I'll try your recomendation and write the result.

                • 5. Re: FX3S microcode reload Endpoint Problemm
                  pase_853586

                  Thank's for your advice. After AbortPipe and ResetPipe oint my problem seem gone.