Unused pins on the nRF9161 DK and nRF7002 DK?

Do we have documentation anywhere detailing which pin is used or not in the 9161 DK and 7002 DK? I see docs like this:

Board control

Buttons and LEDs

I selected pin 21 thinking it's unused, but I think it's actually set to the value of a button or something else, so I'm unable to use it. I have this set to I/O expander thinking it would at least free up some pins:

However that does not work at all, as some of those pins still hold the value of the buttons/LED states or something else.

The short of it is I'm trying to set up UART1 on this device (9161 DK), and I've got a device tree like so (trying various pins):

&uart3 {
    status = "disabled";
};

&spi3 {
    gd25wb256: gd25wb256e3ir@1 {
        status = "disabled";
    };
    
    status = "okay";
    pinctrl-0 = <&spi3_default>;
    pinctrl-1 = <&spi3_sleep>;
    pinctrl-names = "default", "sleep";
    cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
    
    sdhc0: sdhc@0 {
        compatible = "zephyr,sdhc-spi-slot";
        reg = <0>;
        status = "okay";
        mmc {
            compatible = "zephyr,sdmmc-disk";
            status = "okay";
            label = "SDMMC";
        };
        spi-max-frequency = <25000000>;
    };
};

&pinctrl {
    uart1_default_alt: uart1_default_alt {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 26)>,
                <NRF_PSEL(UART_RX, 0, 28)>,
                <NRF_PSEL(UART_RTS, 0, 25)>,
                <NRF_PSEL(UART_CTS, 0, 27)>;
        };
    };

    uart1_sleep_alt: uart1_sleep_alt {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 26)>,
                <NRF_PSEL(UART_RX, 0, 28)>,
                <NRF_PSEL(UART_RTS, 0, 25)>,
                <NRF_PSEL(UART_CTS, 0, 27)>;
            low-power-enable;
        };
    };
};

&uart1 {
    status = "okay";
    current-speed = <115200>;
    pinctrl-0 = <&uart1_default_alt>;
    pinctrl-1 = <&uart1_sleep_alt>;
    pinctrl-names = "default", "sleep";
    compatible = "nordic,nrf-uarte";
    hw-flow-control;
};

I am using pins 10-13 for my SD card, pins 30-31 for another peripheral, and those work fine. I've been trying to see what other pins I can use for UART1, tried various pins and I keep getting conflicts.

Is there a comprehensive doc somewhere showing which pins are actually free to use on this board?

Parents
  • Just to make sure, are you talking about P0.21 on the nRF9161 DK or the nRF7002 DK in your original post? To avoid confusion, let's focus on one DK first, and take the other after.

    Assuming here, that you're talking about the nRF9161 DK we can refer to nRF9161 DK board file, found in <YOUR NCS FOLDER>\v2.9.0\zephyr\boards\nordic\nrf9161dk\nrf9161dk_nrf9161_common.dtsi

    Here we can see that P0.21 on the onboard nRF5340 is used as the RESET pin, which is likely why you're seeing activity on that pin in your design. P0.10 also is used as a SPI3 CS pin by default. But making a .overlay file should let you overwrite that.

    Best regards,

    Simon

Reply
  • Just to make sure, are you talking about P0.21 on the nRF9161 DK or the nRF7002 DK in your original post? To avoid confusion, let's focus on one DK first, and take the other after.

    Assuming here, that you're talking about the nRF9161 DK we can refer to nRF9161 DK board file, found in <YOUR NCS FOLDER>\v2.9.0\zephyr\boards\nordic\nrf9161dk\nrf9161dk_nrf9161_common.dtsi

    Here we can see that P0.21 on the onboard nRF5340 is used as the RESET pin, which is likely why you're seeing activity on that pin in your design. P0.10 also is used as a SPI3 CS pin by default. But making a .overlay file should let you overwrite that.

    Best regards,

    Simon

Children
  • Looking at that file, I remapped to pins 25-28 in my device overlay, and errors on the 9161 DK side are gone. On the 7002 DK side, I looked at the file ncs\v2.9.0\zephyr\boards\nordic\nrf7002dk\nrf5340_cpuapp_common.dtsi and found that it uses pin 0 and 1 for UART1, which is default, and I am ok with. I picked pins 10 and 11 for RTS/CTS in my overlay, but saw that it conflicts with spi4. I tried disabling spi4 in my overlay, but am running into compilation errors.

    error: '__device_dts_ord_140' undeclared here (not in a function); did you mean '__device_dts_ord_14'?
    92 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)

    &pinctrl {
        uart1_default: uart1_default {
            group1 {
                psels = <NRF_PSEL(UART_TX, 1, 1)>,
                        <NRF_PSEL(UART_RTS, 0, 11)>;
            };
            group2 {
                psels = <NRF_PSEL(UART_RX, 1, 0)>,
                        <NRF_PSEL(UART_CTS, 0, 10)>;
                bias-pull-up;
            };
        };
    
        uart1_sleep: uart1_sleep {
            group1 {
                psels = <NRF_PSEL(UART_TX, 1, 1)>,
                        <NRF_PSEL(UART_RX, 1, 0)>,
                        <NRF_PSEL(UART_RTS, 0, 11)>,
                        <NRF_PSEL(UART_CTS, 0, 10)>;
                low-power-enable;
            };
        };
    };
    
    &spi4 {
        status = "disabled";
    };
    
    &uart1 {
        status = "okay";
        current-speed = <115200>;
        pinctrl-0 = <&uart1_default>;
        pinctrl-1 = <&uart1_sleep>;
        pinctrl-names = "default", "sleep";
        compatible = "nordic,nrf-uarte";
        hw-flow-control;
    };

    This is new to me, so I appreciate your patience / support! Thanks again.

  • I changed it to pins 10 and 12 for CTS/RTS, which weren't in the device overlays, and it was able to compile without the error, however UART does not work this way. I just get UART_RX_STOPPED:

    [00:24:33.562,530] <err> test: UART RX stopped unexpectedly! Error 8
    [00:24:33.569,458] <err> test: UART RX stopped unexpectedly! Error 4

    On my uart callback (the one set by uart_callback_set), I'm logging the stop error like this:

    case UART_RX_STOPPED:
        LOG_ERR("UART RX stopped unexpectedly! Error %d", evt->data.rx_stop.reason);
    It's alternating between these two stop codes:
    I quadruple checked the pins. I have RX going to TX, and TX going to RX. RTS -> CTS, CTS -> RTS. Both are at 1.8 volts, same ground and everything. Any ideas?
Related