cancel
Showing results for 
Search instead for 
Did you mean: 

BLE Mesh Lighting Provisioner firmware uart "atep prvn-0 2" command execution through switch button?

Deepak.Aagri
Associate III

every time i have to type the command on uart terminal.

atep scan

Device-0 -> F81D4FAE7DE3A154FD5326E180C0

Test command executed successfully

atep prvn-0 2

Test command executed successfully

Our application doesn't have display. only LED indication and button available. i want to eliminate terminal command 'atep prvn-0 2' using switch button. long press SW2 scan and once the device found "Device-0 -> F81D4FAE7DE3A154FD5326E180C0" via green led indication.

SW3 for "atep prvn-0 2" command execution. UART received message 'Test command executed successfully' indicated through red.

I tried many times but i didn't able to figure it out from where it is executed in debug mode. Please help me & thanks in advanced...

regards

Deepak Aagri

7 REPLIES 7
EMECH
ST Employee

Hello,

You can do that, but how do you know that you are provisioning and configuring the right MESH device with UUID address F81D4FAE7DE3A154FD5326E180C0 ?

Best regards.

Deepak.Aagri
Associate III

I think, with the help of BD_MAC Address can configure right device......

EMECH
ST Employee

Hi,

First of all, let me wish you all the best for this new year !

OK, just for information:

  • atep scan call the BLEMesh_GetNeighborState() function to get a pointer on the neighbor table status. This table list all the node status into the BLE range. This status is a structure composed of the following parameters: BD Address, provision state, UUID, network address if provisioned, RSSI.
  • atep prvn-0 2 call the BLEMesh_ProvisionRemote() function for the Node provisioning.

As you can see each actions on SW buttons set an associated task in a scheduler that will manage all the tasks in a round robin way to prevent any real time trouble.

So, after a SW2 button long press, you can set in the scheduler the AppliMeshSW2Task, previously registered in the scheduler during your application initialization Appli_Init() function:

void Appli_Init(MOBLEUINT8 *flag)

{

...

 UTIL_SEQ_RegTask( 1<< CFG_TASK_MESH_SW1_REQ_ID, UTIL_SEQ_RFU, AppliMeshSW1Task );

 UTIL_SEQ_RegTask( 1<< CFG_TASK_MESH_SW2_REQ_ID, UTIL_SEQ_RFU, AppliMeshSW2Task );

 UTIL_SEQ_RegTask( 1<< CFG_TASK_MESH_SW3_REQ_ID, UTIL_SEQ_RFU, AppliMeshSW3Task );

...

}

CFG_TASK_MESH_SW2_REQ_ID, CFG_TASK_MESH_SW2_REQ_ID, CFG_TASK_MESH_SW2_REQ_ID defined in app_conf.h file as following:

typedef enum

{

 CFG_TASK_ADV_UPDATE_ID,

 CFG_TASK_HCI_ASYNCH_EVT_ID,

 CFG_TASK_MESH_REQ_ID,

 CFG_TASK_MESH_BEACON_REQ_ID,

 CFG_TASK_MESH_UART_RX_REQ_ID,

 CFG_TASK_APPLI_REQ_ID,

 CFG_TASK_MESH_SW1_REQ_ID,

 CFG_TASK_MESH_SW2_REQ_ID,

 CFG_TASK_MESH_SW3_REQ_ID,

 CFG_TASK_MESH_LPN_REQ_ID,

  

 CFG_LAST_TASK_ID_WITH_HCICMD, /**< Shall be LAST in the list */

} CFG_Task_Id_With_HCI_Cmd_t;

Add the SW2 task as following:

static void AppliMeshSW2Task(void)

{

MOBLEINT8 target[16] = { targeted UUID }

 BLEMesh_GetNeighborState(NeighborTable,&NoOfNeighborPresent);

 for(count=0; count < NoOfNeighborPresent; count++)

 {

MOBLEINT8 index;

  index = 0;

while((NeighborTable[count].uuid[index] == target[index]) && (index < 16))

index++

if (index == 15)

{

  BSP_LED_On(LED_GREEN);

exit;

}

else

  BSP_LED_Off(LED_GREEN);

}

With the following definitions in the global variables :

 neighbor_params_t NeighborTable[5]; 

 MOBLEUINT8 NoOfNeighborPresent;

MOBLEINT8 count;

For SW3 button action, set the registered task AppliMeshSW3Task():

static void AppliMeshSW3Task(void)

{

   if(BLEMesh_ProvisionRemote(NeighborTable[count].uuid) == MOBLE_RESULT_SUCCESS)

BSP_LED_On(LED_RED);

else

  BSP_LED_Off(LED_RED);

    

   /* Make copy of the UUID */

   memcpy (NodeUnderProvisionParam.NewProvNodeUUID, 

       NeighborTable[count].uuid,

       UUID_SIZE);

}

On button actions all the associated task are set with the following app_entry.c function:

void HAL_GPIO_EXTI_Callback( uint16_t GPIO_Pin )

{

 switch (GPIO_Pin)

 {

#ifdef SAVE_MODEL_STATE_POWER_FAILURE_DETECTION   

  case POWEROFF_PIN:

   {

    PowerOnOff_flag = 1;

   }

   break;

#endif

  case BUTTON_SW1_PIN:

   {

    UTIL_SEQ_SetTask( 1<<CFG_TASK_MESH_SW1_REQ_ID, CFG_SCH_PRIO_0);

   }

   break;

  case BUTTON_SW2_PIN:

   {

    UTIL_SEQ_SetTask( 1<<CFG_TASK_MESH_SW2_REQ_ID, CFG_SCH_PRIO_0);

   }

   break;

#ifdef ENABLE_OCCUPANCY_SENSOR    

  case BUTTON_SW3_PIN:

   {

    Occupancy_Flag = 1;

    UTIL_SEQ_SetTask( 1<<CFG_TASK_MESH_SW3_REQ_ID, CFG_SCH_PRIO_0);

   }

   break;

#else

  case BUTTON_SW3_PIN:

   {

    UTIL_SEQ_SetTask( 1<<CFG_TASK_MESH_SW3_REQ_ID, CFG_SCH_PRIO_0);

   }

   break;

#endif

    

  default:

   break;

 }

 return;

}

I hope this will help you.

Best regards

Hello EMECH,

We have four LPN node. During provisioning each node taking long time to complete the configuration. Approx. 16-20sec to reach at Appli_ConfigClient_ConfigureNode - **Node is configured** line. Even thought i am using only two model ENABLE_GENERIC_MODEL_SERVER_ONOFF  and VENDOR MODEL.   How to reduce the provisioning time period. As all node having same UUID so we have to wait to complete the process for each node.       

EMECH
ST Employee

Hi Deepack,

Sometimes **Node is configured** line can take few seconds to appear, nevertheless it doesn't mean that the Node is not already provisioned and configured.

When you wrote that "all node having same UUID", please take care that the UUID (Universally Unique IDentifier) should be unique per BLE device ...

Best regards.

HI EMECH,

UUID is not same because of each module having unique BDAddress. Timing being i am not using uuid_prefix_data.. is it mandatory?

For example :

    F81D4FAE-7DEC-XBC4-Y12F-17D1AD07A961 (16 bytes)

    <any number> |_| |_|  <BDAddress>

Best Regards

Deepak

EMECH
ST Employee

Hi Deepak,

What do you mean by "I am not using uuid_prefix_data" ?

Does your MESH devices can be provisioned and configured by the smartphone ST BLE Mesh App ?

Best regards.