Best approach for RELIABLE high speed communication with PC (UART vs HID)

Hi,
I need for my project reliable (!) high speed communication with PC. I have sort of smart probes that logs data to a SD card. But time to time, i need to get data out to PC.
Sure, taking out SD card and read all is fastest and simplest way to do it. But in my new scenario, this should be only as worst case scenarion (for example probe physically damaged). This is because of rugged and waterproof design.

I am thinking about how to get data from SD as fast as possible. My guess is there are three possibilities:

1.) high speed UART (via USB conversion)
2.) USB native HID RAW tranfer
3.) USB Mass Storage / SD card emulation

I am considering two MCU boards, Arduino Micro (Atmega32u4) or Arduino MKR Zero (SAMD21 ARM), becasue I need compact solution.

Solution 1.) can be applied to both boards. 115200 bits per seconds are quite reliable. I also tested 250000 via FTDI and also was quite reliable. But what about highger speeds? For example 500 000 (50 kbps) or 1 000 000 (100kbps)? My guess is that these speeds could be very prone to EMI or other
interference.
According to 32u4 datasheet (here, page 208), there could be up to 7,8 % error rate. Thats quite a lot. But there is not a field for 16 MHz XTAL.

Solution 2.) from what i know, USB HID RAW can transfer up to 1000 packets of 256 bytes of data = 256 kbytes/second. Not bad...

Solution 3.) would be great, but as I know this sort of feature is only availiable on some Teensy boards... Or I am wrong?

My data blocks are 100 characters, including CRC. I think that reading SW at PC side should check every block by CRC and request data block again if there is not match. I dont have problem to write such host SW.

What do you guys recommend?
Is it reliable to use UART at e.g. 1 Mbps when there is only standart short (50cm) USB cable. Or is HID protocol more reliable?

Helium328PU:
According to 32u4 datasheet (here, page 208), there could be up to 7,8 % error rate. Thats quite a lot. But there is not a field for 16 MHz XTAL.

I don't know what exactly you are referring to. My 32u4 datasheet has a table 18-12 which shows Baud rates for 16MHz and there is no error at 250k, 500k or 1000k.

HOWEVER ... the Arduino Leonardo and Micro communicate with the PC over the USB cable at the full USB data rate and the selected baud rate is ignored. (I think you must, nevertheless select a baud rate with Serial.begin() ). Consequently I think that if you are using a 16MHz Arduino then one that uses a 32u4 would be best for your project. However I have no experience of the faster and more expensive DUE and its brethren.

I don't know anything about HID USB - I thought that was just for when you want to pretend that the Arduino is a keyboard or a mouse.

I don't use my Leonard or Micro very often. However my standard baud rate with 16MHz and 8MHz Atmega 328s and Attiny 1634s is 500,000 - and I have never noticed a problem.

...R

Robin2:
I don't know what exactly you are referring to. My 32u4 datasheet has a table 18-12 which shows Baud rates for 16MHz and there is no error at 250k, 500k or 1000k.

Strange, probably mistake on original datasheet on Microchip website. But I believe that you are correct and this is true.

Robin2:
HOWEVER ... the Arduino Leonardo and Micro communicate with the PC over the USB cable at the full USB data rate and the selected baud rate is ignored. (I think you must, nevertheless select a baud rate with Serial.begin() ).

Right, I am stupid :smiley: I was thinking about this problem so much, that I forgot that actual data transfer between MCU and PC is standart USB protocol full speed transfer and decoding as UART is made in driver side of PC... So basically I just need to take care about proper USB shielding no matter of protocol used.

Robin2:
I don't know anything about HID USB - I thought that was just for when you want to pretend that the Arduino is a keyboard or a mouse.

That is not 100% correct. USB HID protocol was actually developed primary for mouse, keyboards, gamepads and some other stuff.
But there also exists USB HID RAW protocol (subclass of HID protocol), It is very similar to mouse or keyboard transfer, but simplier to interface. Using this protocol allow to send any data in very similar way as in UART. But this protocol cal use advanced USB features and downt need drivers (on Windows). I noticed that many small MCU commercila devices actually use this protocol more often than UART emulation.

Robin2:
However my standard baud rate with 16MHz and 8MHz Atmega 328s and Attiny 1634s is 500,000 - and I have never noticed a problem.

500 000 is nice transfer rate. At time of writing, I noticed that HID library for Arduino dont support ARM boards. So HID is probably out of game for now... So I guess that I have to probably try both boards and try 1 000 000 bps. Hope it will also work nicely, if you never had problem with 500 000.

Thanks for your input!