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();
}

  • NRFX_ERROR_TIMEOUT

    It shows you are getting timeout in you code. In that line add the try catch block which will give your the details about the error. Then you can easily find the exact cause of this error.

  • Sr. No. Short Name Full Form
    1 A2A full form Ask to Answer
    2 ACC full form Actually
    3 ACE full form Excellent or Great
    4 AFSfull form Always Forever and Seriously
    5 AKA full form Also Known As
    6 AMA full form Ask Me Anything
    7 ASAIC full form As Soon As I Can
    8 ASAP full form As Soon As Possible
    9 ASL full form Tell me your Age, Sex, and Location
    10 AUO full form I don’t know
    11 AW full form Anyway
    12 B4 full form Before
    13 BBL full form Be Back Later
    14 BBN full form Be Back Never
    15 BBS full form Be Back Soon
    16 BBZ full form Babes
    17 BF  full form Boy Friend
    18 BFF full form Best Friend Forever
    19 BOT full form Back On Topic
    20 BRB  full form Be Right Back
    21 BTW full form By the Way
    22 CYL  full form Catch You Later
    23 DIY  full form Do it Yourself
    24 DM full form Direct Message
    25 DP  full form Display Picture
    26 ETA Estimated Time of Arrival
    27 FAQ Frequently asked Questions
    28 FYI For Your Information
    29 GE Good Evening
    30 GF Girlfriend
    31 GM Good Morning
    32 GN Good Night
    33 HHOJ Ha Ha, Only Joking
    34 HHOK Ha Ha, Only Kidding
    35 HHVF Ha Ha, Very Funny
    36 hmm Thinking
    37 IB I’m Back
    38 ICYMI In Case You Missed It
    39 IHS I Hope So
    40 IIL I’m in Love

    https://www.emotepp.com

Related