Implementing Additional Fast Publication Rate Alongside Default Sensor Server Publication in nRF5 SDK for Mesh

Hello,

I'm working with the Sensor Server example from the nRF5 SDK for Mesh. I've successfully implemented the sensor model with the default publication mechanism that works through the Android app configuration (publishing every 3 seconds). However, I need to add an additional, faster publication rate for specific use cases.

Current Setup:
- Using nRF5 SDK for Mesh Sensor Server example
- Successfully implemented sensor_status_publish() with the callback mechanism
- Android app configures publication period to 3 seconds
- Publication address: 0xC001
- TTL: 7
- Current implementation works correctly for the 3-second interval

Requirement:
I need to implement an additional publication mechanism that:
1. Publishes sensor data at ~85-100ms intervals
2. Works alongside the existing Android-configured publication
3. Uses the same model handle and publication address
4. Maintains the same message format as the regular sensor status updates

Technical Details:
- Model handle: m_sensor_server_0.server.sensor_srv.model_handle
- Message length: 23 bytes
- Message format matches the sensor status format
- Using app_timer for timing control

Current Challenges:
1. When implementing the fast publication, it interferes with the Android-configured publication
2. Publication success rate is inconsistent at higher frequencies
3. Need to maintain compatibility with both publication mechanisms

Code Attempt:

static void fast_sensor_status_publish(void)
{
    access_model_handle_t model_handle = m_sensor_server_0.server.sensor_srv.model_handle;
    uint8_t buffer[23] = {0};
    
    // Get sensor data using existing callback
    uint16_t length = 0;
    m_sensor_server_0.sensor_get_cb(&m_sensor_server_0, 
                                   SENSOR_MOTION_SENSED_PROPERTY_ID,
                                   buffer,
                                   &length);

    access_message_tx_t msg = {0};
    msg.opcode.opcode = SENSOR_OPCODE_STATUS;
    msg.opcode.company_id = ACCESS_COMPANY_ID_NONE;
    msg.p_buffer = buffer;
    msg.length = length;
    msg.force_segmented = false;
    msg.transmic_size = NRF_MESH_TRANSMIC_SIZE_DEFAULT;
    msg.access_token = nrf_mesh_unique_token_get();

    uint32_t status = access_model_publish(model_handle, &msg);
    // ... error handling ...
}


Questions:
What is the recommended approach to implement an additional fast publication rate without interfering with the existing publication mechanism?
Are there any specific considerations for handling high-frequency publications in BLE Mesh?
How can I ensure both publication mechanisms (Android-configured and fast) work reliably together?
Are there any buffer management or timing considerations I should be aware of?
Any guidance or examples would be greatly appreciated.
Environment:
nRF52840 DK
nRF5 SDK for Mesh v5.0.0
Segger Embedded Studio

Note: The milli-second option is in the Android nrf Mesh App, but when I try e.g. 200ms, I still get 3 second publish interval. When the device boots up suddenly publish the first message, the higher publishing interval works fine. 

 

Related