11 Replies Latest reply on Nov 30, 2012 8:42 AM by gayathri.vasudevan

    firmware Load from eeProm ( C2 boot)

    moeen.eragh

      I am using a cy7c68 usb controller. I am using a FPGA to simulate the behavior of an EEprom for cy7c68. I have successfully got C0 boot mode working. ( that is I have revised the inf file with th PID and VID that is stored on EEprom and the usb device is successfully recognized by the computer).

         

      But I couldn't get C2 boot mode working. I have done as exactly as it is said in the document and when I verify the I2C signals they are all working properly that is when EEprom acknowledges C2 boot mode, cy7c68 starts to read the specified bytes and at the end of the data record I assert the specific bytes required to bring 8051 out of reset. but the usb device is not recognized by the computer. Is there anyway to debug the problem? or maybe I have missed out an action required to get 8051 working? ( such as using the "wake up" pin!!?) . as I said when I inspect I2C signals, the behavior of cy7c68 is quite reasonable. I would like to add that I am almost sure about the correctness of the hex data stored on eeprom.

         

      tnx in advance

        • 1. Re: firmware Load from eeProm ( C2 boot)
          gayathri.vasudevan

           Hi,

             

           

             

          Try using Vend_ax example (that you get along with FX2LP DVK http://www.cypress.com/?rID=14321 examples) and read from EEPROM using vendor command and ensure that you are able to read out the whole firmware. Ensure the correctness of data as well. I fthis works, then it is something wrong with boot sequence alone.

             

          Whiel you are plugging in the FX2LP device, try to capture the USB trace using any USB analyzer traffic software and attach the same here. I would like to take a look at the same.

             

           

             

          Regards,

             

          Gayathri

          • 2. Re: firmware Load from eeProm ( C2 boot)
            moeen.eragh

            Thanks for ur answer. First of all I would like to say that I am using CY driver, not EZ-USB. I have tried something :

               

            I loaded C0 boot mode in my EEPROM(FPGA).( as I said before, this mode was working properly).I opened CYConsole and then EZ-USB,

               

            After that, I  downloaded the hexfile that I was wishing to keep on EEPROM by clicking the "download" button and navigating to my hex file.  I inspected the console and noticed that a bunch of extra data are downloaded tp some specific addresses before downloading "my hexFile". I did the same and kept these specific data in my EEPROM(first I provided VID PID,... and then these bytes). After that, my device was recognized by the computer az  "EZ-USB example device" . As I said before, I would like to use CY driver, not EZ-USB. Is there any way to figure out  what  these extra bytes are for CY?.

               

            To put it in a nutshell, I want to download the hex file for CY driver on an EEPROM, but apparently some extra data(apart from th VID,PID,DID,....) are needed to be kept on EEPROM too?, how can I figure out what they are?

               

            tnx

            • 3. Re: firmware Load from eeProm ( C2 boot)
              gayathri.vasudevan

               Hi,

                 

               

                 

              The firmware image that needs to be stored into EEPROM shoudl be an  iic file, and not hex file. Also, you need to use the "LARGE EEPROM" button from CyConsole, and not "Download" button. 

                 

              You can use the hex2bix utility provided alongh wtih FX2LP DVK to convert a hex file to an iic file.

                 

               

                 

              regards,

                 

              Gayathri

              • 4. Re: firmware Load from eeProm ( C2 boot)
                moeen.eragh

                Tnx for the reply.

                   

                Actually I had used hex2bix converter utility and converted the hex file into iic file and stored it on my EEPROM(FPGA). But it didin't work out. I did a test and that is in one example (bulkloop) there was a iic file included. I downloaded the iic file on my EEPROM and then the device was recognized by the computer which means there is no  problem in my FPGA interface side.

                   

                Let me give a bigger picture of what I am doing. We have a CY7C68013 on our board. Previosly, we used the controller without any EEPROM present. At that time, we used to load the 8051 "hex file" by the software.(C #code on PC side). The hex file was generated by Keil UV2. Everything was working properly.

                   

                This time we decided to keep our hex file on an EEPROM by C2 mode. As u said, I used the hex2bix utility to convert the hex file to an iic file to keep it on my eeprom. But the device is not recognized by the computer.

                   

                As u see, there is no problem with the original hex file, since it was once working. and I converted the same hex file into an iic file and stored it on my eeprom. So what is the problem?

                   

                tnx in advance

                • 5. Re: firmware Load from eeProm ( C2 boot)
                  gayathri.vasudevan

                   Hi,

                     

                   

                     

                   

                     

                  What is the size of the hex file? Also, what is the command used for converting hex to iic. Please post the full command line that was used to convert using hex2bix.

                     

                   

                     

                  Regards,

                     

                  Gayathri

                  • 6. Re: firmware Load from eeProm ( C2 boot)
                    moeen.eragh

                    Hi,

                       

                    Right now that I am posting a reply I dont have access to the hex file, but as I remember it was much smaller compared to the hex file of the included examples like bulkloop. I use the following command:

                       

                    hex2bix -i -f 0xC2 -o output.iic test.hex

                       

                    I let VID and PID be the default used by hex2bix.

                    • 7. Re: firmware Load from eeProm ( C2 boot)
                      gayathri.vasudevan

                       Hi,

                         

                       

                         

                      Please attach your hex and iic file here. I would like to test it at my end.

                         

                       

                         

                      Regards,

                         

                      Gayathri

                      • 8. Re: firmware Load from eeProm ( C2 boot)
                        moeen.eragh

                        Hi!,

                           

                        I solved the problem this way : I compared our uVision project source files with bulkloop source files. The similarity between them was the use of function TD_Poll() and the initializations. I copied our TD_Poll and initialize function into bulkloop TD_Poll and initialize function and generated the hex and iic file. After that the problem was solved. Apparently we should have considered some configurations in our Uvision source codes that were not needed when we loaded the hex file from software!  any way the problem got solved this way.

                           

                        I am facing another problem, that is when I opened CY console, I saw that there is only one alternate setting for interface 0(setting 0). I inspected the bulkloop source codes and in one of the files named "dscr.a51" I found out that only the alternate setting 0 is initialized. I revised the code this way: at the end of the last endpoint description (the fourth endpoint) of both high speed and full speed mode I added setting 1 description and after that 6 end point descriptions.(6 end points for alternate setting 1) . after generating the iic and hex file and downloading it onto my device, the usb device does not get recognized by the computer. is there anything else I need to do in order to have both alternate settings 0 and 1?. anyway I have attached the revised dscr.a51 file in case you need to see what I have done. I have used the comments "Revise Start" and "Revise End" to indicate which lines I have added to the code.

                           

                        Tnx in advance

                        • 9. Re: firmware Load from eeProm ( C2 boot)
                          gayathri.vasudevan

                           Hi,

                             

                           

                             

                          I believe from the description when you add alternate interface setting, the device does not even enumerate. If so, please ensure that every desriptor starts on a WORD-aligned boundary. In the descriptor file that you had attached, I noticed that the configuration descriptor has odd number of bytes. You need to ensure all of the descriptor (device desc, device qual desc, config descr, etc) starts at WORD-ALIGNED boundary.

                             

                          The following two KB articles would be useful in that case: http://www.cypress.com/?id=4&rID=31681and http://www.cypress.com/?id=4&rID=31685.

                             

                          You may also refer CYStreamer firmwar example that comes as part of Cypress SuiteUSB 3.4.7 (http://www.cypress.com/?rID=34870). In this also there are multiple alternate settings added in dscr,a51. Please refer the same. In that you can see that "org (($ / 2) +1) * 2" has been added prior to every descriptor start.  Please modify your dscr.a51 accordingly to start every descriptor at WORD-ALIGNED boundary, and let us know if that fixes the issue.

                             

                          Once it enumerates, you may issue the command to set the alternate interface setting using CyConsole. But you have to add handler that will handle the SET_INTERFACE command, for configuring teh appropriate endpoint config registers, You may refer the same example, CYSTREAMER and look at the DR_SetInterface() function to undertsand the same.

                             

                           

                             

                          regards,

                             

                          Gayathri

                          • 10. Re: firmware Load from eeProm ( C2 boot)
                            moeen.eragh

                            Hi,

                               

                            Tnx so much for ur help. The original bulkloop dscr file didin't include directives to make the descriptor tables word alligned?. Maybe it was done so accidentally?.

                               

                            I have another question. The iic File starts with C2, then VID,PID,.,,,, but in the the firmware responds to Get Descriptor request by its own VID and PID (which is a part of the desc table) so what is the use of the PID and VID provided first?

                               

                            tnx in advance

                            • 11. Re: firmware Load from eeProm ( C2 boot)
                              gayathri.vasudevan

                               Hi,

                                 

                               

                                 

                              I believe you will get the answer to your question under the section "Serial EEPROM Present, First Byte is 0xC2" in EZUSB-TRM (http://www.cypress.com/?rID=38232).

                                 

                              Excerpts from TRM:

                                 

                               

                                 

                              Note: Bytes 1-6 of a C2 EEPROM can be loaded with VID / PID / DID bytes if it is desired at some point to run the firmware with RENUM = 0 (i.e., EZ-USB logic handlesdevice requests), using the EEPROM VID / PID / DID rather than the develop-ment-only VID / PID / DID values (0x04B4/ 0x8613).

                                 

                               

                                 

                               

                                 

                              Regards,

                                 

                              Gayathri