Skip to content

Commit 7f1ed02

Browse files
author
Filip Jagodzinski
committed
Test: ResetReason: Increase the UART flush wait
1 parent 7d575af commit 7f1ed02

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

TESTS/mbed_drivers/reset_reason/main.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,20 @@
4949
#define MSG_KEY_RESET_REASON "reason"
5050
#define MSG_KEY_DEVICE_RESET "reset"
5151

52-
#define SERIAL_FLUSH_TIME_MS 20
52+
/* To prevent a loss of Greentea data, the serial buffers have to be flushed
53+
* before the UART peripheral shutdown. The UART shutdown happens when the
54+
* device is entering the deepsleep mode or performing a reset.
55+
*
56+
* With the current API, it is not possible to check if the hardware buffers
57+
* are empty. However, it is possible to determine the time required for the
58+
* buffers to flush.
59+
*
60+
* Assuming the biggest Tx FIFO of 128 bytes (as for CY8CPROTO_062_4343W)
61+
* and a default UART config (9600, 8N1), flushing the Tx FIFO wold take:
62+
* (1 start_bit + 8 data_bits + 1 stop_bit) * 128 * 1000 / 9600 = 133.3 ms.
63+
* To be on the safe side, set the wait time to 150 ms.
64+
*/
65+
#define SERIAL_FLUSH_TIME_MS 150
5366

5467
typedef enum {
5568
CMD_STATUS_CONTINUE,

TESTS/mbed_hal/reset_reason/main.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,20 @@
4949
#define MSG_KEY_RESET_REASON "reason"
5050
#define MSG_KEY_DEVICE_RESET "reset"
5151

52-
/* To prevent loss of Greentea data, flush serial buffers before the UART peripheral shutdown. The UART shutdown happens when the
52+
/* To prevent a loss of Greentea data, the serial buffers have to be flushed
53+
* before the UART peripheral shutdown. The UART shutdown happens when the
5354
* device is entering the deepsleep mode or performing a reset.
5455
*
5556
* With the current API, it is not possible to check if the hardware buffers
56-
* are empty. However, you can determine the amount of time required for the
57+
* are empty. However, it is possible to determine the time required for the
5758
* buffers to flush.
5859
*
59-
* For example, NUMAKER_PFM_NUC472:
60-
* The UART peripheral has 16-byte Tx FIFO. With a baud rate of 9600,
61-
* flushing the Tx FIFO would take: 16 * 8 * 1000 / 9600 = 13.3 ms.
62-
* To be on the safe side, set the wait time to 20 ms.
60+
* Assuming the biggest Tx FIFO of 128 bytes (as for CY8CPROTO_062_4343W)
61+
* and a default UART config (9600, 8N1), flushing the Tx FIFO wold take:
62+
* (1 start_bit + 8 data_bits + 1 stop_bit) * 128 * 1000 / 9600 = 133.3 ms.
63+
* To be on the safe side, set the wait time to 150 ms.
6364
*/
64-
#define SERIAL_FLUSH_TIME_MS 20
65+
#define SERIAL_FLUSH_TIME_MS 150
6566

6667
typedef enum {
6768
CMD_STATUS_CONTINUE,

0 commit comments

Comments
 (0)