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 ?
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 ?