nRF52840 DK external UART communication

Hi,

I went through the Nordic Academy nRF Connect SDK Fundamentals - Serial Communication. I tried the exercise program where LED1, LED2 and LED 3 are toggled by pressing 1, 2 or 3 at serial terminal Tera Term and it works.

I would like to toggle the LED1, LED2, and LED3 from external UART communication. I use another board TI CC26x2R1 to send 1 and 2 to nRF52840 P0.08 UART RX but nothing happens. I think this is because the nRF52840 UARTS are still connected to the interface MCU nRF5340. How do I make this work? 

Regards,

Markel

  • Hi,

    I think this is because the nRF52840 UARTS are still connected to the interface MCU nRF5340.

    Yes, that would be the case. P0.08 is set up as TXD on between the interface mcu and the nrf52840 (see product specification section 3.2). 

    How do I make this work? 

    You need to select a different GPIO which is free and available. Could you post your overlay files and code where you intialize the UART device?

    In general what you need to do is:

    1. Decide which GPIO you want to use for your UART, meaning that you will have to select between any of the free and available GPIOs. Figure 20 in the PS showcases quite a few that are free, most of them being in P2, P3 and P4. 
    2. Set up the UART in an overlay file as explained in lesson 3 of the fundamentals course and select which pin to use through pin control

    It would looke something like 

    &pinctrl {
    	uart1_default_custom: uart0_default_custom {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 29)>,
    				<NRF_PSEL(UART_RTS, 0, 28)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 31)>,
    				<NRF_PSEL(UART_CTS, 0, 30)>;
    			bias-pull-up;
    		};
    	};
    
    	uart1_sleep_custom: uart0_sleep_custom {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 29)>,
    				<NRF_PSEL(UART_RX, 0, 31)>,
    				<NRF_PSEL(UART_RTS, 0, 28)>,
    				<NRF_PSEL(UART_CTS, 0, 30)>;
    			low-power-enable;
    		};
    	};
    
    &uart1 {
    	compatible = "nordic,nrf-uarte";
    	status = "okay";
    	current-speed = <115200>;
    	pinctrl-0 = <&uart1_default_custom>;
    	pinctrl-1 = <&uart1_sleep_custom>;
    	pinctrl-names = "uart1_default_custom", "uart1_sleep_custom";
    };

    Disclaimer: I've not tested if this overlay setup works, but it showcases how you can set up a new uart (uart1) which uses different gpios

    By default the uart0 of on the 52840dk is set up as follows: 

    &pinctrl {
    	uart0_default: uart0_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 6)>,
    				<NRF_PSEL(UART_RTS, 0, 5)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 8)>,
    				<NRF_PSEL(UART_CTS, 0, 7)>;
    			bias-pull-up;
    		};
    	};
    
    	uart0_sleep: uart0_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 6)>,
    				<NRF_PSEL(UART_RX, 0, 8)>,
    				<NRF_PSEL(UART_RTS, 0, 5)>,
    				<NRF_PSEL(UART_CTS, 0, 7)>;
    			low-power-enable;
    		};
    	};
    	
    	&uart0 {
    	compatible = "nordic,nrf-uarte";
    	status = "okay";
    	current-speed = <115200>;
    	pinctrl-0 = <&uart0_default>;
    	pinctrl-1 = <&uart0_sleep>;
    	pinctrl-names = "default", "sleep";
    };

    Kind regards,
    Andreas

  • Thanks, I will try it. Actually, I just now made it to work by connecting the USB cable to the other USB port.

    Regards,

    Markel

Related