Hi there,
I am looking for an approach to provoke a CRC16 failure in USB CDC communication between a Ardunio/Genuino Micro (or any other ATmega32U4 based Arduino - or MCU with an embedded USB transceiver) and a PC.
Why? I need to know and see what happens in my code on the PC side if there is heavy "electro magnetic noise" that corrupts the data transmission from the Arduino towards the PC.
On the PC side I develop a Windows 10 UWP app and since the USB CDC driver was improved with Windows 10 and the API had changed (compared to older versions of Windows) I am not sure what happens if the underlying USB bulk transfer discovers "near endless" CRC16 failures.
I expect an exception like the one that occurs if you pull off the USB cable (which works great by the way - no more crashes like in the old .NET desktop framework days) ... but I want to see it "in action" in order to have a reliable solution and handling in my code
Normally one should not notice anything of this CRC16 validation and error handling as this is covered by the USB bulk transfer which happens in the driver stack and the underlying hardware ... and its said that one could rely on that - see "http://www.beyondlogic.org/usbnutshell/usb4.shtml" for a short explanation.
But I assume that if CRC16 failures happens continuously over a certain amout of time respectively retries of package retransmission fail over and over again, the USB stack (or Windows USB CDC driver) would "give up" or assumes for itself that this connection is physically broken or otherwise unuseable and cuts the underlying "USB connection" in the software layer. Maybe this USB serial device would even be deleted from the list of accessable devices so that there is even no chance for an automatic disconnect & reconnect.
My first idea is to use a electro magnet - but as I am no "hardware guy" I don't know if this a good idea. I have allready an UWP app that receives continuously data from the Ardunio, so my idea is : after the continuous transmission has started and letting this run for a short while to see that everthings is fine so far, I turn on this electro magnet and let this guy corrput the data flow through the cable. I assume that the introdcued mangnetic field should impact the "logic levels" on the data line and let some bits "transform theier value" and hence the CRC16 value won't be correct when the entire frame arrives in the PC side.
What do you think is the best & easiest approch for a "Software guy" with basic electronic skills to produce some "fallen bytes"
?
thanks & cheers
buildiy