Advantages and disadvantages of RawHid interface

Status
Not open for further replies.

Elmue

Well-known member
Hello

I'am trying to transfer data from the Teensy 3.2 to the host as fast as possible.

I came across the RawHid interface and wrote some code and tested it.
But as it uses only interrupt transfer with a polling interval of 1 ms with the maximum packet size for Full Speed = 64 bytes the speed did not convince me.
In theory it should be 64 byte * 1000 ms = 64 kByte / second.
But in the real life it is even slower.
I see that a packet requires between 1.0 ms and 1.9 ms. (Tested on Windows)
So the speed is on average approx 40 kByte / s.

I studied the HID 1.11 documentation and if I understand it correctly HID interfaces are designed only for interrupt transfers.
So I did not even try to change the RawHid interface to use Bulk transfers.


In Paul's benchmark test
http://www.pjrc.com/teensy/benchmark_usb_serial_receive.html
he reaches up to 982 kByte/s with the CDC interface via COM port.
So RawHid is 25 times slower than CDC !


Additionally the RawHid interface has several other disadvantages so that I ask myself which is advantage at all to use it ?

Paul writes that you do not need to install a driver.
But to me it seems that this is the only advantage of RawHid.
(By the way on Windows 10 it is not necessary anymore to install a driver for the CDC interface)

My summary is:

Advantage:
- No driver installation needed.

Disadvantages:
- Significantly slower.
- Does not appear as COM port and requires extra software on the host to transfer data.
- The RawHid software from PJRC for Windows has bugs (memory leak)
- The additional SerEmu interface can not be read via a common terminal program and also needs additional programming efforts to get the data.
- Sending small amounts of data is not supported. If I want to send 10 bytes I always have to fill a packet of 64 bytes.
- On the sketch side RawHID.available() is implemented but RawHID.availableForWrite() is missing (which I would need)


Am I missing something ?

Are there more options to transfer data to the host apart from CDC and RawHid ?
 
Well, if you don't like it, why use it ?
You don't need to know the COM-Port.
Even if it might be a bit slow: I found it very useful for TeensyTransfer
 
Last edited:
Thanks for providing the hex files.

<edit>
However, with my beta Teensy 3.6 and the prop shield mounted on the Teensy, once I do -w file, it seems to go catatonic, and I have to reboot the Teensy. When I have time later tonight, I''ll try it with other Teensys. :(
 
Last edited:
Hm, did you update the the host-executable (windows - exe) too ?

I did not test all variants, i'll try it with teensy 3.6
Edit: works for me.. (windows + audio-spi )

Is the flash formattet or contains files aready ?
Does it work with the SerialFlash examples ?

can you pls try this :
Code:
Edit: ok..the serial is not correct.. ignore that.. it's a bug (uses still the old code for T31/3.2) but that does not matter.

>teensytransfer teensy -i

and 

>teensytransfer -i

The first shows information about the teensy (must match yours), the second information about the flash - this should print a correct ID and size (no zeros)

Example:
Code:
C:\teensytransfertool>teensytransfer -l
 2572956 rain.aac

C:\teensytransfertool>teensytransfer -i
ID    : EF 40 18
Serial: D2 65 2C 55 03 0C 24 24
Size  : 16777216 Bytes

C:\teensytransfertool>teensytransfer teensy -i
Model : Teensy 3.6 (MK66FX1M0)
Serial: 387557
MAC   : 05:E9:E5:05:E9:E5
EEPROM: 4096 Bytes
F_CPU : 120000000 Hz
F_PLL : 120000000 Hz
F_BUS : 60000000 Hz
F_MEM : 24000000 Hz
 
Last edited:
Status
Not open for further replies.
Back
Top