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

Concurrent connections ble_app_hrs issue

Arm Gcc (using Eclipse Neon) | SDK 13.0 | nrf52 DK (PCA10040) | tried soft device 4.0.2 and 4.0.4

I can successfully compile and run the example -ble peripheral- ble_app_hrs. Everything works as it should including bonding.

I want to add concurrent connections (nrf is peripheral - nrf has no central). I am referencing the experimental multiperipheral example (which works and compiles fine on its own - just no bonding or peer manager). When I change the following lines in the ble_app_hrs example, I get error 4 on softdevice_enable.

Under // Configure the maximum number of connections , I change the default to:

ble_cfg.gap_cfg.role_count_cfg.periph_role_count  = 2;

I think error 4 means a memory error. So I put some breakpoints in softdevice_handler.c where it throws error 4 and get the correct memory origin (original was 0x20002558, it now says it should be 0x20002c98. I change the linker to have the origin as 0x20002c98 instead of 0x20002558. I clean the project and erase the chip and recompile and flash and the program does not start. When I go to debug, I get an 0x0 error window open in the debugger and the program never starts.

What am I missing? Any help would be appreciated! Bryan

  • FormerMember
    0 FormerMember

    When changing the memory settings, do you change the size as well, not only the start address?

    To add support for multiple peripheral links, both the softdevice and the application will have to be set to handle it. It means that:

    • the softdevice has to be configured to support multiple links, like you already do.
    • the application will have to handle multiple connections. For how to make the application handle multiple connections, I would recommend you to have a look at the (experimental_)ble_app_multiperipheral example in the SDK. I would think the easiest is to add the HRS functionality to the multiperipheral_example. This answer explains the steps for adding the UART service to the multilink example (central), however, the steps will be the same for in the "peripheral" case.
  • When I am accessing the breakpoints in the sofdevice_handler.c to determine the RAM start, I also look at the line that says" RAM size should be adjusted to ...". In my case, it recommended the size not change by just changing the ble_cfg.gap_cfg.role_count_cfg.periph_role_count to 2 from 1. Not sure how to proceed from there.

    I understand that I will need to add the application handling of multiple connections. I plan to add that from the multiperipheral example but I can't get past the memory issue to even set the application changes up. I would assume the program would still boot and act as normal with a single connection.

    Please try just changing this one line in the example (change ble_cfg.gap_cfg.role_count_cfg.periph_role_count value to 2) and see if it give you the same results. I am puzzled at this point. I am using the 10040 DK.

    Thanks for your help!

  • FormerMember
    0 FormerMember

    I just tested what you describe, and I had to change the RAM start address to 0x20002C98 and the size to 0xD368, and then the device starts to advertise. (I tested with S132 v 4.0.2, because I haven't had time to download S123 v 4.0.4 yet..)

  • Thank you for your help. It worked with your settings. Can you tell me how you came up with the size? I checked and the soft device handler show the proper start address but not the correct size. It would be helpful to know how you calculate the size.

    Thanks,

    Bryan

  • FormerMember
    0 FormerMember

    The RAM size is the amount of RAM available for the application. On the nRF52832, there is 64 kB of RAM = 0x10000. The RAM start address set in the application, is the first RAM address used by the application. All addresses below that one are reserved for the softdevice.

    Since the RAM region starts at address 0x20000000, the RAM start address indicated by the softdevice reflects the amount of RAM used by the softdevice. Therefore the application RAM size can be calculated the following way:

    RAM size = 0x10000 - (RAM start address - 0x20000000)

Related