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

ble_app_uart_c losing characters

Hello again Nordic World.

We are slowly attempting to transition from the nRF51 environment to nRF52.  We are starting, not with development environment for our product, (it will remain at the 51 leve for now) but with the replacement of our nRF51 Dongles, which we use with the ble_app_uart_c code as a terminal interface to our board for testing.  We are attempt in to replace the nRF51 Dongle with the nRF52 DK.

The problem is that the ble_app_uart_c code from the 15.2 SDK, running on the 52 DK is dropping characters.   Please review the following snippets and note the alignment and missing characters which always seem to get lost in the 3rd column:

3689 4100 419 3689 4123 0 0 2 4100 4193 0 3689 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5190 4734 1
3682 4100 4193 3682 4123 -7 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5191 4735 1
3682 4100 4193 3682 4123 0 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5192 4736 1
3682 4100 4193 3682 4123 0 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5193 4737 1
3682 4100 4193 3682 4123 0 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5194 4738 1
3689 4100 4193 3682 4123 7 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5195 4739 1
3682 4100 4193 3682 4123 -7 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5196 4740 1
3682 4100 4193 3682 4123 0 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5197 4741 1
3689 4100 4193 3682 4123 7 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5198 4742 1
3682 4100 4193 3682 4123 -7 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5199 4743 1
3689 4100 419 3682 4123 7 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5200 4744 1
3682 4100 4193 3682 4123 -7 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5201 4745 1
3682 4100 4193 3682 4123 0 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5202 4746 1
3682 4100 4193 3682 4123 0 0 2 4100 4193 0 3682 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 5203 4747 1

Here is the exact same information as printed by the 51 Dongle under SDK 12.3:  Note the perfect alignment and no missing characters.

3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4861 4405 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4862 4406 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4863 4407 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4864 4408 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4865 4409 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4866 4410 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4867 4411 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4868 4412 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4869 4413 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4870 4414 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4871 4415 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4872 4416 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4873 4417 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4874 4418 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4875 4419 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4876 4420 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4877 4421 1
3710 4100 4193 3710 4123 0 0 2 4100 4193 0 3710 4123 0 4100 3400 0 4000 3300 0 1 1 0 0 4878 4422 1

Any ideas on where to search for and correct this problem is greatly appreciated.

Robin @ TL

Some additional information requested by stateside FAE:

The dropping is consistent in that the only characters dropped are the 16th, 17th, or possibly 18th (not know as both are spaces) in the first string sent.to each line.  However when it is dropped seems to be somewhat random.

The 52DK is connected form its u-usb connector on board to a USB-C on my computer by a short (~18") cable.

The only change is the hardware and the version of the unaltered example code running on each.

2 each 52DK's and 2 each cables have been tested.

  • Robin said:
    Nor have I yet used the J-link RTT viewer. If you could give me a lead on using either of these options it would be greatly appreciated.

     If you have installed J-Link on your computer (which I suspect that you may have done), you can find it under:

    C\Program_files (0x86)\SEGGER\JLink_VXX\JlinkRTTViewer.exe.

    If that is not installed, you can find it here:

    https://www.segger.com/products/debug-probes/j-link/tools/rtt-viewer/

    When you open it, you should be prompted with this window:

    Select the 3 dots to the right in "Specify Target Device" and select "Nordic Semi" from the dropdown menu to find the nRF52832_xxAA.

    These settings should be stored, so you shouldn't have to find "nRF52832_xxAA" from the list the next time you want to check the RTT Log.

    Maybe you can try to send a static string from the nRF51 dongle, so that you know what characters should be coming in? 

    I don't know how fast you are sending the strings from your dongle, so it is hard to reproduce. I did some testing just now, by typing in some strings in one Termite window (51 dongle), and they appear correctly in the other termite window (52 DK).

    So how fast are these messages being sent? Is the baudrate on the UART on the DK fast enough to keep up?

    Best regards,

    Edvin

  • Hello Edvin,

    W/r/t how fast, each line of chars is sent once per minute, but there is no delay between each set of 19 chars that make up each line, which I hope would not be a problem with the ring buffer catching at least a full line 

    When I have time, I will get used  to the segger tool and setup a test to send static chars from our 51 based board, then repeat from the 51 dongle.  But it will be a few days before I get there.  In the meanwhile I humbly ask that you set up to send lines the same size as mine, at once a minute and watch for drops.  If you want the ring buffer code and snippets of the string sending code let me know and I can up post them for you.

    Thank you again

    Robin @ TL

  • I have tried sending 19 chars once every second or so, but I don't see any drops in the log. Have you changed anything in the ble_app_uart_central project? What function do you use to print the UART strings?

  • Hello Edvin,

    Each line is multiple (6, I believe) 19 char sets per second.  Not exactly sur how many, as I am not at the computer right now.  Will check later and get back to you.

     Actually they are not  "strings", I strip off the null for compatibility with terminal software.  

    I have not modified the central code.

  • Hello Edvin,

    Back at the computer.  Seems to be my second (maybe first) home these days.  Here is the straight answer on how many chars are being sent per second.  Below is the code that send the chars that is executed once per minute.  As you can can see, there are 13 transmissions each second, but for when the hourly header is xmited which the doubles the rate.  The first 12 xmits have have 12 chars, and the 13th has 13 to account for the new line and carriage return.  Hope this helps.  We NEED this working soon and I am way to wrapped up in other concerns to get to chasing it down 

    Again, thanks for any and all help.

    Robin @ TL


      if ((loop_count % 60 == 0) & board_life_print_on)
      {
        sprintf(message_buffer, "BATT  CMIN  ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "CMAX  DMIN  ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "DMAX  RATE  ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "CHRG? LIFST ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "ICMIN ICMAX ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "ICCNT IDMIN ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "IDMAX IDCNT ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "LCMIN LCMAX ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "LCCNT LDMIN ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "LDMAX LDCNT ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "FULL? DISC? ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "CHRG? EMPT? ");
        m_send_chars(message_buffer);
        sprintf(message_buffer, "LFCNT CHCNT\r\n");
        m_send_chars(message_buffer);
        if (loop_count > 0)
        {
          nvram_write();
        }
        
      }
      if (board_life_print_on)
      {
        sprintf(message_buffer, "%4d  %4d  ", battery_state.charge, battery_state.min_charge);
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%4d  %4d  ", battery_state.max_charge, battery_state.min_discharge);
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%4d  %4d   ", battery_state.max_discharge, battery_state.charge_rate);
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%4d  %4d ", (battery_state.charge_events CHECK_CHARGING) , batt_life_chk_state);
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%5d %5d ", sys_cal_data.board_life.init_charge_min, sys_cal_data.board_life.init_charge_max);
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%5d %5d ", sys_cal_data.board_life.init_charge_count, sys_cal_data.board_life.init_discharge_min);
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%5d %5d ", sys_cal_data.board_life.init_discharge_max, sys_cal_data.board_life.init_discharge_count);
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%5d %5d ", sys_cal_data.board_life.last_charge_min, sys_cal_data.board_life.last_charge_max);
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%5d %5d ", sys_cal_data.board_life.last_charge_count, sys_cal_data.board_life.last_discharge_min);
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%5d %5d ", sys_cal_data.board_life.last_discharge_max, sys_cal_data.board_life.last_discharge_count);
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%5d %5d ", ((battery_state.charge_events CHECK_WAS_FULL) >> 4), 
                                          ((battery_state.charge_events CHECK_WAS_DISCHARGING) >> 3));
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%5d %5d ",  ((battery_state.charge_events CHECK_WAS_CHARGING) >> 2), 
                                          ((battery_state.charge_events CHECK_WAS_EMPTY) >> 1));
        m_send_chars(message_buffer);
        sprintf(message_buffer, "%5d %5d\r\n", sys_cal_data.board_life.life_count, charge_count);
        m_send_chars(message_buffer);
      }
    
     

Related