4 Replies Latest reply on Nov 8, 2020 6:49 PM by KUn_4718781

    PSOC 4 USB - data errors




      I have a mostly working USB project, with matching PC code.  The device side uses Auto-DMA to echo data back to the PC, and writes the data to a LCD.  It is Generic HID interrupt type, think AN82072 with the Auto DMA from USBFS: Use of APIs in DMA Auto Mode Memory Management .  It works both ways, but makes a noticeable number of mistakes.  It will display doubles of characters(ex: 0123455789).  It will sometimes drop characters.


      I could deal with this by using a field in the report for some sort of check, maybe packet numbers.  But that would be a waste of space in the report if there is a better way of doing it.  Is there some built in way of doing it, both on the device side and PC side?

      I am using the functions as they are used in AN82072 for the PC side.  Maybe there's a function called CheckPacketIntegrity()?  or maybe there's a handy field or register I could check?


      Thank you.

        • 1. Re: PSOC 4 USB - data errors

          Is there any special reason you are using Auto DMA? Since you are using HID Generic, you probably are transferring a few bytes only. There is no performance advantage using DMA in this case, since you still need to spend time setting up the DMA and serving the DMA ISR.

          • 2. Re: PSOC 4 USB - data errors



            couple of reasons actually:

            1. I was hoping that the source of the errors was something else in my code, and that using auto-DMA would fix it(if the data is transferred automatically, maybe my other code can't screw it up - some sort of timing problem or something; maybe my other code was taking too long).

            2. I was hoping to use CyUSB as in AN82072 to make a data logger.  Even with only one endpoint that's still 64kB/s.  It just happens that in this test project I am only sending sample text.

            3. I'm thinking about learning all the device classes.  First Generic HID, then a bulk transfer, and so on, until finally a composite device.  Develop mastery of all the types. 


            In one of my other questions I ask about the ISRs.  I'm wondering about both DMA and regular - I'd be happy for any input you have there!

            • 3. Re: PSOC 4 USB - data errors

              If you want to implement a data logger, perhaps CDC Device Class would be the easiest. There is no need to have a custom driver on PC side. It is also easy to write software, since there are many libraries out there to write to COM ports.


              If you still want to move ahead with the Generic HID, then please attach your project here. It helps to debug and get more people involved in the discussion.

              • 4. Re: PSOC 4 USB - data errors

                Just a note, in the code, be sure to check out USB_EP_2_ISR