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

Combining Mesh and Blinky examples

Hello everyone.

I would like to set-up a mesh network of Thingy:52 devices and an nRF52840, which would help me communicate from the an external stimulus to the phone, via this mesh network.

The steps that I have done are: I tried the the Light switch demo Ok & thingy52-mesh-provisioning-demo Ok and the BLE Blinky Application Ok. So, my goal is to send a notification on the phone, when a button on the other end is pressed. Something like that:

[external button -> on, to start communication] -------> [client starts Bluetooth communication (nRF52840)] ------> [server (Thingy:52), relay] ------> [phone running 'Blinky App', receives notification].

Do you have an idea/suggestion of how I should combine the two examples? From what I understand, the phone cannot participate in the Mesh, so the tricky part should be a code on the nRF52840, which helps the board (1) join the mesh and subscribe to notifications, while (2) also writing into a characteristic something, to send a notification on the phone.

Thank you in advance!

Parents
  • Hi,

    I suggest you have a look at the coexistence examples from our Mesh SDK, you can use that as a reference to combine a mesh example and an example from nRF5 SDK. 

    This document is also relevant.

  • Hello and thanks for replying me! It looks very useful.

    Ok, I will try these and come back if I am in trouble, thank you so much!

    Best wishes!

  • Hi ! As you suggested me, I followed the links and now I'm trying to actually combine the two codes. But the documentation for this is a bit unclear to me - maybe because of my lack of experience. Anyway, I would like to ask if I understood correctly.

    I understand that I should follow the steps from this link. But I do not know if including the source files refers to (1)folders copy-paste or (2) actually #include files in C?

    That would be my first question. 

    My second question is: Where do all these files need to be copied? Should I make a specific folder with all of them in the SDK big folder? I guess that depends on how they are included in the other .c and .h files, but again - I do not know if I should change some C files too.

    Thank you very much.

  • Hi,

    You don't necessarily need to copy the source files anywhere. "Including the source files" refers to adding the source files into your project. When you open the project go into the left pane(Project explorer), right-click on the Project/a folder then press "Add New File...".

    In addition to adding the sorce files you need to include paths to your include files. Do the following:

    1. Right-click on your project, press "Options.."

    2. In the upper left corner in the drop-down box, change from "Debug"/"Release" to "Common"

    3. Under "Code", press "Preprocessor"

    4. Choose "User Include Directories" and add the path here

    Assuming you are using SES.

  • Hi  and thanks for replying me with detailed info. Now I have another error.

    To sum up what I have done so far: from this tutorial, I followed the all 3 steps like this: 

    Including nRF5 SDK for Mesh functionality in an nRF5 SDK example
    1. Include the following source files from nRF5 SDK for Mesh in the nRF5 SDK example's project file - done. I created a folder in SES like you explained, like this: 


    2. Add the following folders to the project include path of the nRF5 SDK example - done. I added all 15 mentioned folder paths  in the "User Include Directories" like this: 

    ../../../../../../../nrf5_SDK_for_Mesh_v320/mesh/core/api
    ../../../../../../../nrf5_SDK_for_Mesh_v320/mesh/core/include and so on for all 15 folders. 


    3. Add the following preprocessor symbols to the project file of the nRF5 SDK example - done. I added it similarly:

    However, when building the project, I get the error: nrf_mesh_config_app.h: No such file or directory.  

    I notice that it is used in the context:

    #ifdef CONFIG_APP_IN_CORE
    #include "nrf_mesh_config_app.h"
    #endif

    Could you please help me debug this issue? Should I just comment it? I mention that I do not even find this .h file in my Mesh folder. However, I can just copy it from here.

    Thank you in advance & best wishes, Alexa.  

  • Hi .

    A short update: I decided to copy that file from the internet and now that error is gone. However. I get the following:

    #error "This file should be copied, not included."

    What does this refer to? I do not understand what "copy" and "include" mean in this context. Should I just copy the content? If yes, where?

    Thanks in advance.

  • Hi,

    From the documentation Integrating Mesh into nRF5 SDK examples

    • If you are adding you own mesh functionality rather than working from an existing mesh example, you also need to add the file nrf_mesh_config_app.h. Copy it from the examples/templates folder in mesh stack repository into your project folder, and remove #error message at the top of the file. Make other appropriate changes to the file content, like adjusting ACCESS_ELEMENT_COUNT and ACCESS_MODEL_COUNT to the required number of elements and models.

    Can you try copy from the template instead and remove #error message at the top of the fil? Does it make any difference? Also, go through the "Optional changes" in the document.

    A comment on combining the two examples though. I think it might be easier doing it the other way around, use a mesh example(for example light switch) and then add the nRF5 functionality to it instead.

Reply
  • Hi,

    From the documentation Integrating Mesh into nRF5 SDK examples

    • If you are adding you own mesh functionality rather than working from an existing mesh example, you also need to add the file nrf_mesh_config_app.h. Copy it from the examples/templates folder in mesh stack repository into your project folder, and remove #error message at the top of the file. Make other appropriate changes to the file content, like adjusting ACCESS_ELEMENT_COUNT and ACCESS_MODEL_COUNT to the required number of elements and models.

    Can you try copy from the template instead and remove #error message at the top of the fil? Does it make any difference? Also, go through the "Optional changes" in the document.

    A comment on combining the two examples though. I think it might be easier doing it the other way around, use a mesh example(for example light switch) and then add the nRF5 functionality to it instead.

Children
  • Hi 

    Copy it from the examples/templates folder in mesh stack repository into your project folder,

    I did that. But I would like to point out that nrf_mesh_config_app.h does not go in the project folder, i.e. C:\SESProj\nRF5_SDK_1530\examples\ble_peripheral\ble_app_blinky\pca10056\s140\ses, like you are proposing. 

    Instead, it goes to C:\SESProj\nrf5_SDK_for_Mesh_v320\mesh\core\api, where all .h files for the project are. Otherwise it will throw errors. 

    Can you try copy from the template instead and remove #error message at the top of the fil? Does it make any difference?

    I did erase those 3 lines and I do not get that specific error anymore. Instead, other errors arise, from the file mesh_opt_gatt.h not being found. (and I neither find this in any folder nor on the internet).

    think it might be easier doing it the other way around, use a mesh example

    Thanks for your suggestion, but it's completely unclear to me how to follow the original tutorial. If I switch to the other way round, I don't know which files from the SDK I should move to the Mesh folder. So, I will try to follow the original post, with the hope that it will work some day.. Disappointed

  • Have you taken a look at the SDK UART coexistence example? It is an example where mesh is merged into the nRF5 UART example. This example can be used as a reference as to how you can merge mesh into the Blinky example.

  • Hi! Sorry for the delay, I have been trying this example which you advised me.

    It builds successfully. However, I cannot test it. My steps are the following:

    1. Follow the 4 steps from the SDK UART coexistence example.

    2. Try to connect via nRF Mesh App - not sucessfull No entry sign The board is not found in the app. 

    3. Try to connect via nRF Connect - not sucessfull No entry sign  I can connect to the board. But whenever I try to write something in the field Mesh Proxy Data In, I get disconnected to the board (and I can reconnect back, but still the message is not received).

    Do you have any ideas how to make this example work? Thanks a lot for your ideas and help!

  • Hi,

    The Coexistense examples doesn't support PB-GATT so you won't be able to see/provision it using the nRF Mesh app. You need to use the provisioner example found in our SDK and provision it like you would with the light switch example. After you have provsioned it you can connect to it via nRF Connect and send data to the node.

  • Hello,

    so you won't be able to see/provision it using the nRF Mesh app.

    - ok, I did not know that. Thanks. Slight smile

    I used the phone for the light switch example, because I do not have so many boards (in the example, it's specified that we can use either a board or the phone, so I just used the phone). 

    So, you are saying that I should use another development kit for provisioning, instead.  

Related