[BSP] [NS800RT7P65]Feature/optimize ns800 uart Drive#11423
[BSP] [NS800RT7P65]Feature/optimize ns800 uart Drive#11423zhang-haitao-repo wants to merge 2 commits into
Conversation
…rial communication at low baud rates.
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
There was a problem hiding this comment.
Pull request overview
This PR adds Kconfig-based default UART configuration (baudrate / data bits / stop bits) for the ns800rt7p65-nssinepad BSP and reworks the TX wait logic in drv_uart.c to use system ticks rather than a raw loop counter, with the stated goal of preventing dropped bytes at low baudrates.
Changes:
- Add
BSP_UART_DEFAULT_BAUDRATE,BSP_UART_DEFAULT_DATABITSandBSP_UART_DEFAULT_STOPBITSoptions to the BSP Kconfig. - Map the new Kconfig symbols to defaults in
drv_uart.cand apply them inns800_uart_fill_default_config. - Extract a new
ns800_wait_tx_spacehelper that times out usingrt_tick_get()/rt_tick_from_millisecond()instead of a decrementing iteration counter;ns800_putcno longer waits for the TC bit after writing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
bsp/novosns/ns800/ns800rt7p65-nssinepad/board/Kconfig |
Adds default baudrate / data-bits / stop-bits menuconfig entries under the UART menu. |
bsp/novosns/ns800/libraries/HAL_Drivers/drivers/drv_uart.c |
Maps new Kconfig symbols to default serial_configure fields; replaces iteration-based TX timeout with a tick-based wait helper and removes the post-write TC wait in ns800_putc. |
| timeout_tick = rt_tick_from_millisecond(timeout_ms); | ||
| start_tick = rt_tick_get(); |
| while (!UART_isSpaceAvailable(uart->handle.Instance)) | ||
| { | ||
| if (block_timeout-- == 0U) | ||
| if ((rt_tick_get() - start_tick) > timeout_tick) | ||
| { | ||
| return -1; | ||
| return -RT_ETIMEOUT; | ||
| } | ||
| } |
| config BSP_UART_DEFAULT_BAUDRATE | ||
| int "UART default baudrate" | ||
| default 115200 | ||
| help | ||
| Default baudrate for all UART ports. |
| UART_writeChar(uart->handle.Instance, (rt_uint8_t)c); | ||
| return 1; |
拉取/合并请求描述:(PR description)
[
为什么提交这份PR (why to submit this PR)
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up