Quality RTOS & Embedded Software

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


LWIP+FreeRTOS crashing

Posted by slam7211 on July 20, 2017

I am using an FRDM k64 Arduino, and developing a TCP/IP client on it. It works as follows. There is a circular queue that stores data. Periodically that queue gets data put in the queue from external sensors via an interrupt. During free time I check to see if there is data in the queue, if there is data, empty the queue and write the data to a server. To do this I use FreeRTOS plus the netconn API that comes with LWIP. I have 1 thread called TCPThread that creates a connection, and connects to my server. I then have an infinite while loop that checks the queue and runs netconnwrite if there is data (yes I handle looping back on the queue). After few hundred sucessful writes to the server (currently just a C# server on a PC that writes the data to a screen) my MCU crashes. I end up in the default ISR, which points to a bus fault.

If I lower the number of netconnwrite calls by increasing the minimum ammount of data in the queue before we bother to write to the server (for example need 100 bytes vs 1 byte to call netconnwrite) the ammount of time the MCU lasts between crashes goes up (havent checked exact number of calls, but my gut says it will be simmilar). Is there something I am missing here? It seems I am running out of memory and crashing, but because LWIP is an API I really don't have an easy way to malloc for it/shouldn't I not need to because all resources should be freed after a local function (netconn_write) is called?

LWIP+FreeRTOS crashing

Posted by rtel on July 20, 2017

Unfortunately we cannot support lwIP. Trying to support users on lwIP, which is moderately involved third party code, was what lead us to develop our own TCP/IP stack so we could better support TCP users.

Your system could be going wrong in any number of ways. In my experience, the biggest source of problems in lwIP applications is normally the driver, not the lwIP code at all.

You say "I end up in the default ISR, which points to a bus fault." If it is the default ISR, how are you determining that it is a bus fault?

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

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

Latest News

Meet Richard Barry and learn what's new in the FreeRTOS project at Embedded World 2019

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