This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 4a5852f02c74afbee61842766eb0e9ba1d313159
Author: Justin Hammond <[email protected]>
AuthorDate: Sun Aug 16 19:23:50 2026 +0800

    boards/risc-v/eic7700x: Correct the UART reference clock.
    
    The console divisor was computed from 198144000, a figure with no source
    in the manual, the vendor tree or Linux, all of which give the low speed
    peripheral clock as 200 MHz.  The clock tree now reports lsp_uart0_pclk
    at 200 MHz, and section 12.4.3.2 makes that clock the UART's baud
    reference.
    
    Also enable the fractional divisor.  These are DesignWare UARTs with DLF
    implemented, four bits wide at offset 0xc0, which is where
    UART_DLF_OFFSET lands once scaled by this board's register increment.
    Section 12.4.3.2 works the same example at the same 200 MHz.
    
    At 115200 the error goes from 1.41% to 0.006%.  The old figure with the
    old divisor was tolerable; the margin only gets worse at higher rates.
    
    DEBUG_CLK and DEBUG_CLK_ERROR are enabled so a clock that fails to
    register is reported.
    
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Justin Hammond <[email protected]>
---
 boards/risc-v/eic7700x/eic7700-evb/configs/nsh/defconfig | 2 ++
 boards/risc-v/eic7700x/starpro64/configs/nsh/defconfig   | 7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/boards/risc-v/eic7700x/eic7700-evb/configs/nsh/defconfig 
b/boards/risc-v/eic7700x/eic7700-evb/configs/nsh/defconfig
index 29b3d6c5483..eff63c1831a 100644
--- a/boards/risc-v/eic7700x/eic7700-evb/configs/nsh/defconfig
+++ b/boards/risc-v/eic7700x/eic7700-evb/configs/nsh/defconfig
@@ -55,6 +55,8 @@ CONFIG_BOARD_LOOPSPERMSEC=1120
 CONFIG_BUILD_KERNEL=y
 CONFIG_DEBUG_ASSERTIONS=y
 CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y
+CONFIG_DEBUG_CLK=y
+CONFIG_DEBUG_CLK_ERROR=y
 CONFIG_DEBUG_FEATURES=y
 CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_FS_ERROR=y
diff --git a/boards/risc-v/eic7700x/starpro64/configs/nsh/defconfig 
b/boards/risc-v/eic7700x/starpro64/configs/nsh/defconfig
index 4308596a4b4..1017282e41f 100644
--- a/boards/risc-v/eic7700x/starpro64/configs/nsh/defconfig
+++ b/boards/risc-v/eic7700x/starpro64/configs/nsh/defconfig
@@ -8,15 +8,16 @@
 # CONFIG_DISABLE_OS_API is not set
 # CONFIG_NSH_DISABLE_LOSMART is not set
 CONFIG_16550_ADDRWIDTH=0
+CONFIG_16550_DLF_SIZE=4
 CONFIG_16550_REGINCR=4
 CONFIG_16550_UART0=y
 CONFIG_16550_UART0_BASE=0x50900000
-CONFIG_16550_UART0_CLOCK=198144000
+CONFIG_16550_UART0_CLOCK=200000000
 CONFIG_16550_UART0_IRQ=125
 CONFIG_16550_UART0_SERIAL_CONSOLE=y
 CONFIG_16550_UART1=y
 CONFIG_16550_UART1_BASE=0x50910000
-CONFIG_16550_UART1_CLOCK=198144000
+CONFIG_16550_UART1_CLOCK=200000000
 CONFIG_16550_UART1_IRQ=126
 CONFIG_16550_UART=y
 CONFIG_16550_WAIT_LCR=y
@@ -50,6 +51,8 @@ CONFIG_BOARD_LOOPSPERMSEC=1120
 CONFIG_BUILD_KERNEL=y
 CONFIG_DEBUG_ASSERTIONS=y
 CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y
+CONFIG_DEBUG_CLK=y
+CONFIG_DEBUG_CLK_ERROR=y
 CONFIG_DEBUG_FEATURES=y
 CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_FS_ERROR=y

Reply via email to