Microcontroller webserver - Post ID...

User 3091614 Photo


Registered User
4 posts

Hi,

I design control equipment and I have a very simple webserver based on an STM32H743 microcontroller.
The web pages are stored in flash memory and sent to the browser on demand.
There is limited memory and I have to ensure that the absolute minimum of data is stored as a web page.
I have never done any HTML/JS/CSS etc and I have been teaching myself for the last few weeks. Unfortunately, my project is late and my boss is getting impatient!
I have bought Coffeecup HTML editor (very useful) and site designer.
This may be a little out of way, but could anyone give me some tips on this?
Or are there specific tools out there to compress a website for transmission?
Thanks,
Chris
User 122279 Photo


Senior Advisor
14,465 posts

Hi,
Coffeecup does not have any special tools for compressing files on a server. But surely you can write something into a .htaccess file. I'm thinking of such things as

# BEGIN Compress text files
<ifModule mod_deflate.c>
<filesMatch "\.(css|js|x?html?|php)$">
SetOutputFilter DEFLATE
</filesMatch>
</ifModule>
# END Compress text files

and

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 3091614 Photo


Registered User
4 posts

Thanks Inger,
I dont really understand this. I am only just learning simple HTML.
The microcontroller has no O/S.
At the moment, the website is converted to hex code (before loading into the microcontroller flash memory) and sent to the browser from the microcontroller.
Is it possible to compress this hex code to a smaller size, load it into flash, and then send it to the browser?
Will the browser be able to decompress it?
Chris
User 122279 Photo


Senior Advisor
14,465 posts

Well, as I understand it, I don't understand much of your setup either. ;) And I'm sure that CoffeeCup doesn't have any tool for this. The company creates apps for creating websites, not for creating server software. You could try to ask the Support (Click on your name top right on this page), maybe they can give you some relevant reply.

Come back here if you have any problems with the HTML Editor or Site Designer, we can probably give you more help with those.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 3091614 Photo


Registered User
4 posts

Thanks anyway,
I realise that its not a coffeecup problem.
I just wondered whether anyone in the forum had a similar problem.
I like the coffeecup software though!!
Chris
User 3082604 Photo


Registered User
4 posts

Your microcontroller must have some kind of micro-os for it to be running a tcp/ip stack or am I missing something?
I guess your 'web server' is just a tcp server socket which dumps data back when something connects to it?
You are going to struggle to achieve that.
When I created an embedded OS many years ago (for atmels atmega128) I created a flash structure which allowed me to store individual files by name in eeprom.
You need to respond to the HTTP GET requests from the web client you receive over your socket.
The get requests ask for a file e.g. img1.jpg or index.html.
I then searched the eeprom for that file and dumped the contents back over the socket.
But you have to follow the basics of HTTP protocol.
Not difficult but far better if you do this.
User 3091614 Photo


Registered User
4 posts

Thanks, but I have already got a simple web page running.
I'm just trying to make it as useful as possible without too many bells and whistles.
I'm slowly getting to grips with the site designer, but I cant seem to find a **simple** tutorial which shows some examples of a page that does not consume too much memory. i.e. a guide on how to limit the actual HTML/js that has to be stored on the micro memory.
Chris

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.