File tree Expand file tree Collapse file tree 2 files changed +22
-8
lines changed
mbed_drivers/reset_reason Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 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
5467typedef enum {
5568 CMD_STATUS_CONTINUE,
Original file line number Diff line number Diff line change 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
6667typedef enum {
6768 CMD_STATUS_CONTINUE,
You can’t perform that action at this time.
0 commit comments