12 Replies Latest reply on Dec 21, 2018 4:37 AM by SananyaM_56

    Ecc when using the CY7C68023 controller

    Al--_865336

      Hi All!

      I work with the EZ-USB NX2LP-Flex™ CY7C68023 controller.

      By operation with a demonstration firmware with use of NAND flash noted one feature. If the device is connected on the USB 2.0 interface, then restoration of one-bit errors of flash memory happens correctly. And during the work on the USB 1.1 interface restorations of one-bit errors don't happen. Prompt whether it is possible to improve the program that on the USB 1.1 interface there was a restoration of one-bit errors too.

      Thanks a lot.

        • 1. Re: Ecc when using the CY7C68023 controller
          SananyaM_56

          Hello,

           

          -Please let us know how you are confirming if it is a one-bit error? If it is a two-bit error, it will only detect the error.

          -Could you please elaborate on what you mean by restoration of the one-bit error?

           

          Best Regards,

          Sananya

          • 2. Re: Ecc when using the CY7C68023 controller
            Al--_865336

            Hello,

             

            For check I write the reference file on flash, and then I read out it on USB 1.1 and USB2.0.

            When reading on USB1.1 errors one-bit errors are watched, when reading on USB 2.0 the file is read out without errors.

            I would like to upgrade a firmware so that when reading on USB 1.1 the file was read out without errors.

             

            Best Regards,

            Alexey

            • 3. Re: Ecc when using the CY7C68023 controller
              SananyaM_56

              Hello Alexey,

               

              Please let me know if this is correct- you are able to read the file in USB 1.1 as well but the one-bit error is not detected or corrected?

               

              Best Regards,

              Sananya

              • 4. Re: Ecc when using the CY7C68023 controller
                Al--_865336

                Hello Sananya!

                 

                When reading on USB 1.1 one-bit errors are not detected and not corrected.

                Instead of 0xFE it is read out 0xFF, and instead of 0x45 it is read out 0x55.

                Possibly it as that depends on the size of endpoint at different speeds.

                May be in function ECCSetup_EP4().

                I still not really well understood a firmware code.           

                 

                Best Regards,

                Alexey

                • 5. Re: Ecc when using the CY7C68023 controller
                  SananyaM_56

                  Hello Alexey,

                   

                  The difference in speed only determines the amount of data committed to the host in bytes, due to the maximum endpoint size. The one-bit error detection and correction should not be dependent on USB 2.0 or 1.1 host you read on. Could you please mention what NAND flash you are reading from? For firmware explanation, you can refer to the App Note on firmware notes.

                   

                  Best Regards,

                  Sananya

                  • 6. Re: Ecc when using the CY7C68023 controller
                    Al--_865336

                    Hello Sananya,

                     

                    There may be a problem in the ECCSetup_EP4 function?

                    if(EZUSB_HIGHSPEED()) is false, read from the flash memory without correction. Or I'm wrong?

                    NAND flash is MXIC, before that, there was the memory of Samsung. The problem was the same.

                    I write reference file to flash, then read and compare on different usb speed. Usb 2.0 is OK. Usb 1.1 is 1-bit error

                     

                    Best Regards,

                    Alexey

                    • 7. Re: Ecc when using the CY7C68023 controller
                      Al--_865336

                      Hi All!

                      The problem is still not solved.

                      We bought development Kit cy3686. I see that default firmware not correct 1-bit errors on USB speed lower USB HiSpeed. May be this code from function ECCSetup_EP4() work not correctly:

                       

                           if(EZUSB_HIGHSPEED())
                           {
                               P_EP4BCH = 0x02;
                               P_EP4BCL = 0x00;
                           }
                          else
                          {        
                                  while(!(gpifIdle()));
                                          
                                  NandSetAdd(cNAND_READ_DATA, xLBA3&SectorbCntMsk);
                                  while(!(P_EP4CS&bmEP4EMPTY));
                                  _nop_();
                                  P_FIFORESET = 0x04;
                                  _nop_();
                                  P_EP4CFG =  EP4CFG_DEFAULT;
                                  P_EP4FIFOCFG = (bmINFM | bmAUTOIN);
                                  
                                     EP4AUTOINLENH = MSB(64);
                                  EP4AUTOINLENL = LSB(64);
                      
                                  P_GPIFTCB1 = MSB(527);              // Setup GPIF count high
                                  P_GPIFTCB0 = LSB(527);
                      
                                  GPIFTRIG = 0x04 | cEP4; _nop_();
                                  while(!(gpifIdle()));
                                  while(!(P_EP4CS&bmEP4EMPTY));
                                  P_INPKTEND = 0x84;
                                  P_EP4FIFOCFG = 0;
                      
                          }
                      

                       

                      If USB speed lower than usb HiSpeed, data reread from flash without correction 1-bit errors. Help me please upgrade this firmware for correction 1-bit errors on USB speed lower USB HiSpeed?

                      May be to use the temporary array for corrected data?

                       

                      Best Regards

                      Alexey

                      • 8. Re: Ecc when using the CY7C68023 controller
                        SananyaM_56

                        Hello Alexey,

                         

                        As you suggested, please copy the data into a temporary array where the data is corrected after the last retry and compare it with the data on the host. Please let us know the status after trying that out.

                         

                        Best Regards,

                        Sananya

                        • 9. Re: Ecc when using the CY7C68023 controller
                          Al--_865336

                          Hello Sananya,

                           

                          I do not quite understand how the reading mechanism works.

                          Can you help me modify this firmware correctly?

                           

                          Best Regards,

                          Alexey

                          • 10. Re: Ecc when using the CY7C68023 controller
                            SananyaM_56

                            Hello Alexey,

                             

                            Please add the following code snippet to read the data on your application before being committed in 64 byte packets for full speed/low speed.

                             

                            if( (ecc0[0] != ecc1[0]) || (ecc0[1] != ecc1[1]) || (ecc0[2] != ecc1[2]) || (ecc0[3] != ecc1[3]) || (ecc0[4] != ecc1[4]) || (ecc0[5] != ecc1[5]) )

                                if(CorrectData_EP4())

                                {

                                RetryCount--;

                                }else DataFail = 0;

                            } else DataFail = 0;

                            for(int i=0; i<512<i++)

                            {

                                temp[i]= EP4FIFOBUF[i];

                            }

                            } while(RetryCount&&DataFail);

                             

                            if(DataFail)

                            {

                            bErr = 1; bCnt = 0;

                            }

                            }

                             

                            Please let me know if there is still an issue with the compilation as discussed.

                             

                            Best Regards,

                            Sananya

                            • 11. Re: Ecc when using the CY7C68023 controller
                              Al--_865336

                              Yes, the issue exists.

                               

                              During creation of an array of temp:

                               

                              My Code:

                               

                              ......

                              void ECCSetup_EP4()

                              {

                                  BYTE dummy_read;

                              static BYTE  temp[512];

                              ......

                               

                              or

                               

                              ......

                              BYTE  temp[512];

                               

                              void ECCSetup_EP4()

                              {

                                  BYTE dummy_read;

                              ......

                               

                              the compiler gives an error message

                              "inand.c(722): error C249: 'DATA': SEGMENT TOO LARGE"

                               

                              Settings of memory are made according to AppNote AN61347.

                              memory_setting.jpg

                               

                              I am using Keil 5.

                               

                              Maybe someone already faced this problem.

                              • 12. Re: Ecc when using the CY7C68023 controller
                                SananyaM_56

                                Hello Alexey,

                                 

                                The firmware modifications to the NX2LP firmware is not feasible as we checked due to the large size and since the error correction may not have been tested completely in full speed mode, we are not able to guarantee the same. Kindly connect to the USB 2.0 interface where there is proper restoration of the one-bit error.

                                 

                                Best Regards,

                                Sananya