This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

sensor_server with 5 Property IDs always failed in getting configuration (compositon_data_get) step using nRF Mesh (Android)

Hi,

My development setup:

HW:  nRF52840 DK
SDK: nrf5_SDK_for_Mesh_v5.0.0_src + nRF5_SDK_17.0.2_d674dde + s140nrf52720
Provisioner: nRF Mesh Android app (Ver 3.1.0)

-----------------------------------------------------------------------------------

I modified sensor_server example (nrf5_SDK_for_Mesh_v5.0.0_src\examples\sensor\server) to support multiple Property IDs (2 to 5)

Below are the Property ID I used in the modified sensor_server app: 

#define SENSOR_MOTION_SENSED_PROPERTY_ID (0x0042)
#define SENSOR_PRESENCE_DETECT_PROPERTY_ID (0x004D)
#define SENSOR_PRESENT_AMBIENT_TEMPERATURE_PROPERTY_ID (0x004F)
#define SENSOR_PRESENT_AMBIENT_RELATIVE_HUMIDITY_PROPERTY_ID (0x0076)
#define SENSOR_PRESENT_AMBIENT_VOC_PROPERTY_ID (0x0078)

I have tried adding UP TO 4 Property IDs (and up to 4 descriptors), everything is working fine, i.e. able to get through provisioning and configuration successfully and work fine with sensor_client app to send the descriptor msg for all property ids and other test (per the sensor example)

   

Problem statement:
When the number of Property ID is increased to 5, during provisioning (using nRF Mesh Android app) process,  even though sensor_server is able to go through provisioning successfully (Note: On nRF Mesh mobile app: "<- Provisioning complete received" is shown) but it consistently failed/stopped at the "composition data get" step (Pls see nRF Mesh's  screenshot below)

I have repeatedly tried with 4 and 5 Property ID builds for several times and verified that the build with 4 Property ID is always OK in all aspects but for the build with 5 Property ID, the nRF Mesh always failed at the " -> Sending composition data get .." step. 

Some debugging info:
1. I have put in some log message in handle_composition_data_get in handle_composition_data_get() (in config_server.c) and noticed that the function runs ok all the way till the end (i.e. app_evt_send(&evt). 

2. The handle_config_default_ttl_get() is not invoked for the case of 5 Property ID

This is unclear to me the issue lies with nRF52840 firmware or with the nRF Mesh mobile app.

Pls advise what needs to be done to make the sensor_server_model capable of supporting 5 Property IDs (for 5 sensors).

Another side issue:
When the sensor_server model supports only 3 sensors (3 Property IDs and 3 descriptors), I am able to click "Get Sensor" on nRF Mesh app to get the 3 sensors info showing up (under Sensor Information section). However, when testing with sensor_server with 4 sensors (4 Property ID and 4 descriptors). Upon clicking the "Get Sensor" on nRF Mesh, the nRF Mesh app will either has no response or exit from Sensor Server model screen. 

  

 

Parents Reply Children
  • Hi deno, I see a slight issue here, both iOS and Android libraries are failing parse the 4th property however the the sample app is crashing where as it should not. The reason for not showing up the 4th sensor property which is "Ambient Relative Humidity" is because the data provided provided by the senor is wrong. This property contains a characteristic called Humidity which should contain a uint16 and what the library/apps are receiving is uint8 causing the parsing to fail.

    I will update the Android app so that it does not crash in case of invalid data is received and once you fix the issue on the fw side all 4 sensor properties should show up.

  • Hi Rashan, I believe you referred to the "side issue" reported. In my app code (main.c and sensor_common.h), property id has already been defined as uint16 and I am not sure which "Humidity" characteristic you referred to in the sensor descriptor data (Pls see the extracted code below).

    At application level, I don't see how the descriptor data is being sent. Could the issue with sending of the "Humidity" characteristic as uint8 (instead of uint16) lie in BLE mesh stack or the sensor example code itself? 

    Another question: The descriptors for all the 4 Property ID are defined in the same way, why would the BLE Mesh app works for the case of 3 sensors (3 Property ID) and not for the case of 4 sensors (4 Property ID)?

    BTW, any finding so far with regard to the main issue reported (failed at Sending composition data get step for the case of 5 property id)?

    Thank you.


    In sensor_common.h:
    
    /** Parameters for the Sensor Descriptor. */
    typedef struct
    {
        uint16_t property_id;               /**< Property ID for sensor */
        uint16_t positive_tolerance;        /**< 12-bit value for possible positive sensor error */
        uint16_t negative_tolerance;        /**< 12-bit value for possible negative sensor error */
        uint8_t sampling_function;          /**< Sampling function applied to measured sensor values */
        uint8_t measurement_period;         /**< Period over which measurement is taken in seconds */
        uint8_t update_interval;            /**< Interval between measurement updates in seconds */
    } sensor_descriptor_t;
    
    In main.c:
    
    static uint16_t property_array[] = {NUM_PROPERTY_ID, 
                                        SENSOR_MOTION_SENSED_PROPERTY_ID,
                                        SENSOR_PRESENCE_DETECT_PROPERTY_ID,
                                        SENSOR_PRESENT_AMBIENT_TEMPERATURE_PROPERTY_ID,
                                        SENSOR_PRESENT_AMBIENT_RELATIVE_HUMIDITY_PROPERTY_ID,
    #if (NUM_PROPERTY_ID == 5)
                                        SENSOR_PRESENT_AMBIENT_VOC_PROPERTY_ID
    #endif
                                       };

  • Hi Deno, yes I was referring to the side issue. So when there is 4 sensors the app works fine but the side issue was only 3 descriptors being listed in the app when sending a SensorGet. This was because the the mesh libraries in the app are expecting a Uint16 (2 bytes)in the humidty characteristic where as there is only 1 byte available on the humidity characteristic causing the SensorStatus to ignore the 4th descriptor. I would check line number 73 and 98 in your app_sensor_utils.c and I have a feeling your are returning the pir_data_size_t for all property_id cases irrespective of the property_id. Each property_id has different data sizes defined. please check Mesh Device Propterties specification.

    What I noticed with your main issue was that, the app/library does not get any response from the device for a CompositionDataGet which we managed to produce in both platforms Android and iOS. So we can narrow down it's something on the firmware.

  • Hi Roshan, Thanks for the detailed info on data size. In the Mesh Device Properties Spec v2 (pg 22-23):

    3.5.11 Present Ambient Relative Humidity device property
    This property represents relative humidity measured by a humidity sensor.
    Characteristic: Humidity

    As Humidity is a scalar value, I presume its represented value is related to the raw value by the following equations (per pg 11): R = C * M * 10d * 2b

    But it is unclear to me what individual data size is it for R, C, M, d and b. Also, what values of M, d and b are supposed to be used for "Humidity" characteristic? I could not find the info in Mesh Device Properties Spec v2. Can you advise?

    With regard to the main issue, is anyone from nRF5 Mesh stack team helping to look into the issue from firmware perspective?

  • Hi,

    deno said:
    With regard to the main issue, is anyone from nRF5 Mesh stack team helping to look into the issue from firmware perspective?

     Regarding your main issue, I have reached out to our Mesh team for help. I will update you as soon as I get a response.

Related