Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0532c88

Browse filesBrowse files
committed
fix uartWriteBuf and uartDetectBaudrate
1 parent 344c76d commit 0532c88
Copy full SHA for 0532c88

File tree

Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed

‎cores/esp32/esp32-hal-uart.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-uart.c
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,9 @@ void uartWriteBuf(uart_t* uart, const uint8_t * data, size_t len)
323323
}
324324
UART_MUTEX_LOCK();
325325
while(len) {
326-
while(len && uart->dev->status.txfifo_cnt < 0x7F) {
327-
uart->dev->fifo.rw_byte = *data++;
328-
len--;
329-
}
326+
while(uart->dev->status.txfifo_cnt == 0x7F);
327+
uart->dev->fifo.rw_byte = *data++;
328+
len--;
330329
}
331330
UART_MUTEX_UNLOCK();
332331
}
@@ -540,7 +539,7 @@ uartDetectBaudrate(uart_t *uart)
540539
uart->dev->auto_baud.en = 0;
541540
uartStateDetectingBaudrate = false; // Initialize for the next round
542541

543-
unsigned long baudrate = UART_CLK_FREQ / divisor;
542+
unsigned long baudrate = getApbFrequency() / divisor;
544543

545544
static const unsigned long default_rates[] = {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 74880, 115200, 230400, 256000, 460800, 921600, 1843200, 3686400};
546545

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.