Greetings, fellow developers and enthusiasts! I’m reaching out to share my experience and seek guidance on integrating BLE Mesh with the Nordic UART Service (NUS) in Zephyr. This journey has been both enlightening and challenging, and I’d love to hear your thoughts and suggestions.
The Goal
My objective is to create a program that leverages BLE Mesh for sensor data collection while simultaneously utilizing NUS for UART communication. The vision is to have a sensor client read data from a sensor server, send this data via peripheral UART to an external device, and ensure seamless integration within the Zephyr framework.
The Approach
I started by referencing official Zephyr examples, including sensor_client
, sensor_server
, peripheral_uart
, and ble_peripheral_lbs_coex
. These examples provided a solid foundation, but integrating BLE Mesh and NUS proved more complex than anticipated.
The code structure was designed to initialize both BLE Mesh and NUS handlers. The BLE Mesh component handles sensor data collection, while the NUS handler manages UART communication. However, I encountered several hurdles during implementation.
Challenges Faced
-
Advertising Initialization
- Despite maintaining the logic and structure of the
ble_peripheral_lbs_coex
code, I faced difficulties in initializing advertising. Errors such as ‘no BUFFER’, ‘no context’, and ‘No more contexts’ frequently appeared.
- Despite maintaining the logic and structure of the
-
Resource Constraints
- The limited resources on the nRF52833 board posed a significant challenge. Balancing the resource requirements of BLE Mesh and NUS proved tricky, especially when attempting to maintain both functionalities simultaneously.
-
Error Handling and Debugging
- Debugging the errors related to advertising and resource allocation was time-consuming. Logs indicated issues with buffer management and context availability, suggesting potential conflicts between the two services.
Current Status
While BLE Mesh functionality works as intended, the integration of NUS remains unresolved. The advertising initialization failure is a critical roadblock, preventing the NUS service from functioning properly.
Questions and Seeking Advice
- Is my approach to integrating BLE Mesh and NUS correct, or is there a better way to achieve this functionality?
- Are there known limitations or conflicts when combining these services in Zephyr?
- Could there be alternative methods or workarounds to achieve similar functionality without integrating NUS directly?
I’ve scoured online resources and forums but haven’t found relevant examples or solutions. Any insights, suggestions, or pointers to relevant documentation would be greatly appreciated!
Conclusion
This project has been an excellent learning opportunity, highlighting the complexities of integrating multiple Zephyr services. While challenges remain, I’m optimistic about finding a solution with the right guidance. Let’s collaborate and explore innovative ways to overcome these hurdles!
Best regards,
[Your Name]