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

ble_nus_data_send() can not send data to mobile app (nRF UART v2.0)

Hi,

I am developing with nRF52832, SDK 15.3

I have an issue with sending data over NUS service. When I flash the code to nRF, it starts advertising, but when I connect to it by nRF UART v2.0 mobile app, LED 1 on DK just fast double blinks and DK disconnects my phone. My code is modified to sending data over ble_nus_data_send() every time app_timer handler is triggered. Value to be send is modified from intenger data type, to char data type, so maybe there might be the problem.

thanks for help!

static void data_send()
{
  uint32_t       err_code;
  int16_t   i = 123 ;
  char  buf[BUFSIZ];
  snprintf(buf, sizeof(buf), "%d", i);
  static uint16_t length = sizeof(buf);

      err_code =   ble_nus_data_send(&m_nus, buf, &length, m_conn_handle);

         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("Value Received !");


}

static void repeated_timer_handler(void * p_context)
{
    data_send();
}

Parents Reply Children
Related