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

Mesh with bi-direction communication

Hi all,

I have an application where I have a mobile app  that communicate with up to 20 BLE devices. The BLE devices are RGB LED lights with push buttons and a sensor. I want to be able to from the mobile app, send a code to turn on and set the color of 1 or more of these lights. Also, when the button on the light is pressed, it needs to send the sensor value to the app.

May I know what is the best method to implement this and how to get started? Will the Mesh Serial example or SDK UART coexistance example work?

Thanks in advance.

Parents
  • Hi,

    What is the distance between devices and to the phone ? If it's in the RF range with the phone, you don't really Mesh. Our BLE softdevice support up to 20 concurrent links. 

    If mesh is needed, your application is pretty similar to this demo: https://www.youtube.com/watch?v=XthbU9NP0Yg

     The source code is provided here: https://github.com/NordicPlayground/thingy52-mesh-provisioning-demo

    It can be configured with our nRF mesh app. 

    Of course you would need to modify the app and firmware to customize for your application, but it's a good place to start with. 

  • Hi Hung Bui,

    Thank you for the reply. I am only looking at a range of about 50m or less. You mention that the Nordic softdevice supports up to 20 concurrent links. Is this supported by any mobile phone that has BLE? Or different models of phones or mobile OS will affect the number of concurrent links?

    Does this then mean that I can have each of these devices running ble_app_uart and have the phone connected to all 20 of them at the same time and exchange information?

  • Hi Hung Bui,

    I am trying your suggestion. I have downloaded nRF5_SDK_v15.2.0, downloaded the nrf52-ble-multi-link-multi-role example and followed the instructions on the github page. I do not have nRF52840 PDK, so I am using a nRF52832DK (PCA10040) and I am more familiar with using Keil.

    I opened the project in the directory nRF5_SDK_15.2.0\examples\training\ble-multi-link-multi-role\ble_aggregator\pca10040\s132\arm5_no_packs\ble_aggregator_pac10040_s132.uvprojx and tried to compile the project.

    I got the error:

    ..\..\..\main.c(62): error:  #5: cannot open source input file "ble_lbs_c_extended.h": No such file or directory

    I figured that I have to include the ble_lbs_c_extended.h file, so I went into project options to include this directory: ..\..\..\..\common\ble_lbs_extended

    I tried to compile again and now, I am getting this error which I have no idea how to solve:

    .\_build\nrf52832_xxaa.axf: Error: L6218E: Undefined symbol ble_lbs_led_color_send (referred from main.o).

    Also, I noticed there are a few ble_peripheral directories: ble_peripheral, ble_peripheral_long_range, and ble_peripheral_long_range_color. What is their difference?

    I have a Nordic Thingy. Which program should I use?

    Can you help? Thank you.

    Update:

    I commented out a few lines that made a call to the function: ble_lbs_led_color_send:

    // First, try to access the devices as a Blinky device
    //err_code = ble_lbs_led_color_send(&m_lbs_c[i], colors);
    //if(err_code != NRF_SUCCESS)
    //{
    // If the blinky call fails, assume this is a Thingy device
    err_code = ble_thingy_uis_led_set_constant(&m_thingy_uis_c[i], button_action ? r : 0, button_action ? g : 0, button_action ? b : 0);
    if (err_code != NRF_SUCCESS &&
    err_code != BLE_ERROR_INVALID_CONN_HANDLE &&
    err_code != NRF_ERROR_INVALID_STATE)
    {
    return err_code;
    }
    //}

    The program compiles successfully now. However, when I try to load the program onto the nRF52DK, nothing is happening. I don't see any LED blinking neither can I scan for the aggregrator from the android app. I also used RTT viewer to see the log and saw the following errors:
    0> <error> app: Fatal error
    0> <warning> app: System reset
    0> <error> app: Fatal error

    Debugging the program shows that the program go to system reset on the line: 

    gap_params_init();

  • Hi Kian, 

    When you see Fatal error, you can debug it. You can follow this guide. 

    However, the issue you are having is related to the fact that we was preparing the demo for PCA10056 (nRF52840 DK) SES and the other projects were not updated. I have reported this internally and it should be fixed most likely by the end of tomorrow. Please try again later. 

  • Thanks Hung Bui, I will wait for the updated codes on Github.

    Alternatively, I have a nRF52840 dongle (PCA10059). Can that work replace the nRF52840DK as an aggregator? If so, do I need to make any changes to the codes?

    I read on the nRF52840 dongle programming tutorial, the says the following:

    Adjust the linker configuration. Set FLASH_START=0x1000 to place the application right above the MBR. You should also set FLASH_SIZE=0xDF000 to make sure that there is room for the bootloader at the end of the flash. Set RAM_START=0x20000008, as the first 8 bytes are used by the MBR for interrupt forwarding and adjust the size accordingly by setting RAM_SIZE=0x3FFF8.

    Do I have the same exact change too?

  • If you have nRF52840 DK you can use the SES project for it in github and it should work out of the box. Keil project should also work if you include the missing file (in common folder). I would suggest to install SES and have a look inside the project to find the difference to fix the Keil project. It should be only 2 files missing.
    You don't have to do anything extra. The programming  tutorial is for other application. 

  • Hi Hung Bui,

    I like to further feedback that the program for ble_peripheral is not working too for pca10040. I like to compile and download the codes onto a Nordic Thingy. I am trying to compile the ble_peripheral project for pca10040 on SES and I am getting this error:

    C:\NordicSemi\nRF5_SDK_15.2.0\examples\components\libraries\log\src\nrf_log_backend_rtt.c: No such file or directory

    I figured that the components directory is referenced wrongly in the project properties. So rather than changing the user directory in project options -> preprocessor, I just copied and paste the components directory inside the examples directory. I tried compiling again and I am getting another error:

    compiler_abstraction.h: No such file or directory

    I am not sure how to fix this and if there will be more errors after fixing this. Can Nordic also help to check and fix this project?

    I am using SES with the latest SDK15.2 downloaded from Nordic.

Reply
  • Hi Hung Bui,

    I like to further feedback that the program for ble_peripheral is not working too for pca10040. I like to compile and download the codes onto a Nordic Thingy. I am trying to compile the ble_peripheral project for pca10040 on SES and I am getting this error:

    C:\NordicSemi\nRF5_SDK_15.2.0\examples\components\libraries\log\src\nrf_log_backend_rtt.c: No such file or directory

    I figured that the components directory is referenced wrongly in the project properties. So rather than changing the user directory in project options -> preprocessor, I just copied and paste the components directory inside the examples directory. I tried compiling again and I am getting another error:

    compiler_abstraction.h: No such file or directory

    I am not sure how to fix this and if there will be more errors after fixing this. Can Nordic also help to check and fix this project?

    I am using SES with the latest SDK15.2 downloaded from Nordic.

Children
Related