cancel
Showing results for 
Search instead for 
Did you mean: 

Processor stuck if I run code without debugger

MauFanGilaMedical
Associate III

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.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@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 

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.

View solution in original post

3 REPLIES 3

@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 

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


@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

 

 

 

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.