usbip-win icon indicating copy to clipboard operation
usbip-win copied to clipboard

The write operation fails in an Arduino device due to the network latency

Open myjimmy opened this issue 2 years ago • 7 comments

Hello,

I connected an Arduino device (Arduino Uno) on my PC (Windows 10) to the Windows Server 2019 machine by using the this project. When the network latency is less than 40 ms,

  1. I can mount the local Arduino device to the remote machine (Windows Server 2019).
  2. Arduino 1.8.19 app recognizes the Arduino device on the remote machine.
  3. Arduino 1.8.19 app reads the device info of the Arduino device on the remote machine.
  4. I can write any sketch in the Arudino device by using Arduino 1.8.19.

But, wehn the network latency is more than 40 ms,

  1. same to the above result.
  2. same to the above result.
  3. same to the above result.
  4. When trying to write any sketch, the write operation always fails. image

I need a solution to resolve this problem when the network latency is 60-100ms.

Thanks, Jimmy

myjimmy avatar Apr 26 '22 05:04 myjimmy

@cezanne Do you have a good solution?

myjimmy avatar Apr 27 '22 08:04 myjimmy

You can try setting a longer timeout at the avrdude config side of things. Tweak it till it works.

UnKnoWn-Consortium avatar May 07 '22 22:05 UnKnoWn-Consortium

@UnKnoWn-Consortium Thanks for your reply. I'm a beginer to Arduino. I'm using arduino-1.8.19-windows (portable) on Windows 10. I found the avrdude.conf file in arduino-1.8.19\hardware\tools\avr\etc. But, because there are many items related to the timeout in the configuration file, I can't know which item I'll change. So, I want you to let me know which item I'll change in the avrdude.conf file.

myjimmy avatar May 09 '22 00:05 myjimmy

@UnKnoWn-Consortium, I've tuned the appropriate settings like *timeout (timeout, chiperasepolltimeout, etc), *delay (min_write_delay, max_write_delay, etc) in avrdude.conf file, but the write operation fails, yet. Please help me. @cezanne If you have a good idea, please let me know.

myjimmy avatar May 24 '22 08:05 myjimmy

Back to the basics, is there anything connected to the Tx/Rx pins on your Arduino board? It will prevent host machine interactions with the bootloader.

You can also enable the verbose mode in the Arduino IDE (Preferences => Settings => Show verbose output during ☑️ compilation ☑️ upload).

UnKnoWn-Consortium avatar May 24 '22 17:05 UnKnoWn-Consortium

My Arduino board is "Uno R3". Arduino-Uno-R3 Anything isn't connected to the Tx/Rx pins on my Arduino board.

Also, I've already enabled the verbose mode in the Aruino IDE. I upload the verbose log file here: arduino-cc-2.log

myjimmy avatar May 24 '22 20:05 myjimmy

It seems the toggle only adds one layer of verbosity and it does not give anything of value where the process hanged...

Please give this modified command a try after ensuring the hex file exists or change its path to a hex file compiled from your sketch:

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe -v -v -v -v -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -p atmega328 -c arduino -P COM3 -b 115200 -D -U flash:w:C:\Users\TESTUS~3\AppData\Local\Temp\3\arduino_build_672433\sketch_may18a.ino.hex:i

UnKnoWn-Consortium avatar May 26 '22 01:05 UnKnoWn-Consortium