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

repeated logging crashes device

In trying to develop a ble peripheral app with verbose logging, I observed the device ceasing to advertise somewhat repeatably.  I think I have an easy bug jar; it reproduces for me 100%

The failure appears to be excersized simply by logging repeatedly under the default sdk config / build.

  1. download/unpack sdk: http://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v14.x.x/nRF5_SDK_14.2.0_17b948a.zip
  2. leave logging config at default:
    1. 115200, 8 data bits, 1 stop bit, parity=none, flow control=none
    2. connect to the /dev/ttyACM0 via putty with the above
  3. modify the sdk code in examples/ble_peripheral/ble_app_hts/main.c
    1. change advertised name (just to ensure uniqueness in a busy lab)
    2. add trivial logging to main loop, as such:
          // Enter main loop.
          unsigned long count = 0;
          for (;;)
          {
              if(++count %10 == 0)
              {
          	    NRF_LOG_INFO("count=%lu", count);
              }
              if (NRF_LOG_PROCESS() == false)
              {
                  power_manage();
              }
          }
      }
  4. build and run via segger embedded studio
  5. Observe the device up and working:
    1. The device resets (LED's flash)
    2. output begins on the serial port
      <info> app: Health Thermometer example started.
      <info> app: Fast advertising.
      <info> app: count=10
      <info> app: count=20
      ...
    3. I can see the name set in main.c being broadcast via a separate scanner
  6. with 100% repeatability, the failure occurs:
    1. serial stops repeatable after this many statements:
      ...
      <info> app: count=290
      <info> app: count=300
      
      
    2. observe that the device has ceased advertising

This is 100% repeatable for me, and it doesn't seem there is anything that could be unique about my system (due to the fact the bluetooth advertisement stops as well).

Related