Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


webserver slow after flash write

Posted by Pierre on June 17, 2013

I use FreeRTOS and lwIP for a webserver on STM32F217. The web page is used to change settings that are stored in flash (on the last page which is free).
The problem is that after the update to flash the webserver is very slow.
The erase time the page is very long (depending datasheets can go up to several seconds).
For now the update of the flash is a sub-function of the Webserver task.

I see this alternative:
Save the page in RAM (RAM backup area eg.) And create a separate save RAM to flash task.

Is there are others?
Thank you. Pierre

RE: webserver slow after flash write

Posted by Richard on June 17, 2013
Do you mean the web server is very slow while the flash is being written to?

I'm afraid I don't have any experience of writing to flash while executing a program on that or other part. The only way I have done it before is to run code from RAM while the flash is being programmed, but normally you can only fit a small amount of code in RAM, just the function that does the actual re-programming. Other than suggesting you have the flash writing performed in a task other than the lwIP task I'm not sure what to suggest (the write can be initiated by the lwIP task, but performed by another task).


RE: webserver slow after flash write

Posted by Jerry Durand on June 17, 2013
I'm starting to use microSD cards embedded instead of regular flash chips. They have built-in wear leveling and as long as you don't do a bulk erase they're decently fast at saving.

With any flash or EEPROM type device, they're fastest if you can do multiple block writes. You have to keep things aligned to the pages or sectors in the part but you fill the device's buffer and then it writes it all at once.

I found a nice holder for micro SD that's intended for this application (insert memory when you assemble the PC board and then forget it). ALPS #SCHD3A0100 , Mouser.com has them.

I also found out an old Kingston brand card I have has a bad CRC in one of their tables...always a surprise someplace.

RE: webserver slow after flash write

Posted by Pierre on June 17, 2013
Dear Richard,

“Do you mean the web server is very slow while the flash is being written to?”

Not only, after writing in flash all the lwip stack becomes slow. One ping takes hundred of ms instead one ms.

It seems the systick for FreeRTOS follow to run while the flash writing.

About the SD card, you are right, I use it for another project with success but here there are econnomic constraints and it is just for a fifteen of bytes. And probably one rewrite by card in its live.

RE: webserver slow after flash write

Posted by Jerry Durand on June 17, 2013
For 15 bytes I'd use one of the very small EEPROMS, 1 k Bit ones go for $0.20 in single piece (US dollars).

If it's going to be erased only a few times, just dedicate a segment of your processor Flash memory and sequentially write updates (no need to actually erase anything, only add a new record like a multi-session CD).

RE: webserver slow after flash write

Posted by Pierre on June 18, 2013
Finally the problem is in the driver ethernetif.c.
I tried the correction in this post:


Now the tcp/ip recover after a big delay for erase/write flash and even after a breakpoint stop.
Thank you.

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists