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

Application not running after BLE DFU

Hello,

my current problem is, that my application is not running when flashing it via BLE DFU using nrf52832 on BLE Nano V2 and nrfConnect. But the same code runs fine, when flashing the application over SWD (the DAPLink USB Companion Board of the BLE Nano). So I tried to comment out the code I've added last time and tried to transfer the application once again over BLE and it worked..... I added the code step by step to my program again and tested the DFU update mechanism after every step. At some point the application is not starting anymore after flashing it via BLE DFU. But I don't think, that this is specific to my applications source code, because the application runs without problems when flashing over cable. Could it be a memory problem while updating? Because if code is comment out the application size is smaller of course...

I'm using sdk v15, s132 v6, eclipse, gcc and I'm only updating the application not the softdevice or the bootloader.

While searching for the error, I tried to enable the logging functionality with UART as backend in the bootloader, which is basically the example from the sdk. But after modifying the makefile and the sdkconfig.h I get a linker error which says:

_build/nrf52832_xxaa_s132/nrfx_uarte.c.o (symbol from plugin): In function `m_nrf_log_UARTE_logs_data_const':
(.text+0x0): multiple definition of `UARTE0_UART0_IRQHandler'
_build/nrf52832_xxaa_s132/nrfx_uart.c.o (symbol from plugin):(.text+0x0): first defined here

I just added the header and source files to the bootloader project, necessary for logging over uart, I did no changes in the code.

If someone could help me to solve the linker problem, maybe I get one step further with the DFU problem ;)

EDIT: The DFU Update works now. But I don't know exactly why... In the meantime I worked at the same program on a button for entering sys off state. While testing this, I found out that the BLE Update works now, the transfered application runs. But I also found out, another part of my code doesn't work which I didn't touched without any error messages.... I think there's one big general problem, but I can't see the context... It's weired.....

Thanks in advance

Markus

  • Hi Markus,

    In essence you see different unrelated issues that come and go when you do seemingly unrelated changes to your application? What is the state of your application when you say it is not running? Can you check with a debugger what is going on? Is it for example in a error handler, or is it waiting for something that never happens? It is not easy to point at a cause in this case, but there are a few possible reasons worth investigating in more detail:

    • Interrupt priority issue: could it be that you have some code running in an interrupt context that is waiting for something that is going to be done in a lower interrupt priority or main context? If so, this would result in a lockup.
    • Memory corruption: Perhaps you for some reason overwrite some memory that is used for something else (accessing an array out of bonds or similar). If so, anything could happen depending on what memory was overwritten.
  • In essence you see different unrelated issues that come and go when you do seemingly unrelated changes to your application?

    Yes you can say so..

    What is the state of your application when you say it is not running? Can you check with a debugger what is going on?

    Sorry I can't check it anymore, because this issue no longer occurs. But the device is not advertising and the connected devices vai TWI and UART are not working.

    I'll check my code against your suggestions. Can you give me more examples what else could cause a memory corruption?

  • I debugged the application and found out, that I get a segmentaion fault when accessing a particular function. When calling this function from main() no problem occurs, if accessing it from the uart- or the app-timer-event-handler the segmentation fault happens. The function uses twi. The priority of the twi interrupt is higher than the uart- or app-timer-irq-priority. Is it generally possible to call functions like that from a event handler?

  • It seems you are getting closer to the issue. The most typical interrupt priority issue is a lockup due to a higher priority thread waiting for something that should be done by a lower priority thread. How have you verified the fault?

    If you see a fault, then I am inclined to think that memory corruption could still be the problem, but it is difficult to say anything with confidence without a deeper understanding of your application. Is there any data shared between these functions that could be in a bad state if one is interrupted at the wrong time? Or perhaps the issue could be stack overflow issue. Do you have data located right beneath the stack (memory address vise)? Can you increase the stack size and see if it helps?

  • Hi,

    There was an issue with multiple duplicates of your latest post, and for some reason all got deleted during clean-up. I will try to get it back, but I cannot promise anything. Did you by any chance copy the content so that you can post it again if I am not able to retrieve the deleted post? I am sorry for the inconvenience.

Related