How publish period is calculated in nrf sdk for Mesh

Hi,

I am trying to provision and  set the publish period for a sensor server model by using an ESP32 as both my provisioner and configuration client. I am able to provision my node and able to set the model publication state too. But when I set the publish period as 30 seconds from my ESP32, the actual publish period being set is 57 seconds and when I set the publish period to 20 seconds,  the actual publish period set is 17 seconds. May I know why this happens? 

I am following the ble mesh standard to set the publish period wherein, I use the first two bits for resolution and the remaining bits for steps. 

So the publish period is calculated as = steps * resolution.

I am trying to set the publish period as 30 seconds and the value I used to set the publish period in the model publication state is 121(in decimal). When I right shift 121 by two I get steps as 30. And when I get the first two bits using bit masking it is 1 (0b01). As per this calculation, the publish period set in the sensor server should be = 30(steps) * 1sec(resolution). But it isn't the case. I have attached the screenshot from mesh profile specification document which will comply with the above calculation. 

Please help me in resolving this issue.

Parents
  • Hi Hariharan, 

    For 30s publish period, could you try to send 0x5E instead ? 
    If you have a look at line 1358 in config_server.c in the nRF5 SDK you can see this: 

    To get the format we actually right shift 6 position (ACCESS_PUBLISH_STEP_NUM_BITS) 

    So it's the little endian should be used. Meaning Publish Period format bit 6-7 is actually the MSB. So instead of 1111001 (121 decimal)  you should use 01011110 (94 decimal) 

    You can use the nRF Mesh app on the phone to test and check which value it sends to the nRF52 as the reference. 

  • Hi Hung, 

    Thank you for explaining how its done in nrf mesh sdk. I resolved it. But am curious. Is it implemented in the nrf mesh sdk as little endian or is that how it is mentioned in the mesh specification too?

Reply Children
Related