nRF5340 PDK network core UART

I am porting RF evaluation code to the nRF53 NCS/zephyr/Segger Embedded Studio toolchain, using only the network core to start.

How do you recommend configuring the network core UART for debugging on the nRF5340 PDK? Is it possible to set it up to use the DK's virtual COM port (instead of the application core)? How else does the PDK support this, ie. with an external JLink?

  • You should be able to use the Virtual COM port by swapping the GPIO pins for the two processor cores. You will need to enable debugging over UART for the network core and change the GPIOs in an overlay file.

    You'll need to use a baud rate other than 921 600, and preferably use HWFC. 

  • Thanks! I actually tried this on zephyr's hello_world sample.. my only change was to add the overlay below and build for the cpunet target instead of cpuapp. 

    nrf5340_dk_nrf5340_cpunet.overlay:

    &uart0 {
    	current-speed = <115200>;
    	status = "okay";
    	tx-pin = <20>;
    	rx-pin = <22>;
    	rts-pin = <19>;
    	cts-pin = <21>;
    };
    

    Resulting in this entry in nrf5340_dk_nrf5340_cpunet.dts_compiled:

    uart0: uart@41013000 {
    	compatible = "nordic,nrf-uarte";
    	reg = < 0x41013000 0x1000 >;
    	interrupts = < 0x13 0x01 >;
    	status = "okay";
    	label = "UART_0";
    	current-speed = < 0x1c200 >;
    	tx-pin = < 0x14 >;
    	rx-pin = < 0x16 >;
    	rts-pin = < 0x13 >;
    	cts-pin = < 0x15 >;
    };

    This is similar to the entry for the cpuapp target:

    uart0: uart@8000 {
    	compatible = "nordic,nrf-uarte";
    	reg = < 0x8000 0x1000 >;
    	interrupts = < 0x08 0x01 >;
    	status = "okay";
    	label = "UART_0";
    	current-speed = < 0x1c200 >;
    	tx-pin = < 0x14 >;
    	rx-pin = < 0x16 >;
    	rts-pin = < 0x13 >;
    	cts-pin = < 0x15 >;
    };
    

    I see serial output for cpuapp (both over virtual COM and using an analyzer on the pins) but not for cpunet. I didn't see any differences related to UART when I compared the generated\configs.c files. What did I miss?

  • That's strange, there should not be any uart from the cpuapp since you assigned it to different pins. Are you sure you flashed the new FW to cpuapp as well as cpunet? Maybe the old fw on cpuapp is still using the default uart pins

  • I copied the second uart0 entry above from hello_world's .dts_compiled built for cpuapp. I wanted to show that the pins were being assigned the same in both cases (meaning the cpunet overlay is working). 

    I made sure to nrfjprog.exe --recover prior to flashing the cpunet firmware to make sure the app core wouldn't interfere. I did confirm that if I don't change the pins I get the expected output on the default uart0 pins (checked with a logic analyzer), but nothing when I try to switch to virtual COM. I'll see if debugging with SES turns up any clues.

  • You can try to scope the pins with a digital analyzer and see if there's anything at all, maybe the UART settings for baud rate and HWFC is not correct.

    But, have you compiled and flashed the new fw for the application core as well? If it's still using the default UART pins you wont be able to use them from the network core.

    Can you read out the registers of UARTE0 @41013000, after you've initialized the UART? 

Related