[SOLVED] Jlink Monitor Mode + nRF52 SDK debug issues

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Jlink Monitor Mode + nRF52 SDK debug issues

    I am using the nRF5_SDK_14.0.0_3bcc1f7 and the ble_app_beacon example together with the Jlink Monitor mode for debugging.
    The issue is that under some circumstances the jlink monitor mode debugger is not working as expected.

    The working environment is Keil v5.25.2.0 and the project used for reproducing the issue is:


    In the attached example the only differences compared to the Nordics original beacon example are the following:

    1. Jlink monitor mode code added
    2. Use MicroLIB is not selected
    3. the sd_ble_version_get code is added to show the issue
    4. getSDversion function added

    The code changes are the following:

    Brainfuck Source Code

    1. //==============================================================================
    2. uint32_t getSDversion(void)
    3. {
    4. uint32_t SDver = 0xFFFFFFFF;
    5. uint32_t ret;
    6. ble_version_t p_version = {0};
    7. ret = sd_ble_version_get(&p_version);
    8. if (ret == NRF_SUCCESS)
    9. {
    10. SDver = p_version.version_number * 1000000 + p_version.subversion_number;
    11. }
    12. return SDver;
    13. }
    14. //==============================================================================
    15. int main(void)
    16. {
    17. //------------------------------
    18. NVIC_SetPriority(DebugMonitor_IRQn, _PRIO_SD_LOW);
    19. //------------------------------
    20. // Initialize.
    21. log_init();
    22. timers_init();
    23. leds_init();
    24. ble_stack_init();
    25. //------------------------------
    26. NRF_LOG_INFO("testing.\r\n");
    27. while(1)
    28. {
    29. uint32_t SDversion = getSDversion();
    30. NRF_LOG_INFO("SD version: %d", SDversion);
    31. NRF_LOG_PROCESS();
    32. }
    33. //------------------------------
    34. advertising_init();
    35. advertising_start();
    36. // Start execution.
    37. NRF_LOG_INFO("Beacon example started.");
    38. // Enter main loop.
    39. for (;; )
    40. {
    41. if (NRF_LOG_PROCESS() == false)
    42. {
    43. power_manage();
    44. }
    45. }
    46. }
    47. //==============================================================================
    Display All
    Running the code without any breakpoint or with a breakpoint at line 9 "if (ret == NRF_SUCCESS)",

    the expected RTT prints are correct:

    <info> app: testing.

    <info> app: SD version: 9000157
    <info> app: SD version: 9000157
    <info> app: SD version: 9000157
    <info> app: SD version: 9000157

    Running the code with a breakpoint at line 8 "ret = sd_ble_version_get(&p_version);"
    gives wrong RTT prints :

    <info> app: testing.

    <info> app: SD version: 0
    <info> app: SD version: 0
    <info> app: SD version: 0

    If I will make only one of the following changes, then the debugging is working as
    expected and the RTT prints are also correct:

    1. disable the jlink monitor mode by changing in the JLinkSettings.ini the following line
    MonModeDebug = 0

    2. make the getSDversion -> ble_version_t p_version local variable static
    static ble_version_t p_version = {0};

    3. changing the Option for Target->Target->Use MicroLIB to ON
    (In another project this will not make any change)

    These error seems to be related with the SD calls of the nordic SDK and the Jlink monitor mode.

    Is this an issue of incompatibility of jlink monitor mode with the nRF52 SDK?
    Any ideas how to solve this issue?

  • Hello,

    Thank you for your inquiry.
    The reported issue does not seem to be related to monitor mode or J-Link behaving wrong but the application setup not being correct.
    We suggest contacting Nordic as the SDK is maintained and supported by them.

    Best regards,
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.