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

  • 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

  • From Bluetooth: Direct Test Mode:

    " On the nRF5340 development kit, this sample requires the nRF5340: Remote IPC shell sample on the application core. The Remote IPC shell sample is built and programmed automatically by default. If you want to program your custom solution for the application core, unset the CONFIG_NCS_SAMPLE_REMOTE_SHELL_CHILD_IMAGE Kconfig option. "

    So this sample is configured to have that application on the application core.

    However, if you flash the nRF5340 with "west flash", it will flash both cores for you.

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

    The application core owns the pins by default in the nRF Connect SDK.

    To forward pins to the netwok core, see nordic,nrf-gpio-forwarder.

    Regards,
    Sigurd Hellesvik

  • 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

Related