7 Replies Latest reply on Jul 10, 2018 12:35 AM by karthik.sivaramakrishnan

    FX3S USB Bulk In (MIDI) no longer working

    DragonflySynths

      Good morning!

       

      After

      • updating SDK to 1.3.4
      • random Windows 10 update
      • some modifications to the code

       

      I have somehow broken a previously functional USB Bulk In interface. The device still enumerates properly as a composite device with MIDI IN and OUT, but any attempt to send bulk data from FX3 to Host through endpoint 0x82 results in error 0x45 (CY_U3P_ERROR_TIMEOUT).

       

      I have found that a previous build is functional, which rules out a Windows / Driver issue. Does anyone know of any issues which may affect SDK 1.3.4? I am having trouble finding a 1.3.3 download link, so that I might run parallel installations.

       

      Furthermore, any tips on debugging USB interfaces in general are greatly appreciated.

       

      For completeness, here is the MANUAL OUT DMA channel initialization code, identical to the working version, which runs without error:

       

       

       

      // function call to initialize outbound channel

      CyU3PReturnStatus_t initDebugChannel(void){

       

      CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;

       

      CyU3PEpConfig_t epCfg;

      CyU3PMemSet((uint8_t *) &epCfg, 0, sizeof(epCfg));

       

      /* MIDI consumer endpoint config */

      epCfg.epType = CY_U3P_USB_EP_BULK;

      epCfg.enable = CyTrue;

      epCfg.isoPkts = 1;

      epCfg.burstLen = 1;

      epCfg.streams = 0;

      epCfg.pcktSize = 64;

       

      apiRetStatus = CyU3PSetEpConfig(0x82, &epCfg);

      apiRetStatus |= CyU3PUsbFlushEp(0x82);

       

      CyU3PDmaChannelConfig_t dmaCfg;

      /* Create a DMA manual channel for sending parameters */

      /* Active on initialization */

      dmaCfg.size = 64; // minimum buffer size is 16

      dmaCfg.count = 8; // 8 buffers cause why not

      dmaCfg.prodSckId = CY_U3P_CPU_SOCKET_PROD;

      dmaCfg.consSckId = CY_U3P_UIB_SOCKET_CONS_2;

      dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;

      dmaCfg.notification = 0;

      dmaCfg.cb = NULL;

      dmaCfg.prodHeader = 0;

      dmaCfg.prodFooter = 0;

      dmaCfg.consHeader = 0;

      dmaCfg.prodAvailCount = 0;

       

      //create manual out channel to usb

      apiRetStatus |= CyU3PDmaChannelCreate (&DebugChannel, CY_U3P_DMA_TYPE_MANUAL_OUT, &dmaCfg);

      apiRetStatus |= CyU3PDmaChannelSetXfer(&DebugChannel, 0);

       

      return apiRetStatus;

      }

        • 1. Re: FX3S USB Bulk In (MIDI) no longer working
          srnt

          Hello Dragonfly Synths,

           

          - Please let know if you mean to say that the same firmware code worked fine with the SDK 1.3.3 and is not working now. If yes, please let me know if you are using any Cypress provided host applications to perform the data transactions.

          - Since you have mentioned "some modifications to the code", kindly, let know the modifications.

          - Also, kindly, ensure that the data is committed to the host using the CyU3PDmaChannelCommitBuffer() API.

           

          Best regards,

          Srinath S

          • 2. Re: FX3S USB Bulk In (MIDI) no longer working
            DragonflySynths

            Thank you for your quick reply. I will respond to your questions in order.

             

            • Yes, the .img file associated with a previous GIT commit is functional, while the same code built with 1.3.4 is not. I no longer have a copy of 1.3.3 to build with, and cannot find one in the archives. Data transactions are performed by Windows' default MIDI driver.
            • "some modifications to the code". Sorry, I was unclear here. I had changed the RAM allocation layout, as well as some unrelated code, but had fully reverted it to test the 1.3.4 build of the previous source.
            • Yes, data out is written as the following:

             

            // sends supplied buffer directly

            CyU3PReturnStatus_t dragonDebugB(uint8_t * bytesToSend, uint8_t length){

            CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;

            CyU3PDmaBuffer_t dmaBuffer;

            apiRetStatus = CyU3PDmaChannelGetBuffer (&DebugChannel, &dmaBuffer, debugwaittime);

             

            if (apiRetStatus == CY_U3P_SUCCESS)

            {

            // Commit the buffer for transfer

            //dragonDebugS("COMITTING BUFFER!!");

            CyU3PMemCopy(dmaBuffer.buffer, &bytesToSend[0], length);

            apiRetStatus = CyU3PDmaChannelCommitBuffer (&DebugChannel, length, 0);

            }

             

            return apiRetStatus;

            }

             

            However, it appears to be filling the buffer, because CyU3PDmaChannelGetBuffer consistently returns 0x45.

             

            Is there a way I can obtain a copy of 1.3.3?

            • 3. Re: FX3S USB Bulk In (MIDI) no longer working
              srnt

              Hello Dragonfly Synths,

               

              Can you please check if the CyU3PDmaChannelCommitBuffer() API returns success? In case it does not return success, kindly, look for the error thrown.

               

              Best regards,

              Srinath S

              • 4. Re: FX3S USB Bulk In (MIDI) no longer working
                wu.zhijian_1557526

                Hi,

                Looks I have same issue like yours. I'm using SDK 1.3.3 with windows 10 random updates.

                In my new project, I'm using bulk_in and bulk_out for command receiving and echo back. but bulk_in always stop echo back after working a while. Finally I fixed this issue by add functions CyU3PLPMDisable() in dma call back.

                 

                Unfortunately, I didn't find out what cause this. Maybe Cypress engineer could give us some details.

                • 5. Re: FX3S USB Bulk In (MIDI) no longer working
                  DragonflySynths

                  CyU3PDmaChannelCommitBuffer() API returns success until the buffer fills up, at which point it no longer runs because a buffer cannot be got.

                   

                  I notice that the interface works for a short while after re-installing the device on Windows.

                   

                  This week I will try FX3 examples with BULK IN and verify their functionality on my board.

                  • 6. Re: FX3S USB Bulk In (MIDI) no longer working
                    DragonflySynths

                    I believe we have different problems, because CyU3PUsbLPMDisable(); is not sufficient to solve my issues.

                    • 7. Re: FX3S USB Bulk In (MIDI) no longer working
                      karthik.sivaramakrishnan

                      Hello Dragonfly Synths,

                       

                      You do not need to install SDK 1.3.3 to compile with the libs from SDK 1.3.3. The libraries and headers from all previous SDK releases are included in the SDK 1.3.4 package; and you can recompile your project against SDK 1.3.3 libs by changing the header and library search path.

                       

                      If you are using the latest project template (SDK 1.3.3 onwards), you can change this by changing the FX3SDKVERSION variable and rebuilding the code example.fx3_build_var.png

                       

                      If the project was originally created with an older SDK (older than SDK 1.3.3), you have two choices:

                      1. Create a new project using one of the templates from the SDK and replace the source files with those from your project.

                      2. Update the build settings to take the header files and libraries from C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\fw_lib\1_3_3 instead of C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\u3p_firmware.

                       

                      Best Regards,

                      Karthik