Skip to content

drivers: serial: Implement half-duplex mode for nordic,nrf-uarte serial driver interrupt driven mode#49

Closed
cormoran wants to merge 1 commit intozmkfirmware:v3.5.0+zmk-fixesfrom
cormoran:v3.5.0+zmk-fixes+nrf-half-duplex-uart
Closed

drivers: serial: Implement half-duplex mode for nordic,nrf-uarte serial driver interrupt driven mode#49
cormoran wants to merge 1 commit intozmkfirmware:v3.5.0+zmk-fixesfrom
cormoran:v3.5.0+zmk-fixes+nrf-half-duplex-uart

Conversation

@cormoran
Copy link

@cormoran cormoran commented Nov 9, 2025

This pull request implements half-duplex mode for nRF serial driver to use wired split transport with single line for nRF devices.
The implementation is a bit hacky and I'm not sure you want to merge this change directly to this fork, but I expect it helps people who is willing to experiment 1-wire wired transport with nRF devices.

The implementation works only for interrupt driven mode for simplicity.
I tested the implementation with my XIAO nRF52840 plus custom keyboard with following setup.
And you should implement protection from collision in your circuit like inserting resistance in the connection line. Otherwise, the chip might be damaged at unexpected TX collision.

# your_keyboard.conf
CONFIG_ZMK_SPLIT_WIRED_UART_MODE_INTERRUPT=y
# And be sure your uart is configured as interrupt driven mode
# CONFIG_UART_0_INTERRUPT_DRIVEN=y
# your_keyboard.dtsi
/ {
    wired_split {
        compatible = "zmk,wired-split";
        device = <&uart0>;
        half-duplex;
    };
};
&uart0 {
    compatible = "nordic,nrf-uarte";
    current-speed = <19200>;
    status = "okay";
    pinctrl-0 = <&uart0_rx>;
    pinctrl-1 = <&uart0_sleep>;
    pinctrl-2 = <&uart0_tx>;
    pinctrl-names = "rx", "sleep", "tx";
    half-duplex;
};

// example of using P0.03 (D1) as uart pin
&pinctrl {
    uart0_rx: uart0_rx {
        group1 {
            psels = <NRF_PSEL(UART_RX, 0, 3)>;
            bias-pull-up;
        };
        group2 {
            psels = <NRF_PSEL_DISCONNECTED(UART_TX)>;
        };
    };
    uart0_sleep: uart0_sleep {
        group1 {
            psels = <NRF_PSEL(UART_RX, 0, 3)>, <NRF_PSEL_DISCONNECTED(UART_TX)>;
            low-power-enable;
        };
    };
    uart0_tx: uart0_tx {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 3)>;
            bias-pull-up;
        };
        group2 {
            psels = <NRF_PSEL_DISCONNECTED(UART_RX)>;
        };
    };
};

@cormoran
Copy link
Author

cormoran commented Jan 2, 2026

Let me close this PR since zmk project won't accept zephyr modification and migration to v4 already done in main branch.
FYI: discussion in discord https://discord.com/channels/719497620560543766/845285904280190996/1437160640149192766

@cormoran cormoran closed this Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant