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

  • yoyou said:

    When I build this project, with the configurations you mention, I get the following error:

    === child image empty_app_core - CPUAPP end ===
    
    CMake Error at /home/sihe/ncs/nrf/cmake/multi_image.cmake:193 (message):
      A domain may only have a single child image.Current domain image is:
      empty_app_core, `empty_app_core` is a domain parent image, so you may add
      `remote_shell` as a child inside `empty_app_core`
    Call Stack (most recent call first):
      /home/sihe/ncs/nrf/cmake/multi_image.cmake:150 (add_child_image_from_source)
      /home/sihe/ncs/nrf/samples/CMakeLists.txt:97 (add_child_image)

    Is the project supposed to build successfully out of the box?

    Regards,
    Sigurd Hellesvik

  • Hi

    if delete the file and folder of "\child_image\remote_shell.overlay",will build successed.

    bese on C:\ncs\v2.0.2\nrf\samples\bluetooth\direct_test_mode, i only want control follow pins in cpunet.

    Why is it so difficult.  can you provide useful examples? (ncs2.0.2 or ncs2.3.0)

         

    i'm testing DTM on board: nRF5340-DK+nRF21540-EK,

    in fact, my product is a headphone that needs to be powered on through these pins to work

           

    thanks

    Best regards

  • Let's take one step back:

    First, to build with the nRF-21540, we also must include "-DSHIELD=nrf21540_ek" to the build. See DTM docs.

    Also, in v2.2.0 and above of the nRF Connect SDK, we have a Kconfig to DB for the nRF21540 in DTM: MPSL_FEM_NRF21540_TX_GAIN_DB.

    If it is possible for you, upgrading to v2.2.0 is probably easier for setting DB.

    Regards,
    Sigurd Hellesvik

  • Hi

    chang to nRF Connect SDK 2.3.0

    copy bese on  C:\ncs\v2.3.0\nrf\samples\bluetooth\direct_test_mode

    if add -DSHIELD:STRING="nrf21540_ek", will build error!

    do DTM on 5340,it take me a lot of time.

    can you provide a complete project zip(contain build folder) bese on ncs2.3.0  direct_test_mode

    and control follow pins in cpunet?

    #ifdef FOR_TX
    	nrf_gpio_cfg_output(0x1e);
    	nrf_gpio_pin_set(0x1e);
    		nrf_gpio_cfg_output(0x15);
    		nrf_gpio_pin_set(0x15);
    	nrf_gpio_cfg_output(0x29);
    	nrf_gpio_pin_set(0x29);
    		nrf_gpio_cfg_output(0x19);
    		nrf_gpio_pin_clear(0x19);
    #else
    	nrf_gpio_cfg_output(0x18);
    	nrf_gpio_pin_clear(0x18);
    	nrf_gpio_cfg_output(0x10);
    	nrf_gpio_pin_set(0x10);
    #endif
    	nrf_gpio_cfg_output(0x2b);//21540  pdn
    	nrf_gpio_pin_set(0x2b);
    		nrf_gpio_cfg_output(0x2c);//csn
    		nrf_gpio_pin_set(0x2c);//high not ctrl spi
    	nrf_gpio_cfg_output(0x25);//rxen
    	nrf_gpio_pin_set(0x25);
    		nrf_gpio_cfg_output(0x24);//mode
    		nrf_gpio_pin_clear(0x24);
    	nrf_gpio_cfg_output(0x26);//antsel
    	nrf_gpio_pin_clear(0x26);
    		nrf_gpio_cfg_output(0x27);//txen
    		nrf_gpio_pin_set(0x27);

      

    Best regards

  • 7288.direct_test_mode.zip

    This sample builds for me with v2.3.0 without issue.

    Build log end:

    Regards,
    Sigurd Hellesvik

Related