Skip to main content
MauFanGilaMedical
Associate III
Question

Processor stuck if I run code without debugger

Hello.

I have developed an application with touchgfx, lwip, freertos.

I had some problems with lwip (see processor goes to HardFault at __ISB - STMicroelectronics Community, HardFault_Handler when enable LWIP and touchgfx - STMicroelectronics Community).

I understand some causes of HardFault and this morning code seems to work properly.

 

I tried to run the code without debugger but my processor stuck in some point that I can't see because I have no debugger connected.

 

I reconnect debugger, reflash and rerun. After this operations I obtain the problem described in processor goes to HardFault at __ISB - STMicroelectronics Community

 

Why processor run with debugger but it stucks without it ?

 

Thankyou in advance.

 

 

    This topic has been closed for replies.

    5 replies

    Andrew Neil
    Super User

    @MauFanGilaMedical wrote:

    I tried to run the code without debugger but my processor stuck in some point that I can't see because I have no debugger connected.


    Add instrumentation so that you can see where it's hanging; eg,

    • UART output;
    • LEDs; 
    • Pins observable on scope/logic analyser;
    • etc, ...

    LwIP debug output: https://community.st.com/t5/stm32-mcus/using-the-itm-console-for-printf-redirects-and-lwip-debug/ta-p/723472 

     


    @MauFanGilaMedical wrote:

    Why processor run with debugger but it stucks without it ?


    Suggests a timing issue:

    • Debugger adds some start-up delays - so code works;
    • Without debugger, no delays, so something(s) is/are not ready - so doesn't work.

    See: https://community.st.com/t5/stm32-mcus-embedded-software/basic-udp-echo-server-works-in-debug-but-not-run-mode-nucleo/m-p/787083/highlight/true#M61552 

     

    #Instrumentation #CodeInstrumentation #DebugVisibility

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    MauFanGilaMedical
    Associate III

    yes, you are right... I'm doing now..thankyou

    Andrew Neil
    Super User

    @MauFanGilaMedical wrote:

    I tried to run the code without debugger but my processor stuck in some point that I can't see because I have no debugger connected.


    Note that you can attach the debugger to an already-running system - so you can see where it is "stuck":

    Disable the Reset:

    AndrewNeil_1-1747229331738.png

    Disable the download:

    AndrewNeil_2-1747229387268.png

    and you don't want it doing a build:

    AndrewNeil_3-1747229428452.png

     

     

    #ConnectToRunningTarget #ConnectToCrashedTarget #ConnectToHungTarget

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Andrew Neil
    Super User

    @MauFanGilaMedical  - I think you're a bit premature in marking my post as the solution: that post just contains some suggestions for how  to debug the issue - it's not actually a solution to the problem.

    See this for how to un-mark a solution.

     

    Take a look at the two posts by @Guillaume K in this thread:

    https://community.st.com/t5/stm32-mcus-embedded-software/stm32f767-lwip-tcp-client/m-p/778561

    do they address your issue?

    In particular, are you getting the mentioned ERR_RTE error?

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    MauFanGilaMedical
    Associate III

    No, I don't have RTE error, I commented SCB_InvalidateDCache_by_Addr because it is exceuted even if I have disabled DCache.

     

    Now it works