UART: Bugfix: Handle task STOPTX while stopping

This can happen, so the models should handle it properly.
Until this fix, the models would stop badly on the
second STOPTX: The Tx would continue finishing properly,
but the TXSTOPPED event would be generated right away
(too early).

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2024-01-17 17:19:36 +01:00
parent b8ea63b505
commit eda7af987e
1 changed files with 4 additions and 1 deletions

View File

@ -737,7 +737,10 @@ void nhw_UARTE_TASK_STOPTX(int inst)
if (uarte_enabled(inst)) {
if (u_el->tx_status == Txing) {
u_el->tx_status = Tx_Stopping;
} else {
} else if (u_el->tx_status == Tx_Stopping) {
bs_trace_info(3, "UART%i STOPTX received while already stopping, ignored\n", inst);
return;
} else { /* Pend or Idle */
nhw_UARTE_tx_final_stop(inst, u_el);
}
}