@@ -675,9 +675,16 @@ static void nordic_nrf5_uart_event_handler(int instance)
675
675
676
676
nrf_uarte_event_clear (nordic_nrf5_uart_register [instance ], NRF_UARTE_EVENT_TXDRDY );
677
677
678
- /* In non-async transfers this will generate and interrupt if callback and mask is set. */
678
+ /* In non-async transfers this will generate an interrupt if callback and mask is set. */
679
679
if (!nordic_nrf5_uart_state [instance ].tx_asynch ) {
680
680
681
+ /* Disable TXDRDY event again. */
682
+ nordic_nrf5_uart_register [instance ]-> INTEN &= ~NRF_UARTE_INT_TXDRDY_MASK ;
683
+
684
+ /* Release mutex. As the owner this call is safe. */
685
+ nordic_nrf5_uart_state [instance ].tx_in_progress = 0 ;
686
+
687
+ /* Call event handler. */
681
688
nordic_nrf5_uart_event_handler_endtx (instance );
682
689
}
683
690
}
@@ -1449,9 +1456,7 @@ void serial_putc(serial_t *obj, int character)
1449
1456
* been transmitted and ENDTX when the entire buffer has been sent.
1450
1457
*
1451
1458
* For the blocking serial_putc, TXDRDY interrupts are enabled and only used for the
1452
- * single character TX IRQ callback handler. The ENDTX event does not generate an interrupt
1453
- * but is caught using a busy-wait loop. Once ENDTX has been generated we disable TXDRDY
1454
- * interrupts again.
1459
+ * single character TX IRQ callback handler.
1455
1460
*/
1456
1461
1457
1462
/* Arm Tx DMA buffer. */
@@ -1470,15 +1475,6 @@ void serial_putc(serial_t *obj, int character)
1470
1475
/* Trigger DMA transfer. */
1471
1476
nrf_uarte_task_trigger (nordic_nrf5_uart_register [instance ],
1472
1477
NRF_UARTE_TASK_STARTTX );
1473
-
1474
- /* Busy-wait until the ENDTX event occurs. */
1475
- while (!nrf_uarte_event_check (nordic_nrf5_uart_register [instance ], NRF_UARTE_EVENT_ENDTX ));
1476
-
1477
- /* Disable TXDRDY event again. */
1478
- nordic_nrf5_uart_register [instance ]-> INTEN &= ~NRF_UARTE_INT_TXDRDY_MASK ;
1479
-
1480
- /* Release mutex. As the owner this call is safe. */
1481
- nordic_nrf5_uart_state [instance ].tx_in_progress = 0 ;
1482
1478
}
1483
1479
1484
1480
/** Check if the serial peripheral is readable
0 commit comments