nRF52840 dongle P0.24 and P0.22 can't be changed.

Hello all,

I config nRF52840 dongle P0.24 and P0.22 as GPIO_OUTPUT. But when I change their value, they are always 0.

I use the same way to change other pins such as P0.02 and led1_bule, and they all can be set the value i want.

Here is my code about it.

	port0 =DEVICE_DT_GET(DT_NODELABEL(gpio0));

	gpio_pin_configure(port0, 24, GPIO_OUTPUT);
    gpio_pin_configure(port0, 22, GPIO_OUTPUT);

	gpio_pin_set(port0, 22, 1);
	gpio_pin_set(port0, 24, 0);
    

	gpio_pin_configure(port0, 12, GPIO_OUTPUT);#led1_blue

	gpio_pin_configure(port0, 2, GPIO_OUTPUT);
	gpio_pin_set(port0, 2, 1);
	
	for(;;){
	    gpio_pin_toggle(port0, 12);
	}

Because P0.24 and P0.22 are the external PA&LNA ctrl pins for txen and rxen, I try to add following in overlay. This method can make these two pins high after booting. 

When I try to configure them as GPIO_OUTPUT in my application, they are both changed to 0.

/ {
	nrf_radio_fem: pa_lna {
	   compatible = "skyworks,sky66112-11", "generic-fem-two-ctrl-pins";
	   ctx-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
	   crx-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
	};
 };

Is there something to set?

By the way, I'm using ESB with external PA&LNA SKY2401c. Is there any simple way to control these two pins? Otherwise I have to pull up and pull down these pins manually.

Thanks!

Parents Reply Children
  • Ah, ok. I found out that it was working when programming the DK with your application, but not the dongle. The issue was that P0.22 and P0.24 are by default used by the UART in the dongle's board files:

    &pinctrl {
    	uart0_default: uart0_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 20)>,
    				<NRF_PSEL(UART_RTS, 0, 17)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 24)>,
    				<NRF_PSEL(UART_CTS, 0, 22)>;
    			bias-pull-up;
    		};
    	};

    (from nrf52840dongle_nrf52840-pinctrl.dtsi)

    Try disabling the uart completely in your nrf52840dongle_nrf52840.overlay file, by adding this bit at the very end:

    &uart0 {
    	compatible = "nordic,nrf-uarte";
    	status = "disabled";
    	current-speed = <115200>;
    	pinctrl-0 = <&uart0_default>;
    	pinctrl-1 = <&uart0_sleep>;
    	pinctrl-names = "default", "sleep";
    };

    At least that did the trick for me.

    Best regards,

    Edvin

  • Hi,

    with uart0 being disabled, P0.22 and P0.24 could be set right value.

    Thank you so much!

Related