Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How send simple string message ble_peripheral to central multilink example.

Hi,

I am using nRF52832 DK and other same custom board, sdk v15.0 with SES IDE. My application like this:

For ble peripheral used example ble_app_uart and for central used multilink example.

I want to send sensor data using ble_app_uart to central multi-link after completed sending sensor device will go to sleep and it will again wake-up after 1Hr and automatically connect to central and send sensor value to connected central. This will continuous monitoring process and my sensor device is battery operate supply.

Now, i am facing following issues:

  1. How i can send simple string message to connected central, which function and how i can use in my peripheral side.
  2. I was refer this link and also changes done replace ble_lbs_c  by ble_nus_c  but not receiving and also not able to show incoming message on console at central side.
  3. My peripheral device is connected to central and in peripheral i written simple code for sending message:

void send_to_central()
{
    uint32_t err_code;
     uint16_t length = (uint16_t)5;
    char string[5] = "Hello";
    err_code = ble_nus_data_send(&m_nus, string, &length, m_conn_handle);
    APP_ERROR_CHECK(err_code);
    if ( (err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_BUSY) &&
         (err_code != NRF_ERROR_NOT_FOUND) )
          {
              APP_ERROR_CHECK(err_code);
          }
  NRF_LOG_INFO("Send to central\r\n");
}

But Not receiving at central side. Please help me where i am wrong.

Please provide me example code for sending and receiving string message over peripheral to central.

 Thanks in advanced.

Parents
  • For a good example, I would see how the uart central & uart peripheral examples communicate with each other & add uart support for the multilink example like in the link you posted. Once you have understood those examples, it should not be too difficult to add uart support the the multilink central example.

  • Thanks for your reply,

    I checked as you provided above link and i have already done changes in my peripheral as well as central code.

    I noticed at central side the notification is not enabled the "ble_nus_c_evt_handler" is not generated in central why it so happen. 

    could you please provide me small sending function snippet for peripheral. I want to send message directly once connected event generated in peripheral.

    Is problem for communication if i use nRF52832 DK for multilink and sparkfun nRF52832 custom board for peripheral because both of board file is different. If yes for sparkfun how i add custom board.h file.  

    We have less time for develop solution.

    Thanks..!!!

Reply
  • Thanks for your reply,

    I checked as you provided above link and i have already done changes in my peripheral as well as central code.

    I noticed at central side the notification is not enabled the "ble_nus_c_evt_handler" is not generated in central why it so happen. 

    could you please provide me small sending function snippet for peripheral. I want to send message directly once connected event generated in peripheral.

    Is problem for communication if i use nRF52832 DK for multilink and sparkfun nRF52832 custom board for peripheral because both of board file is different. If yes for sparkfun how i add custom board.h file.  

    We have less time for develop solution.

    Thanks..!!!

Children
No Data
Related