From 8eacf50a5bcb5bd006b31e11a17323be3181ba20 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Tue, 28 Jul 2020 20:02:32 +1000 Subject: [PATCH] mask stacked reset if another message recieved at the same time --- .../TS100/Core/Drivers/FUSB302/int_n.cpp | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/workspace/TS100/Core/Drivers/FUSB302/int_n.cpp b/workspace/TS100/Core/Drivers/FUSB302/int_n.cpp index e3e7d980..44fbc793 100644 --- a/workspace/TS100/Core/Drivers/FUSB302/int_n.cpp +++ b/workspace/TS100/Core/Drivers/FUSB302/int_n.cpp @@ -45,10 +45,9 @@ void InterruptHandler::Thread(const void *arg) { bool notifSent = false; while (true) { /* If the INT_N line is low */ - if (!notifSent) { - if (xTaskNotifyWait(0x00, 0x0F, NULL, 25) == pdPASS) { - osDelay(1); - } + if (xTaskNotifyWait(0x00, 0x0F, NULL, 200) == pdPASS) { + //delay slightly so we catch the crc with better timing + osDelay(2); } notifSent = false; /* Read the FUSB302B status and interrupt registers */ @@ -76,16 +75,18 @@ void InterruptHandler::Thread(const void *arg) { /* If the I_HARDRST or I_HARDSENT flag is set, tell the Hard Reset * thread */ - events = 0; - if (status.interrupta & FUSB_INTERRUPTA_I_HARDRST) { - events |= PDB_EVT_HARDRST_I_HARDRST; - notifSent = true; - } else if (status.interrupta & FUSB_INTERRUPTA_I_HARDSENT) { - events |= PDB_EVT_HARDRST_I_HARDSENT; - notifSent = true; - } - if (events) { - ResetHandler::notify(events); + if (notifSent == false) { + events = 0; + if (status.interrupta & FUSB_INTERRUPTA_I_HARDRST) { + events |= PDB_EVT_HARDRST_I_HARDRST; + notifSent = true; + } else if (status.interrupta & FUSB_INTERRUPTA_I_HARDSENT) { + events |= PDB_EVT_HARDRST_I_HARDSENT; + notifSent = true; + } + if (events) { + ResetHandler::notify(events); + } } /* If the I_OCP_TEMP and OVRTEMP flags are set, tell the Policy * Engine thread */