Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit9c9ef29

Browse files
committed
fix(uart): ensure debug uart is ready before send
Like state is ready not need to loop on the blockingHAL_UART_Transmit(). If not ok it can be HAL_ERROR or HAL_TIMEOUT.Fixes#1789Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parentc774ab8 commit9c9ef29

File tree

1 file changed

+8
-5
lines changed
  • libraries/SrcWrapper/src/stm32

1 file changed

+8
-5
lines changed

‎libraries/SrcWrapper/src/stm32/uart.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -736,14 +736,17 @@ size_t uart_debug_write(uint8_t *data, uint32_t size)
736736
}
737737
}
738738
}
739+
UART_HandleTypeDef*huart=uart_handlers[serial_debug.index];
740+
while (huart->gState!=HAL_UART_STATE_READY) {
741+
if ((HAL_GetTick()-tickstart) >=TX_TIMEOUT) {
742+
return0;
743+
}
744+
};
739745

740746
HAL_NVIC_DisableIRQ(serial_debug.irq);
741747

742-
while (HAL_UART_Transmit(uart_handlers[serial_debug.index],data,size,TX_TIMEOUT)!=HAL_OK) {
743-
if ((HAL_GetTick()-tickstart) >=TX_TIMEOUT) {
744-
size=0;
745-
break;
746-
}
748+
if (HAL_UART_Transmit(huart,data,size,TX_TIMEOUT)!=HAL_OK) {
749+
size=0;
747750
}
748751

749752
HAL_NVIC_EnableIRQ(serial_debug.irq);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp