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

Strange behaviour migrating from SDK 15.0.0 to SDK 15.2.0

Hi,

we've developed and produced a nRF52832-based custom PCB with custom firmware that is using advertising, scan, connection, custom Bluetooth service and characteristics, TWI, UART, PWM and more (SDK 15.0.0 and S132 v6.0.0).

I'm now trying to migrate to SDK 15.2.0 and S132 v6.1.1 with a "fast" approach, that is:

  • opening ble_app_rscs_c example in SDK 15.2.0
  • overwriting its main.c with our main.c
  • adding all the necessary files
  • aligning its sdk_config.h with our sdk_config.h

At a first attempt, the firmware just kept resetting. After some debugging, I found out that the problem was due to the advertising part:

  1. advertising_init() does its job
  2. a timer that periodically calls advertising_start() is started
  3. when such timer expires, the advertising should start

It did not start though, and caused the system to crash. Why? Because it saw m_advertising.initialized=false even if the initialization was fine. The problem indeed was the timer: after it was started, the m_advertising.initialized turned from true to false.

Curious, but the most curious thing is that the problem was resolved by simply changing the name of such timer from m_adv_start_timer_id to m_refresh_timer_id.

At this point I was able to see regular advertising packets, but not able to perform a connection (when trying to connect, the system crashes because of SoftDevice assert). Strange thing: it happened a couple of times that the connection was established for a few seconds (I could even see all of my custom characteristics!) before crashing again. I could not solve this issue.

Another strange fact: by enabling the scan (and a timer that periodically restarts it), two LEDs are blinking instead of just one (which is what it should do in normal conditions). Even more strange: changing the timer's name, no LED is blinking.

I guess there are more strange things out there that I just couldn't see. I am aware that this is not a simple question to answer, but maybe you have an idea of what could cause all of these strange problems.

If not, what could be the right approach to accomplish such migration? Start again adding one functionality at a time and move on only if it is working fine? It's gonna be a long work and I'd really like to avoid it, also because I think I'm close to have things working with the "fast" approach.

Any help/suggestion is appreciated.

Thanks and best regards

Parents
  • Hi Gino, 

    I had a look at SDK v15.0 and SDK v15.2 and saw no difference regarding the advertising module. It must be something else inside your application. 

    Maybe you would need to look for the use of m_adv_start_timer_id() in your code if it's started before the advertising module initialized or not. 

    Please note that SDK v15 use softdevice version 6.0 when the SDK v15.2 uses softdevice v6.1. You need to match the api header files to the softdevice you actually use on the board. 

  • Hi Hung, 

    thanks for you answer. However, advertising_start() is not called before advertising_init(). I've tried to trick the issue by starting the timer before the call to advertising_init() (with advertising_start() being called after advertising_init() since the timer takes a while to expire) and it worked fine, but then the other connection problem remains, so there must be something more.

    Your suggestion could be the solution, but I don't understand how should I "match the api header files", could you give just one example please? I thought developing with SDK 15.2 and flashing the S132 v6.1 to the board before flashing the firmware was sufficient, isn't it?

  • Correct, you just need to match that the header files you included in your project is from \components\softdevice\s132\headers of the SDK V15.2 and the softdevice you flash is v6.1 

    Please check why it's disconnected and which assert you have from the softdevice. Reducing your application functionality to the point that it only advertise and wait for a connection can help pinpoint the issue. 

  • Checked the headers location and they're fine.

    Now I've only advertising and LED blinking to show that the board is alive.

    I've tried to connect and the first attempt have been positive (but just for a couple of seconds). 

    Second attempt suddenly gave this error:

    What could it be?

Reply Children
No Data
Related