This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

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?

Parents
  • 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? 

  • To see registers other than the CPU group in SES, I had to manually specify the .svd register definition file downloaded separately via the MDK. Is that a necessary step or should SES have some knowledge of these already?

    While the pin and baud registers are set correctly, I immediately see UART0 ERRORSRC=0xC after setting a breakpoint on the printk line of main. I don't see this when I build the same code for cpuapp. HWFC is not set in either case.

    I don't want to burn too much time on this simple example, I was just looking to get familiar with the PDK before trying to bring up the UART properly on the net core. Maybe I will just proceed to that. Are there any examples other than HCI RPMsg that have been proven out for cpunet? 

Reply
  • To see registers other than the CPU group in SES, I had to manually specify the .svd register definition file downloaded separately via the MDK. Is that a necessary step or should SES have some knowledge of these already?

    While the pin and baud registers are set correctly, I immediately see UART0 ERRORSRC=0xC after setting a breakpoint on the printk line of main. I don't see this when I build the same code for cpuapp. HWFC is not set in either case.

    I don't want to burn too much time on this simple example, I was just looking to get familiar with the PDK before trying to bring up the UART properly on the net core. Maybe I will just proceed to that. Are there any examples other than HCI RPMsg that have been proven out for cpunet? 

Children
No Data
Related