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 Reply Children
  • 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?

  • No, the phone wouldn't support upto 20 links. Normally a phone supports 5-6 links. What I meant is to have a central device that connect to the other 19 devices and also to the phone. 

    You can have a look at this demo: https://www.youtube.com/watch?v=tbl6Dui-_w4

    Source code is here: github.com/.../nrf52-ble-multi-link-multi-role

  • 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?

Related