Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


UDP-Stack crashes when J-Link not attached

Posted by The Dude on August 22, 2013

I have ported the FreeRTOS UDP-Stack to LPC1769 and I am running the Standard socket implementation (no Zero Copy).
Everything works perfect as long as I have my J-Link SWV Debugger attached and I run a Debug session with gdb.
I am not using any ITM-Channel.
Once I let the program run without the Debugger, it crashes after about 2.4 seconds. (The HardFault-Handler is being called. I know this by letting a LED light up, when this happens) I think this should be about the time, where the DHCP-Request is made.

The problem now is to debug this without a debugger:)

Has anybody experienced something like this?

My next move will be to try to get the program counter value of the crash within the hardfault out of the MCU without using the debugger.

Any help or suggestions would be very appreciated.

Best Regards,

RE: UDP-Stack crashes when J-Link not attached

Posted by Richard on August 22, 2013
Depending on your tools, you may be able to connect the debugger after the crash without the board resetting or being re-flashed. If you are able to do that you will be able to follow the instructions here to work out the program counter position.

Do you have configASSERT() defined? If not I would recommend defining it because it may allow you to trap the problem *before* the hard fault.

Assuming you are running the same code, I can't think off hand what difference having the debugger connected would make. Is it possible the code is built with semi-hosting libraries? If so, it would be worth turning semi-hosting off completely.


RE: UDP-Stack crashes when J-Link not attached

Posted by The Dude on August 22, 2013
Dear Mr. Barry,

thank you for the quick response. I am using Atollic True Studio and I have turned of resetting and res-flashing, but the debugger hangs then and I am not able to read any core registers.
I am not using any semi-hosting libraries - just the Newlib standard library. (But I don't use any printf or any other instruction, that would send stuff to the debugger)
I use the configASSERT() with the forever loop which is provided in FreeRTOSConfig.h + LED-Output, but the LED stays off.
I have used tcpdump to see, if the DHCP-Request is sent out, before the crash and it is. The DHCP-Server responds and this might be the point, where it crashes.
I will try to dig deeper.

Best Regards,

RE: UDP-Stack crashes when J-Link not attached

Posted by The Dude on August 22, 2013
P.S. It may be interesting to mention, that when I boot the device with the debugger and then just unplug it after a view seconds without stopping the debugging-process everything works fine. So the crash has to have something to do with the initialization process.

RE: UDP-Stack crashes when J-Link not attached

Posted by MEdwards on August 23, 2013
Does the atollic debugger run any scripts when it connects to or downloads to the target? like the IAR debugger does. Maybe it is doing some configuration in a debug script rather than in the source files.

RE: UDP-Stack crashes when J-Link not attached

Posted by The Dude on August 23, 2013
Thanks for the suggestion edwards3,

you are right. There is a script for the debugger. I have played around with it and reduced its functionality to a minimum, but the result is still the same. When I don't initialize the network, the program runs just fine.
I will take a closer look at the network drivers on the weekend and I will try to program some debugging interface on the serial port to get a little bit more information out of the microcontroller.

Best Regards,

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner