Skip to main content
KAnahar
Associate III
May 26, 2022
Question

How can i use sd card with httpd server? (LWIP/FATFS/ETHERNET/HTTPD/SDCARD)

  • May 26, 2022
  • 2 replies
  • 2153 views

I need to use SD Card in my project because of my mcu has not enough memory space. I need 200MB free space so i want to use SD Card. My html,css, js files are big size. When I convert my html,css,js files to C file (fsdata.c), that file be more than 150-200MB. My MCU memory just 1MB. How can i do it? I looked FATFS-LWIP application in st code but it didnt help to me. It is basic example (i can not do anything with html,css,js file in this example). Please if you have any idea or advice, help to me :)

This topic has been closed for replies.

2 replies

Andrew Neil
Super User
May 26, 2022

Surely, an HTTPD server neither knows nor cares where its data comes from;

Similarly, reading from an SD card doesn't depend on where the data is going to be used.

How far have you got with this project so far?

Are you able to just serve a fixed, static web page - without any SD card?

Are you able to just read an SD card - without any networking or webserver?

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.
KAnahar
KAnaharAuthor
Associate III
May 26, 2022

I can build httpd server project without SD Card. It is working now. But i need good graphic design so i need to use more space.

Also I can read data basically in sd card. But how can i do it for html css js i dont know.

Andrew Neil
Super User
May 26, 2022

HTML, CSS, and JS are just (text) files as far as the SD Card is concerned - you read them exactly the same as any other (text) file.

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.
KAnahar
KAnaharAuthor
Associate III
May 26, 2022

If I can read the fsdata.c file (which converted html, css, js files) on the sd card, the problem will be solved. But the content of the C file consists of binary codes.