2 Replies Latest reply on Nov 10, 2014 9:21 PM by danny.wang

    Why memory read failed while I set size to 0x4004, 0x4008, until 0x4018

    danny.wang

      Hi,

         

      Each time I tried to burst read size 0x4004, 0x4008 until 0x4018 or 0x8004, 0x8008 until 0x8018, it pop out "[ERR:] Burst read failed".  I have aleardy used DDR (1G Byte) to replace original 16KB Bram.

         

       

         

      Except these size, it can burst write, read and verify success. Do I need to modify source code in order to handle this problem. Because I am writing a .dll based on CyAPI.lib reference to FMCFx3RefDesign.

         

       

         

      Any advice will be appreciated.

        • 1. Re: Why memory read failed while I set size to 0x4004, 0x4008, until 0x4018
          kumr

           I'm not familiar with how "FMCFx3RefDesign" is implemented. If you can give us more details on how the firmware does memory reads and how FMCFx3RefDesign tries to do these reads, we can debug further.

          • 2. Re: Why memory read failed while I set size to 0x4004, 0x4008, until 0x4018
            danny.wang

             Hi,

               

             

               

            The device information is as following:

               

             

               

             

               

            Device Name :TB-FMCL-USB30(ver:01.20)

               

            Manufacturer Name   :TED  (VID-04EC PID-F001)

               

            Speed       :SuperSpeed

               

            BULK OUT,   MaxPktSize 12288 Bytes, MaxBurst 11, 0x01

               

            BULK IN,      MaxPktSize 12288 Bytes, MaxBurst 11, 0x81

               

            BULK OUT,   MaxPktSize 1024 Bytes, MaxBurst 0, 0x02

               

             

               

            Code about burst read is as following shown:

               

             

               

            #define MAX_BRAMSIZE (0x40000000) // 1G Byte

               

             

               

             

               

            typedef struct __tagCMDPKT{

               

            ULONG cmdcode;

               

            ULONG address;

               

            ULONG length;

               

            ULONG resv;

               

            }CMDPKT, *PCMDPKT;

               

             

               

             

               

            bool APICmd::EP2CmdRequest(CCyUSBEndPoint *ept, ULONG cmdcode, ULONG address, ULONG length)

               

            {

               

            bool retstatus;

               

            CMDPKT tcmdpkt;

               

            PBYTE pdatabuf;

               

            LONG datalen;

               

            //OVERLAPPED ioOvLap;

               

             

               

            // endpoint is null or not

               

            if (ept==NULL) return FALSE;

               

             

               

            // set the cmd packet parameters

               

            tcmdpkt.cmdcode = cmdcode;

               

            tcmdpkt.address = address;

               

            tcmdpkt.length  = length/sizeof(ULONG);

               

            tcmdpkt.resv    = 0;

               

             

               

            pdatabuf= (PBYTE)(&tcmdpkt);

               

            datalen = sizeof(CMDPKT);

               

             

               

            retstatus = ept->XferData(pdatabuf, datalen, FALSE);

               

             

               

            return retstatus;

               

            }

               

             

               

             

               

            bool APICmd::MemoryRead(ULONG Offset, ULONG ntotalsize, BYTE *pBuffer)

               

            {

               

            string str;

               

            LONG nunitsize;

               

            ULONG nrestsize;

               

            OVERLAPPED inOvLap;

               

            bool success = false;

               

             

               

            //-------------------------

               

            // get the data from USB

               

            //-------------------------

               

            nrestsize= ntotalsize;

               

            inOvLap.hEvent  = CreateEvent(NULL, false, false, "CYUSB_IN"); 

               

             

               

            //-----------------------------------------------//

               

            // set the offset and start the transfer

               

            if (EP2CmdRequest(CmdEndpt, CMD_MEM_READ, Offset, ntotalsize))

               

            {

               

            for (BYTE * tempBuf = pBuffer; nrestsize != 0; tempBuf += nunitsize, nrestsize -= nunitsize)

               

            {

               

            nunitsize = (nrestsize > MAX_BRAMSIZE) ? MAX_BRAMSIZE : nrestsize;

               

             

               

            // transfer the data

               

            // -----------Asynchronous method---------------------//

               

            UCHAR  *outContext = InEndpt->BeginDataXfer(tempBuf, nunitsize, &inOvLap);

               

            InEndpt->WaitForXfer(&inOvLap,2000); 

               

            success = InEndpt->FinishDataXfer(tempBuf, nunitsize, &inOvLap, outContext); 

               

             

               

            if(success == false) break;

               

            }//..for

               

            //-----------------------------------------------//

               

            //stop transfer(none)

               

            }

               

            else

               

            {

               

            success = false;

               

            }

               

             

               

            // close

               

            CloseHandle(inOvLap.hEvent);

               

             

               

            // set the status bar

               

            return success;

               

            }

               

             

               

             

               

            The attachment is FMFCFx3RefDesign document which I refered to. If it is still not enough to reach sticking point, then I can provide source code directly.

               

             

               

            Any advice will be appreciated. Best Regard.