Fatal Error after sending notification

Hey Guys,
currently, I am working on my masterthesis. I have to develop an mobile application which comminicates with the nordic board via BLE. I know that there is an existing application from nordic but I had to implement some extra features. The example I use is the ble_peripheral_uart example. According to measure my traffic I am using Docklight. 

My issue is that always when I try to send a notification with docklight to my application (Notification is enabled) my embedded studio crashes and I get a fatal error. Writing messages from the app to the board is possible. I can see this on docklight. 

The confusing point is that when I started to write messages and send notifications it worked. But one day I tried it again and this error appeared, which is really annoying because I haven´t changed a single line of C-Code from the example. I tried to run a new version from the code, I tried to use different versions from my android studios code, I ran the code on several computers I changed the eval board, I changed the UART-Module I am using, I reinstalled the software - nothing worked.

I noticed that it is possible to send notification as long as I send only one letter or number. When I send more letters or numbers or add \n my code crashes. Obviously, it is a memory issue but I don´t understand why it worked at the beginning. 

Can you give my some advices?

Kind Regards,
Thomas

  • To be honest these are the only two error code lines that appeared after debugging. 
    Here is the function where the error code has guided me to:

    void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name)
    {
        __ASM volatile(
    
        "push {lr}                      \n"
    
        /* reserve space on stack for error_info_t struct - preserve 8byte stack aligment */
        "sub sp, sp, %0                 \n"
    
        /* prepare error_info_t struct */
        "str r0, [sp, %1]               \n"
        "str r1, [sp, %3]               \n"
        "str r2, [sp, %2]               \n"
    
        /* prepare arguments and call function: app_error_fault_handler */
        "ldr r0, =%4                    \n"
        "mov r1, lr                     \n"
        "mov r2, sp                     \n"
        "bl  %5                         \n"
    
        /* release stack */
        "add sp, sp, %0                 \n"
    
        "pop {pc}                       \n"
        ".ltorg                         \n"
    
        : /* Outputs */
        : /* Inputs */
        "I" (APP_ERROR_ERROR_INFO_SIZE_ALIGNED_8BYTE),
        "I" (APP_ERROR_ERROR_INFO_OFFSET_ERR_CODE),
        "I" (APP_ERROR_ERROR_INFO_OFFSET_P_FILE_NAME),
        "I" (APP_ERROR_ERROR_INFO_OFFSET_LINE_NUM),
        "X" (NRF_FAULT_ID_SDK_ERROR),
        "X" (app_error_fault_handler)
        : /* Clobbers */
        "r0", "r1", "r2"
        );
    }


    Here is the copied log:
    Reset: Halt core after reset via DEMCR.VC_CORERESET.
    Reset: Reset device via AIRCR.SYSRESETREQ.
    Downloading ‘s132_nrf52_7.2.0_softdevice.hex’ to J-Link
    Programming 2.7 KB of addresses 00000000 — 00000aff
    Programming 146.3 KB of addresses 00001000 — 0002596b
    J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (126976 bytes)
    J-Link: Flash download: Total: 3.005s (Prepare: 0.490s, Compare: 0.042s, Erase: 0.071s, Program & Verify: 2.266s, Restore: 0.135s)
    J-Link: Flash download: Program & Verify speed: 55 KB/s
    Download successful
    Downloading ‘ble_app_uart_pca10040_s132.elf’ to J-Link
    Programming 59.7 KB of addresses 00026000 — 00034f16
    Programming 0.1 KB of addresses 00034f18 — 00034fbb
    J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match
    Download successful
    

  • Hi,

    This is not the relevant log. This is from programming the device, and what we are after is the log from the device, which where there are printouts from the error handler. And the code in your snippet is from the error handler, and that runs because of the error. The relevant log is from your previous screenshot, specifically in the left par of it, where you see the debug log printed by your application running in the nRF. This log contains all information we need to start looking into this, when combined with the file it points to (probably your main.c, but could also be something else).

    I strongly suggest that you spend time understanding the error handling in the nrF5 SDK by the link in my previous post. This will surly save you time in the long run.

  • <info> app_timer: RTC: initialized.
    <info> app: Debug logging for UART over RTT started.
    <info> app: Connected
    <info> app: Data len is set to 0xF4(244)
    <error> app: ERROR 4 [NRF_ERROR_NO_MEM] at C:\Users\loratho\Desktop\Projektordner_Thomas_Loran\Masterthesis\BLEtoUART\Nordic\nRF5_SDK_BLEtoUART\examples\ble_peripheral\ble_app_uart\main.c:581
    PC at: 0x0002F8E3
    <error> app: End of error report
    
    
    
    
    Thank you for the Link. I am read it and try to understand it. Here is the left part of the screen, you metioned

  • Good. Did you also check what happens around line 581 in your main.c file?

Related