• AVR Freaks

Hot!HID very slow.

Author
nigelwright7557
Super Member
  • Total Posts : 282
  • Reward points : 0
  • Joined: 2006/11/06 08:15:51
  • Location: 0
  • Status: online
2019/08/18 10:12:47 (permalink)
0

HID very slow.

I have started a project for reading in data from a PIC32mx A2D converter.
In one second I can transfer about 4k bytes.
It needs to be a lot faster.
Are there any settings I can change in HID settings to make it faster ?
 
I have also started on a CDC version based on HID_BASIC_DEMO using my HID PC program.
The pc control panel see's the PIC usb device is there but my pc program cant find it despite both having same VID and PID.
The pc cant find the PIC with same PID/VID. I am guessing this is something to do with CDC being a com port based system ?
 
 
#1

5 Replies Related Threads

    NorthGuy
    Super Member
    • Total Posts : 5574
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: HID very slow. 2019/08/18 12:03:26 (permalink)
    0
    For full speed device, HID is limited at about 64kBytes/sec (full duplex). So, you're apparently way off the mark. To get 64kB/sec you need to make sure that:
     
    1. Your device is full speed (as opposed to low speed).
    2. Your Input (or Output) report size is 64 bytes (or n*64 bytes) long.
    3. You send/receive a report at every frame.
     
    Some people do faster by using oversized Feature reports, but this is tricky.
     
    If you need more than 64kB/s, switch to CDC or custom class.
    #2
    nigelwright7557
    Super Member
    • Total Posts : 282
    • Reward points : 0
    • Joined: 2006/11/06 08:15:51
    • Location: 0
    • Status: online
    Re: HID very slow. 2019/08/18 12:13:19 (permalink)
    0
    Its full speed USB and uses 64 bytes/packet.
    I did find my PC C# program was in debug mode and changing that to release mode gave about a 250% increase in speed.  I guess in debug mode it was too slow and not sending every frame ?
     
    #3
    NorthGuy
    Super Member
    • Total Posts : 5574
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: HID very slow. 2019/08/18 12:28:49 (permalink)
    0
    nigelwright7557
    I guess in debug mode it was too slow and not sending every frame ?



    I guess so. However, 10kBytes/sec is still too slow. Frames come every 1 ms. So, to get a 64 bytes at every frame:
     
    1. Your HID descriptor specifies polling interval of 1 ms.
    2. Your C# sends a frame every 1 ms or faster. This is certainly not a problem with C. I know C# is bloated, but I have no idea how much.
    3. Your PIC is ready to receive a packet every 1 ms and promptly re-arm the endpoints.
     
    #4
    nigelwright7557
    Super Member
    • Total Posts : 282
    • Reward points : 0
    • Joined: 2006/11/06 08:15:51
    • Location: 0
    • Status: online
    Re: HID very slow. 2019/08/18 12:34:16 (permalink)
    0
    The interval in the PIC code is set to 1. Changing it to zero made no difference.
    C# is slower than C++ so could be the bottleneck as has already been found.
    The PIC32MX running at 48MHz is only inputting 4096 bytes  from a 1.3MHz D2A so its not away for much time.
    Its passable now with about 3-4 pc frames of data per second although faster would have been good.
    #5
    NorthGuy
    Super Member
    • Total Posts : 5574
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: HID very slow. 2019/08/18 13:31:52 (permalink)
    0
    You can try to troubleshoot it. For example, you can create a test project which does nothing except accepting frames and flipping an output when a frame is received. You can then see how many frames per second are received.
     
    Similarly, you can create a fast PC program which sends frames non-stop and see how this influences the number of received frames.
     
    Then you will know where the bottleneck is and may work on improving it.
    #6
    Jump to:
    © 2019 APG vNext Commercial Version 4.5