Problems using the nRF5340's P0.21 pin as a GPIO output

Hello,

I am developing an nRF5340 custom board by setting the pins as shown below.

- P0.19: UART_RX
- P0.20 : UART_TX
- P0.21: GPIO Output

I have a problem when trying to use the P0.21 pin as a GPIO output that used to be used as UART_CTS on the nRF5340DK.

When I add below code in app.overlay file and set GPIO values to 0 and 1, it always outputs 0.

&pinctrl {
    uart0_default: uart0_default {
        group1 {
            psels = <NRF_PSEL(UART_TX020)>;
        };
        group2 {
            psels = <NRF_PSEL(UART_RX019)>;
            bias-pull-up;
        };
    };
    uart0_sleep: uart0_sleep {
        group1 {
            psels = <NRF_PSEL(UART_TX020)>,
                <NRF_PSEL(UART_RX019)>;
            low-power-enable;
        };
    };
}

However, if the above code is removed from the app.overlay file and the nrf5340_cpuapp_common-pinctrl.dtsi file of the nRF Connect SDK is modified as above, it works fine.

I think it is not correct to modify the nrf5340_cpuapp_common-pinctrl.dtsi file.

Could you please let me know if there is a way to use P0.21 by modifying the app.overlay file?

Regards,
Seongbin

Parents
  • Hi,

    Could you try replacing the instances of uart0_default and uart0_sleep with some other name?
    For example, add _alt to the end.

    Remember to replace the names in the uart0 node as well:

  • Hi ,

    Thank you for your reply.

    I tried adding the code below to app.overlay but I have the same problem.

    &pinctrl {
        uart0_default_alt: uart0_default_alt {
            group1 {
                psels = <NRF_PSEL(UART_TX020)>;
            };
            group2 {
                psels = <NRF_PSEL(UART_RX019)>;
                bias-pull-up;
            };
        };
        uart0_sleep_alt: uart0_sleep_alt {
            group1 {
                psels = <NRF_PSEL(UART_TX020)>,
                    <NRF_PSEL(UART_RX019)>;
                low-power-enable;
            };
        };
    }
    &uart0 {
        pinctrl-0 = <uart0_default_alt>;
        pinctrl-1 = <uart0_sleep_alt>;
    };

    Regards,
    Seongbin

  • I tried adding the code below to app.overlay and my code but I have the same problem.

    in app.overlay :

    in my code : 
     
  • Could I please see the build/zephyr/zephyr.dts file? Either attach the file, or copy it into a code block.

  • 3386.zephyr.dts

    I have attached the zephyr.dts file.

  • Please check the file I attached.

  • Hi,

    I can't see anything wrong with the DTS setup, so this looks like a bug.

    But for a custom board I would normally recommend having custom board files anyway, where you modify the board files, like nrf5340_cpuapp_common-pinctrl.dtsi, to fit the custom board.

Reply
  • Hi,

    I can't see anything wrong with the DTS setup, so this looks like a bug.

    But for a custom board I would normally recommend having custom board files anyway, where you modify the board files, like nrf5340_cpuapp_common-pinctrl.dtsi, to fit the custom board.

Children
No Data