This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DFU and Fatal Error can not re-start system

Hi,

I'm using SDK17.02 on nRF52810, when my application have an error, it will log "fatal error" but never reset system. BTW, I'm not debugging and just watching the RTT VIWER with j-Link.

I will re-power after download also.

But when I shield NRF_BREAKPOINT_COND, my system will reset successfully.

Also, when my device working with DFU successfully, the system will not reset unless re-power.

  • Hello,

    Try defining "DEBUG" in your preprocessor definitions, and then keep monitoring the RTT viewer. If you are not sure how to do that, please let me know what compiler/IDE you are using. 

    But when I shield NRF_BREAKPOINT_COND, my system will reset successfully.

    What do you mean by shielding NRF_BREAKPOINT_COND?

    What does the log say when you add "DEBUG" to your preprocessor definitions? It will probably point to some location in your code where you will find an APP_ERROR_CHECK(err_code). What is the err_code, and what function returned it?

    Best regards,

    Edvin

  • I need to do like this the system would be reseted when occured an error.

    I do not care what's the err_code, because I made an error on purpose just like initialize uart twice.

    Shouldn't it be restarting when the system fails? So does DFU.

  • Hello,

    The NRF_BREAKPOINT_COND is a macro basically acting as a breakpoint when you are debugging. As long as you are not in a debug session, this should not trigger.

    If you test this without a bootloader, one way to verify this is to use e.g. the ble_app_hrs example, (I chose this because it prints the log on UART). If you run this application with an added:

    APP_ERROR_CHECK(1); in the end of your main() function, right before the main-loop:

    /**@brief Function for application main entry.
     */
    int main(void)
    {
        bool erase_bonds;
    
        // Initialize.
        log_init();
        timers_init();
        buttons_leds_init(&erase_bonds);
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        advertising_init();
        services_init();
        sensor_simulator_init();
        conn_params_init();
        peer_manager_init();
    
        // Start execution.
        NRF_LOG_INFO("Heart Rate Sensor example started.");
        application_timers_start();
        advertising_start(erase_bonds);
    	
    		APP_ERROR_CHECK(1);
    
        // Enter main loop.
        for (;;)
        {
            idle_state_handle();
        }
    }

    You should see that the log says "Fatal error", and then "System reset" over and over.

    If you enter a debug session, you should see that it stops on the NRF_BREAKPOINT_COND, and you can e.g. resume the application by pressing the resume button. In this case, it will reset in the NVIC_SystemReset();, and run into the same APP_ERROR_CHECK(1); again. If you exit the debug session in Keil (maybe it requires a manual reset, I don't remember), then you should see that it will automatically reset after the "Fatal error" again.

    Best regards,

    Edvin

  • You should see that the log says "Fatal error", and then "System reset" over and over.

    Yes, that's my problem. I'm not in debugging session, and just watching RTT Viewer. And my system will stop at "Fatal error" but never showing "System reset". I can upload my project if you need.

  • Ah, sorry that I didn't catch that before. When I tested, I was using the UART log backend, and not the RTT, which was why I wasn't seeing the same behavior. 

    When you connect the RTT viewer, it counts as a debug session, because RTT is communicating with the nRF through the debugger. If you use UART as log backend, it will not stop. Otherwise, it will stop on a breakpoint as long as you are using the debugger (unless you comment out the BREAKPOINT_COND).

    Best regards,

    Edvin

Related