Question about NCS DTM and BLE stack option.

I would like to develop DTM and normal BLE stack operation in single firmware by NCS. Basically i will check a GPIO, go DTM test mode if GPIO short to High, go normal BLE stack if GPIO short to GND.

However, it seems no way to achieve that.

If i set CONFIG_BT=y, then start DTM, it get crash or HARDWARE FAULT.

If i set CONFIG_BT=n, then ok for DTM, but no way to initialixe the BLE Stack manually in code.

Am i correct?

So is it possible to enable CONFIG_BT=y manually in codes? Or disable BLE Stack completely so that i can switch to DTM mode properly?

Already search but still seems no feasible solution.

Thanks.

Parents
  • Hello,

    I guess there are different ways of doing this, and simplest should be as you suggest, is to select whether to run DTM or BLE after a reset. For instance you can have test pin on the board, e.g. with pull-up, such that when it's low on reset the application run DTM, else it will run BLE.

    So in start of main() you would simply do something like (example is outdated, check direct_test_mode.zip file instead):

    // Edit: Updated code.
    // in prj.conf
    // DYNAMIC_DIRECT_INTERRUPTS=y
    // MPSL_DYNAMIC_INTERRUPTS=y
    
       void main(void) {
           // read pin to find if application should run DTM or BLE
    
           if (dtm_mode) {
               printk("Booting into DTM mode\n");
               err = mpsl_lib_uninit();
               dtm_init();
               // Enter DTM mode loop
               while (1) {
                   dtm_cmd_process();
               }
           } else {
               printk("Booting into BLE mode\n");
               int err = bt_enable(NULL);
               // Normal BLE application logic here
           }
       }

    Or are you saying you have tried this but it doesn't work?

    Kenneth

Reply
  • Hello,

    I guess there are different ways of doing this, and simplest should be as you suggest, is to select whether to run DTM or BLE after a reset. For instance you can have test pin on the board, e.g. with pull-up, such that when it's low on reset the application run DTM, else it will run BLE.

    So in start of main() you would simply do something like (example is outdated, check direct_test_mode.zip file instead):

    // Edit: Updated code.
    // in prj.conf
    // DYNAMIC_DIRECT_INTERRUPTS=y
    // MPSL_DYNAMIC_INTERRUPTS=y
    
       void main(void) {
           // read pin to find if application should run DTM or BLE
    
           if (dtm_mode) {
               printk("Booting into DTM mode\n");
               err = mpsl_lib_uninit();
               dtm_init();
               // Enter DTM mode loop
               while (1) {
                   dtm_cmd_process();
               }
           } else {
               printk("Booting into BLE mode\n");
               int err = bt_enable(NULL);
               // Normal BLE application logic here
           }
       }

    Or are you saying you have tried this but it doesn't work?

    Kenneth

Children
Related