Skip to content

Commit a7a1690

Browse files
benwafflefpistm
authored andcommitted
[UART] Disable interrupt in uart_debug_write
1 parent b9b7a9d commit a7a1690

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cores/arduino/stm32/uart.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -607,15 +607,25 @@ size_t uart_debug_write(uint8_t *data, uint32_t size)
607607
if (serial_debug.index >= UART_NUM) {
608608
return 0;
609609
}
610+
} else {
611+
serial_t *obj = rx_callback_obj[serial_debug.index];
612+
if (obj) {
613+
serial_debug.irq = obj->irq;
614+
}
610615
}
611616
}
612617

618+
HAL_NVIC_DisableIRQ(serial_debug.irq);
619+
613620
while (HAL_UART_Transmit(uart_handlers[serial_debug.index], data, size, TX_TIMEOUT) != HAL_OK) {
614621
if ((HAL_GetTick() - tickstart) >= TX_TIMEOUT) {
615-
return 0;
622+
size = 0;
623+
break;
616624
}
617625
}
618626

627+
HAL_NVIC_EnableIRQ(serial_debug.irq);
628+
619629
return size;
620630
}
621631

0 commit comments

Comments
 (0)