summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2024-05-21 19:15:54 +0700
committerGitHub <[email protected]>2024-05-21 19:15:54 +0700
commit1f259b3ab0f1b9587dee9c0bfb5574d70d021640 (patch)
treed2f59cb591661047d94b1e4eee6cc58e46f43267 /hw
parenta1abbd70cbc00878a34f0b7db24805fc78b6b8d8 (diff)
parent4a5b190a2209958b875416641b67a4076f14c9e2 (diff)
Merge pull request #2392 from Krasutski/bugfix/ch32-hs-dcd
bugfix(ch32-hs-dcd): fix ch32 DATAx managment and long packet transmit
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/ch32v307/debug_uart.c2
-rw-r--r--hw/bsp/ch32v307/family.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/hw/bsp/ch32v307/debug_uart.c b/hw/bsp/ch32v307/debug_uart.c
index db3551ca7..fbabeeadc 100644
--- a/hw/bsp/ch32v307/debug_uart.c
+++ b/hw/bsp/ch32v307/debug_uart.c
@@ -28,7 +28,7 @@
#include <ch32v30x.h>
-#define UART_RINGBUFFER_SIZE_TX 64
+#define UART_RINGBUFFER_SIZE_TX 128
#define UART_RINGBUFFER_MASK_TX (UART_RINGBUFFER_SIZE_TX-1)
static char tx_buf[UART_RINGBUFFER_SIZE_TX];
diff --git a/hw/bsp/ch32v307/family.c b/hw/bsp/ch32v307/family.c
index fe37ea8e3..94578b416 100644
--- a/hw/bsp/ch32v307/family.c
+++ b/hw/bsp/ch32v307/family.c
@@ -72,7 +72,7 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#endif
- usart_printf_init(115200);
+ usart_printf_init(CFG_BOARD_UART_BAUDRATE);
#if CFG_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED
// Use Highspeed USB
@@ -150,10 +150,11 @@ int board_uart_read(uint8_t* buf, int len) {
int board_uart_write(void const* buf, int len) {
int txsize = len;
+ const char* bufc = (const char*) buf;
while (txsize--) {
- uart_write(*(uint8_t const*) buf);
- buf++;
+ uart_write(*bufc++);
}
+ uart_sync();
return len;
}