This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

STM32 diag driver fix


This patch fixes hal_stm32_serial_getc_timeout() for high baudrates. The original version lost bytes due to the long timeout.
diff --git a/packages/hal/cortexm/stm32/var/current/src/hal_diag.c b/packages/hal/cortexm/stm32/var/current/src/hal_diag.c
index 2ea1871..cc4930d 100644
--- a/packages/hal/cortexm/stm32/var/current/src/hal_diag.c
+++ b/packages/hal/cortexm/stm32/var/current/src/hal_diag.c
@@ -213,14 +213,14 @@ hal_stm32_serial_getc_timeout(void* __ch_data, cyg_uint8* ch)
     cyg_bool res;
     CYGARC_HAL_SAVE_GP();
 
-    delay_count = chan->msec_timeout * 10; // delay in .1 ms steps
+    delay_count = chan->msec_timeout * 100; // delay in 10 us steps
 
     for(;;) {
         res = hal_stm32_serial_getc_nonblock(__ch_data, ch);
         if (res || 0 == delay_count--)
             break;
         
-        CYGACC_CALL_IF_DELAY_US(100);
+        CYGACC_CALL_IF_DELAY_US(10);
     }
 
     CYGARC_HAL_RESTORE_GP();

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]