nRF5340 DK BLE code crashing while integration.

Hi,
I am facing an issue while integrating BLE with the rest of my code. The code crashes when I try to start BLE outside of main().

Currently, I have placed the BLE initialization at the beginning of main(), and it starts and advertises successfully. However, the code crashes during the bonding process.

  • I am using two threads in my application.

I am using nrf5340, 2.6.1 SDK and 2.6.1 toolchain manager.

This are my configuration.



this is BLE start code 


Please help me resolve this issue, as I am in the final stage of my project completion!

Parents
  • Hi!

    The code crashes when I try to start BLE outside of main().
    Currently, I have placed the BLE initialization at the beginning of main(), and it starts and advertises successfully. However, the code crashes during the bonding process.

    So you are seeing 2 different crashes.

    Could you post the crash info for this? Any log output, etc that shows this?

  • Hi,

    In the first case, when BLE is initialized outside main(), the logs stop without any error.

    In the second case, during the bonding process, after entering the BLE-generated passcode, the bonding completes on the application side but not on the controller side. At this point, the logs stop without any error.

  • Hi,

    I’m wondering if I haven’t properly configured the heap, stack, or something else.

    My code is relatively large, but it only occupies 20% of the flash.

    Do I need to make any configuration changes?

    Or is there anything I can test to identify the issue?

    Please help me resolve this!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • Hi!

    REDHAT said:
    In the first case, when BLE is initialized outside main(), the logs stop without any error.

    What makes you think it "crashes" then ?

    REDHAT said:
    In the second case, during the bonding process, after entering the BLE-generated passcode, the bonding completes on the application side but not on the controller side.

    What do you mean by "controller" side? Could you explain this some more?

Reply
  • Hi!

    REDHAT said:
    In the first case, when BLE is initialized outside main(), the logs stop without any error.

    What makes you think it "crashes" then ?

    REDHAT said:
    In the second case, during the bonding process, after entering the BLE-generated passcode, the bonding completes on the application side but not on the controller side.

    What do you mean by "controller" side? Could you explain this some more?

Children
  • Hi,

    I am integrating this BLE code with other code, where the logs from the other code run in a separate task. However, I noticed that the logs have stopped printing.



    In the NRF Connect application, after entering the key, I see the "Delete bond information" option. At the same time, the controller stops printing logs, and I am unable to perform any other operations (such as button input).



  • Kindly provide any inputs...

  • Are you able to provide a stripped down example that reproduces this issue?

  • Hi,

    I have identified the issue causing the crash. The code crashes whenever I use UART0.

    Details:

    • By default, the UART is set to UART0, but I have changed it to UART2 to view logs.
    • Now, I am using UART0 for another peripheral.
    • If UART0 is not enabled, the code runs smoothly.
    • However, if UART0 is enabled for another peripheral, the code crashes during the bonding process.







    Kindly help me resolve this issue.

  • Hi kindly provide some inputs.