2012-09-26 05:37 AM
Hello all,
I am doing a project where the microcontroller (STM32) is sending the parameters to the server via DHCP using wifi module. So, now i want to make available an offline web page to the user where he will put the SSID and phrase of the DHCP. This web page will be stored in the microcontroller and when the user connects the device to the PC using USB, folder containing this webpage should appear on the screen. Can anybody help me out on how do i do this? Thank you. #learn-to-walk-before-running #dhcp #drowning #drowning #http #html2012-09-26 06:37 AM
Probably easiest concept would be that you store the html binary file into flash (using arm-none-eabi-objcopy) and then just transfer it through wifi to user. I do not know what wifi module makes (probably some tcp/ip stack) but you might have to pay attention to headers and wrappers.
2012-09-26 07:23 AM
How to store web pages in microcontroller flash
The same way you'd store any kind of data. The memory is byte addressable like all other memory in the system. The writing requires blank/erased pages, and to communicate with the flash controller. You should review the Programming Manual PM00xx for whichever specific STM32 part you're using, and you should review the example code in the firmware libraries. To get a PC to read it, you'll perhaps need to look at the MSC USB examples, and use FatFs, or perhaps CDFS, to create a faux file system image for the PC to navigate and find files. For static file data, you could always make a file system image during your application build process, and perhaps form data structures and generate .C or .H files to be pulled in by the compiler. If you understand your tool chain or linker, you could perhaps pull binary file images in directly.2012-09-26 10:50 AM
''i want to make available an offline web page to the user''
So you need a Web Server in your device; or, more precisely, and HTTP server. Here is an excellent tutorial on HTTP:http://www.jmarshall.com/easy/http/
''store the html binary file into flash'' Note that HTML is just plain text - so you can store simple web pages just as 'C' strings; eg,char web_page[] =
''<html>'' ''<head>'' ''<title>Simple web page</title>'' ''</head>'' ''<body>'' ''<p>Hello, HTML Web World!</p>'' ''</body>'' ''</html>'';2012-09-27 04:27 AM
I would like to clear the application once again because there is a little change in the implementation.I want to Access offline web pages in the SD card connected to micro controller(stm32f100) from PC using USB.
Thanks for the reply2012-09-27 06:48 AM
So you want the USB to act like an Ethernet/Webserver, or Mass Storage/File System?
On an SDCard you could just build the web content as you would on a Flash drive, or CD, in the same way people put HTML content of a Evaluation Board CD, or VL-Discovery. Is this a commercial project?2012-09-27 06:51 AM
That one is even simpler. I do not know how will you connect through usb with browser but when you send some command (can also be HTTP with file request embedded) uC will just need to check filenames on SD card and pick the right one and then send it back through USB (you can say it will copy it). Since I think you tend to make multiple web pages then you might want to just send them through byte by byte without saving anything in flash or memory at all.
2012-09-27 12:42 PM
''On an SDCard you could just build the web content as you would on a Flash drive, or CD, in the same way people put HTML content of a Evaluation Board CD''
But that only works for static pages; no use for the user to input data to thesystem - which was the OP's original requirement...
2012-09-27 01:24 PM
But that only works for static pages; no use for the user to input data to the system - which was the OP's original requirement...
I was addressing the ''how do I store'' aspect of this rather contorted question. On further examination, a webserver might be the approach, capable of HTTP GET/PUT, but the whole attach to a PC, offline content, and remember parameters situation muddies the water further. The OP needs to better define and understand the problem, come up with a clear/workable plan of attack, and staff the project with people capable of executing the plan.2012-09-29 03:40 AM
''the whole attach to a PC, offline content, and remember parameters situation muddies the water''
Indeed.''The OP needs to better define and understand the problem, come up with a clear/workable plan of attack...''
Absolutely.''...and staff the project with people capable of executing the plan'' Or, at the very least, include a significant training stage at the start of the project!