nRF5340 how to Direct test mode in NCS2.0

Hello

NCS2.0.2, nRF5340+nRF21540,  vscode

hwo to do Direct test mode with MT8852B? (PS: i konw how to test nRF52840)

i open the demo from:

C:\ncs\v2.0.2\nrf\samples\bluetooth\direct_test_mode

and add code to open 21540 to 20dB like this,

	gpio_pin_configure_dt(&sp_pdn_21540, GPIO_OUTPUT_ACTIVE);
	gpio_pin_set_dt(&sp_pdn_21540,1);		// high
		gpio_pin_configure_dt(&sp_csn_21540, GPIO_OUTPUT_ACTIVE);
		gpio_pin_set_dt(&sp_csn_21540,1);	// high
	gpio_pin_configure_dt(&sp_rxen_21540, GPIO_OUTPUT_ACTIVE);
	gpio_pin_set_dt(&sp_rxen_21540,1);		// high  enabled
		gpio_pin_configure_dt(&sp_mode_21540, GPIO_OUTPUT_ACTIVE);
		gpio_pin_set_dt(&sp_mode_21540,0);	// low  TX_Gain=POUTA(20dB)
	gpio_pin_configure_dt(&sp_antsel_21540, GPIO_OUTPUT_ACTIVE);
	gpio_pin_set_dt(&sp_antsel_21540,0);	// low ANT1
		gpio_pin_configure_dt(&sp_txen_21540, GPIO_OUTPUT_ACTIVE);
		gpio_pin_set_dt(&sp_txen_21540,1);	// high  enabled


	printk("Starting Direct Test Mode example\n");

nRF5340 is two core, is should choose cpuapp or cpunet? if choose cpuapp, the net core no hex.

   

build cpuapp or cpuapp_ns

  dtm.c:2118:24: error: 'RADIO_IRQn' undeclared

   

update SDK to NCS2.3.0 build error:

(PS:cpoy new project C:\ncs\v2.3.0\nrf\samples\bluetooth\direct_test_mode,   don't chang any code)

build cpuapp or cpuapp_ns

dtm.c:2185:35: error: 'NRF_RADIO' undeclared

build cpunet

main.c:73: undefined reference to `__device_dts_ord_66'

   

Best regards

Parents
  • From Bluetooth: Direct Test Mode docs, this sample supports the following boards:

    nrf5340dk_nrf5340_cpunet or nrf21540dk_nrf52840.

    Regards,
    Sigurd Hellesvik

  • Hi,  thanks for reply,

    I have checked your link.

    is means:

    build \nrf\samples\bluetooth\direct_test_mode as nrf5340dk_nrf5340_cpunet, and download to net core,

    app core no hex or download emptyapp(such as helloworld)?

    if need set a pin to high for open peripheral power, it should write to app core or net core?

          

    Best regards

  • Hi,  thanks for reply,

    1. build Remote IPC shell sample as nrf5340dk_nrf5340_cpuapp  and download to application core.

    The Remote IPC shell sample is  C:\ncs\v2.0.2\nrf\samples\nrf5340\remote_shell  ?

    but i can't fonud CONFIG_NCS_SAMPLE_REMOTE_SHELL_CHILD_IMAGE  in Kconfig file.

       

    2. the application core forwarded pins(P0.30,P1.11,P1.10,P1.12)  to the network core, the step as follow?

    add follow code to \boards\nrf5340dk_nrf5340_cpuapp.overlay

    gpio_fwd: nrf-gpio-forwarder {
      compatible = "nordic,nrf-gpio-forwarder";
      nrf21540-gpio-if {
        gpios = <&gpio0 30 0>, <&gpio1 11 0>, <&gpio1 10 0>, <&gpio1 12 0>;
      };
    };

    add follow code to \child_image\hci_rpmsg.overlay

    nrf_radio_fem: nrf21540 {
      compatible = "nordic,nrf21540-fem";
      tx-en-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
      rx-en-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
      pdn-gpios   = <&gpio1 10 GPIO_ACTIVE_HIGH>;
      mode-gpios  = <&gpio1 12 GPIO_ACTIVE_HIGH>;
    };
    
    
     

           

    Best regards

  • yoyou said:
    but i can't fonud CONFIG_NCS_SAMPLE_REMOTE_SHELL_CHILD_IMAGE  in Kconfig file.

    If you add CONFIG_NCS_SAMPLE_REMOTE_SHELL_CHILD_IMAGE  to the direct_test_mode sample, the build system will automatically build remote shell as a child image.

    You can find hex files for this child image at build/remote_shell/zephyr.

    However, if you use VS Code or west to flash the sample, both cores will automatically be flashed.

    yoyou said:

    gpio_fwd: nrf-gpio-forwarder {
      compatible = "nordic,nrf-gpio-forwarder";
      nrf21540-gpio-if {
        gpios = <&gpio0 30 0>, <&gpio1 11 0>, <&gpio1 10 0>, <&gpio1 12 0>;
      };
    };

    The child image is for the application core if you do direct test mode.

    So thie above would be in child_image/remote_shell.overlay

    yoyou said:
    nrf_radio_fem: nrf21540 { compatible = "nordic,nrf21540-fem"; tx-en-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; rx-en-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; pdn-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; mode-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>; };

    And this would be in \boards\nrf5340dk_nrf5340_cpunet.overlay

    Regards,
    Sigurd Hellesvik

  • Hi,

    thanks,   i'v got it,

    \nrf\samples\bluetooth\direct_test_mode

    add two lines to prj.conf

    CONFIG_PARTITION_MANAGER_ENABLED=y
    CONFIG_NCS_SAMPLE_REMOTE_SHELL_CHILD_IMAGE=y
        
    add config to Kconfig file
    config NCS_SAMPLE_REMOTE_SHELL_CHILD_IMAGE  
    	bool "for REMOTE_SHELL_CHILD_IMAGE"
    	default y
    	help
    	   build remote_shell zephyr for app core.
    

    got hex:  "\direct_test_mode\build\remote_shell\zephyr\merged_CPUAPP.hex"

    add forwarder to  \child_image\remote_shell.overlay

    gpio_fwd: nrf-gpio-forwarder {
    	compatible = "nordic,nrf-gpio-forwarder";
    	nrf21540-gpio-if {
    	  gpios = <&gpio1 11 0>, <&gpio1 12 0>, <&gpio1 5 0>, <&gpio1 4 0>, <&gpio1 6 0>, <&gpio1 7 0>  , <&gpio0 0x14 0>, <&gpio0 0x16 0>    , <&gpio0 0x18 0>, <&gpio0 0x10 0>, <&gpio0 27 0>;
    	};
      };
      

    add forwarder to  \boards\nrf5340dk_nrf5340_cpunet.overlay

    &pinctrl {
    	uart1_default_alt: uart1_default_alt {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 0x14)>,
    					<NRF_PSEL(UART_RX, 0, 0x16)>;
    		};
    	};
    	uart1_sleep_alt: uart1_sleep_alt {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 0x14)>,
    					<NRF_PSEL(UART_RX, 0, 0x16)>;
    			low-power-enable;
    		};
    	};
    };
    
    
    &uart0 {
    	status = "okay";
    	current-speed = <19200>;
    	pinctrl-0 = <&uart1_default_alt>;
    	pinctrl-1 = <&uart1_sleep_alt>;
    };
    
    &radio {
    	status = "okay";
    	/* This is a number of antennas that are available on antenna matrix
    	 * designed by Nordic. For more information see README.rst.
    	 */
    	dfe-antenna-num = <12>;
    	/* This is a setting that enables antenna 12 (in antenna matrix designed
    	 * by Nordic) for PDU. For more information see README.rst.
    	 */
    	dfe-pdu-antenna = <0x0>;
    
    	/* These are GPIO pin numbers that are provided to
    	 * Radio peripheral. The pins will be acquired by Radio to
    	 * drive antenna switching.
    	 * Pin numbers are selected to drive switches on antenna matrix
    	 * desinged by Nordic. For more information see README.rst.
    	 */
    	dfegpio0-gpios = <&gpio0 4 0>;
    	dfegpio1-gpios = <&gpio0 5 0>;
    	dfegpio2-gpios = <&gpio0 6 0>;
    	dfegpio3-gpios = <&gpio0 7 0>;
    };
    nrf_radio_fem: nrf21540 {
    	compatible = "nordic,nrf21540-fem";
    	pdn-gpios   = <&gpio1 11 GPIO_ACTIVE_HIGH>;
    	csn-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
    	rx-en-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
    	mode-gpios  = <&gpio1 4 GPIO_ACTIVE_HIGH>;
    	antsel-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
    	tx-en-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
    	// uart
    	uart-tx-gpios = <&gpio0 0x14 GPIO_ACTIVE_HIGH>;
    	uart-rx-gpios = <&gpio0 0x16 GPIO_ACTIVE_HIGH>;
    	// power
    	power-1v8-gpios = <&gpio0 0x18 GPIO_ACTIVE_HIGH>;
    	power-sd-gpios = <&gpio0 0x10 GPIO_ACTIVE_HIGH>;
    	// led
    	ui-led-gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
    };
    
      

    above forwarder contain (21540 pins, uart pins, power pins, led pins)

    i'm not sure if it's correct. build error:

                             

    Best regards

  • It is a dts syntax error.

    Do you want to create a new node, or edit an existing node?

    New node required "/ {":

    / {
        nrf_radio_fem: nrf21540 {
      
    };
    

    But if you want to modify an existing node, you must use "&":

    nrf_radio_fem: &nrf21450

    Also, when I search for this in the nRF Connect SDK, I find it to be nrf21540_fem.
    Not sure how which one you should use, but maybe worth looking into?

    Regards,
    Sigurd Hellesvik

  • Hi, thanks for reply

    if add \child_image\remote_shell.overlay, even a empty file, it will got build error:

    C:\ncs\v2.0.2\zephyr\include\zephyr\device.h:96:39: error: '__device_dts_ord_DT_CHOSEN_zephyr_shell_ipc_ORD' undeclared (first use in this function)
    96 | #define DEVICE_NAME_GET(name) _CONCAT(__device_, name)

          direct_test_mode.rar

    see rar file

            

    Best regards

Reply Children
Related