SDCARD_WEBSERVER

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SDCARD_WEBSERVER

599 Views
gokhangunay
Contributor III

Hi all I prepared a basic and easy to use SD card based web-server application where you can put all your web-page on the SD card. Web-page's size is limited with the SD card size and using the application, you can play music, video, etc. on your web-browser. The SD card is formatted to FAT and you can put all relevant web files using your computer. It was prepared for FRDM64 board, but can be easily migrated to other boards/MCUs. 

Maybe, similar projects were previously posted, but this would still be the first time for those not having noticed them :smileyhappy:

I thought, it may be useful some people and decided to post it here. Enjoy!

You can find the details here.

GitHub - gokhangg/SDCARD_WebServer 

G.G.

0 Kudos
1 Reply

446 Views
mjbcswitzerland
Specialist V

Hi

Please compare with the attached binary for the FRDM-K64F.

This is a bit larger than your binary but has in addition Telnet and FTP server, plus USB-MSD to the SD card. FTP and USB-MSD make it easier to work with the SD card since you can change web content either from an FTP client (like FileZilla) or via USB where the SD card appears as an external drive to the PC (no need to remove the card)

To use it:
1. Connect to the UART (VCOM) at 115'200 Baud and hit the enter key. Go to the LAN menu (1) and set up the IP and MAC address (default is 192.168.0.3 with MAC 00-00-00-00-00-00). The MAC address can be set with:
"MAC 00-00-00-00-00-07" (for example) since not all networks like the zero MAC address. This is an invisible command that will only be accepted once (without erasing Flash again)

2. Load your web content to a directory in the root called "web" and the start file is "index.htm" (note not ".html")

3. You can then telnet to it, FTP to it (the SD card) and use the web server.


There are various other functions in the menu (the menu is on the UART and also Telnet). Notice also the utFAT disk interface menu (8) which allows  DOS like interface to teh SD card and advanced functions like "undelete" and file analysis of directory, file and deleted files. For example - the video:

infof aFistfulofDollarsTheDanishNationalSymphonyOrchestra.mp4
File: aFistfulofDollarsTheDanishNationalSymphonyOrchestra.mp4 is LFN
Starting at entry 0x02 in sector 0x00e881a7 (cluster 0x001d002f)
First object from 5
Data = 0x45 0x6d 0x00 0x70 0x00 0x34 0x00 0x00 0x00 0xff 0xff 0x0f 0x00 0x3b 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x00 0x00 0xff 0xff 0xff 0xff
Data = 0x04 0x6f 0x00 0x6e 0x00 0x79 0x00 0x4f 0x00 0x72 0x00 0x0f 0x00 0x3b 0x63 0x00 0x68 0x00 0x65 0x00 0x73 0x00 0x74 0x00 0x72 0x00 0x00 0x00 0x61 0x00 0x2e 0x00
Data = 0x03 0x4e 0x00 0x61 0x00 0x74 0x00 0x69 0x00 0x6f 0x00 0x0f 0x00 0x3b 0x6e 0x00 0x61 0x00 0x6c 0x00 0x53 0x00 0x79 0x00 0x6d 0x00 0x00 0x00 0x70 0x00 0x68 0x00
Data = 0x02 0x6c 0x00 0x61 0x00 0x72 0x00 0x73 0x00 0x54 0x00 0x0f 0x00 0x3b 0x68 0x00 0x65 0x00 0x44 0x00 0x61 0x00 0x6e 0x00 0x69 0x00 0x00 0x00 0x73 0x00 0x68 0x00
Data = 0x01 0x61 0x00 0x46 0x00 0x69 0x00 0x73 0x00 0x74 0x00 0x0f 0x00 0x3b 0x66 0x00 0x75 0x00 0x6c 0x00 0x6f 0x00 0x66 0x00 0x44 0x00 0x00 0x00 0x6f 0x00 0x6c 0x00
SFN File located at entry 0x07 in sector 0x00e881a7 (cluster 0x001d002f)
Data = 0x20 0x00 0x18 0x11 0x1e 0x0c 0x1f 0x13 0x2f 0x00 0x00 0x20 0x00 0x89 0xbb 0x06 0x7b 0x4d 0x7b 0x4d 0x1d 0x00 0xa6 0x06 0x7b 0x4d 0x30 0x00 0x23 0xee 0x7e 0x00
SFN name (archive) =  ......./.. Alias CS = 0x3b
File length = 8318499 starting in sector 0x00e881af (cluster 0x001d0030) FAT sector 0x0000440f offset 0x30
D:\videos>

If the SD card is removed it falls back to an internal (Flash) file system - a set of files can also be loaded via FTP when the SD card is removed. There is a reference set showing dynamic HTTP content generation, controlling GPIO and such (and post) at http://www.utasker.com/kinetis/FRDM-K64F.html

I can also use the TCP/IP services via USB RNDIS but I didn't enable this in the attached binary because its installation is not automatic. If of interest it is however described here: http://www.utasker.com/docs/uTasker/uTaskerRNDIS.pdf

utFAT is described at http://www.utasker.com/docs/uTasker/uTasker_utFAT.PDF (including how it interacts with HTTP and FTP).

The project is also available on Github (search for "uTasker") and has the unique feature that it can be completely tested (in real-time) on a simulated FRDM-K64F board in visual studio. It also builds for any K50, or K60 processor (K61, K64, K65, K66) in KDS, MCUXpresso. IAR, Keil, Green Hills, Atollic, Rowley Crossworks, CooCox S32, CW or with GCC make.

The http server is a very low RAM method which allows several hundred HTTP sessions in parallel on the K64 but still serves each at high speed. I configured this binary to allow up to 40 parallel connections.

It would be interesting to see a final comparison if you can add the telnet and FTP services to your project and do additional code size checks/RAM resources requirements.

Regards

Mark

0 Kudos