From a5f8c8cfffcd8ee30c9f1dc940bc45628b0d4650 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 13 Apr 2012 22:50:13 +0200 Subject: [PATCH] Add a small delay before flushing the serial line. Sometimes there are a few garbages bytes received before the preamble bytes. This typically happens when trying to download again after a failed attempt. However trying to flush them immediately after opening the serial port doesn't work. --- src/hw_ostc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hw_ostc.c b/src/hw_ostc.c index 7a2d966..ff112b8 100644 --- a/src/hw_ostc.c +++ b/src/hw_ostc.c @@ -157,6 +157,7 @@ hw_ostc_device_open (device_t **out, const char* name) } // Make sure everything is in a sane state. + serial_sleep (100); serial_flush (device->port, SERIAL_QUEUE_BOTH); *out = (device_t*) device;