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

Two peripheral connection with ble_uart_app_ c example

I would like to have one central and two peripheral connection. Ad functionality required is same as NUS UART Example. But the example code connects to only device. Can any one tell what changes are need to be make in ble_app_uart_c example so that it will connect to two peripheral devices.

  • In short you need to add one more connection link during Soft Device enabling/configuration during start (this will also affect RAM allocated for the stack), then you need to clearly separate state variables (such as GAP connection handles and GATT client/server handles) for each connection and finally you need to manage well all BLE events and SD function calls for each of the connections according to your needs (= some kind of state machine). If you need more details well then you need to start some coding. If you will have some simple issue to debug you might try to past code snippets and test/debug results and maybe someone will invest his/her time to debugging with you. But normally you should be able to manage this yourself based on multi-connectable GAP Central example from SDK and all the debugging tutorials from Nordic.

    • NUS UART Client example has the following macros. #define CENTRAL_LINK_COUNT 1 By changing this number to two, I am unable to establish connection between one central and two peripherals. What are the corresponding ram settings need to be changed?
  • Sorry but I don't see it in examples\ble_central\ble_app_uart_c\main.c. However if it works as you need then there is probably nothing to solve.

Related