Webserver over interface other than ETH + webserver problems

Technical questions regarding the XTC tools and programming with XMOS.
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Webserver over interface other than ETH + webserver problems

Post by DemoniacMilk »

Might sound weird, but I would like to access a webserver on an xmos device via any interface (SPI, I2C, ...).

Adjusting the xtcp stack to use another interface
My idea was to adust only two things:
  • the xtcp() function itsself handles event reactions (e.g. an ethernet packet being ready). I could simply replace the reaction to an ethernet event with a similar event for another interface
  • data is processed within the uip stack, no need to change anything here (?)
  • to send data, xcoredev_send() is used to send the uip-stacks buffer via ethernet. Again, I should be able to replace the ethernet interface with any other interface
Did i get that right? I basically have to adjust only xcoredev_send() and xtcp() to access the webserver over another interface, the rest of the stack and webserver do their work independently? When I tried this, debug prints showed that web packets were received by xtcp() and sent by xcoredev(), but I was not able to load the web page.

Webserver/XTCP problems
  • While testing the webserver over ethernet, i got the feeling it is a bit .. instable? or .. unreliable rather. I got my website split into multiple files (html, css, js). On trying to access the website, the html file is always loaded, but most of the time communication seems to hang when the css file is requested. Sometimes, the css is loaded fine. If I resend the css file request, the file is loaded just fine. Do I have to put everything into a single file (urgh) or does anyone have an idea on how to fix this?
    • On requsting the CSS file again, the index.hmtl file is resent
  • If the css file is loaded, it is not processed by the browser, as it is tagged as type/html instead of type/css (no problem when opening the local copy on the pc).
    • Probably related to the index.html being resent instead of the css file
  • Javascript is not executed, no matter if provided in an additional file or in the html file (both versions work when I open the local website on my pc).
Do you guys have any idea on how to fix the problems mentioned and if my apporach for adjusting the interface is reasonable and might work?
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Post by DemoniacMilk »

Update to index file being resent, instead of css file:
I redownloaded a fresh copy of the webserver library and this part got fixed. JS works as well. i dont remember changing anything other than adding debug prints (using xscope).

Update to website transfer being stuck after loading the html file:
From what I was able to observe, page load fails when the CSS file is requested before the html file finished loading. I am a bit lost here, cause I dont think I can do anything about the way files are loaded.

Loading webpages over another interface:
With help of prints I can confirm that the xtcp stack receives and sends packets. However, transfer is pretty low (like 5-6 packets / second on a 16 MHz interface) and communication halts after about 3 seconds.