Commands from phone App are going to the wrong UART in the BLE device - serial UART instead of the radio BLE UART. Debug flies off the stack.

Commands sent by phone App to BLE UART end up in serial UART stream.
Debug with breakpoint in the uart_event_handle shows NO stack entries, as though it popped out of Main, and ends up in app_error_weak.c, line 100: NRF_BREAKPOINT_COND.

UART printf statements cease to function after reaching the main loop. Only the raw App commands come through to the terminal after that.

I found this related case, which doesn't help me resolve the problem any:
Case ID: 213686 When I enter break points inside ble_evt_handler(), it always ends up at NRF_BREAKPOINT_COND -- KEITH

IDE is Keil/uVision MDK-Lite 5.36 on Windows. Target is nRF5805. Debug is barely usable. Opt Lev 0 won't compile.

  • Hi,

    Commands sent by phone App to BLE UART end up in serial UART stream.

    And you're not printing the received commands from the phone app to UART? I'm not entirely sure I understand what is happening. Could you elaborate a bit more on this?

    Debug with breakpoint in the uart_event_handle shows NO stack entries, as though it popped out of Main, and ends up in app_error_weak.c, line 100: NRF_BREAKPOINT_COND.

    Halting the CPU and then resuming it will always throw an error if you're using the Softdeivce. You would need to restart the entire application between each time it's paused. See this and this

    regards

    Jared 

  • Yes, I am printing received commands in the uart handler, with annotation. But I am getting direct unannotated echoes of the commands sent by the App, and the uart handler is not doing it.

  • Hi,

    Could you provide a minimal example that would reproduce this behavior on a development kit? You can upload your project as a zip. Also, please specify what SDK and Softdevice version that you're using. 

    regards

    Jared 

  • Jared,

    I think I could really use a clear explanation of the use of setting 'the PRIMASK bit' for debugging when using BLE and the SDK. Rather than spend a lot of time reducing the design to minimum to upload, I would rather grok the best debug methods. I'm having trouble finding any documentation on that bit, and reading an ad hoc Q/A thread is not explaining things very well...

    Is there a more concise and clearly written document for setting and using the PRIMASK bit for debug?

    Is nrf_nvic the right module to look into?

    Does Keil/uVision have the ability to set up macros for setting and clearing the priority mask for the nTeenth time?

    Steve

  • Hi,

    The threads that I provided in my previous reply was meant to explain why a Softdevice application asserts after the CPU is halted. I didn't mean to suggest you to disable interrupts by writing to the PRIMASK register. To be honest, I haven't really tested this method, so I'm not sure how efficient debug method it is. I usually just move the breakpoint and restart the application after the halting the CPU. Either way, you can write to the PRIMASK register by starting a debug session in µVision and write to the register that is located under System in the register tab in debug view. See the left side of the screenshot. 

    regards

    Jared 

Related