Dangerous Prototypes

Other projects => Past projects => Web platform => Topic started by: Markus Gritsch on March 08, 2010, 09:13:15 pm

Title: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: Markus Gritsch on March 08, 2010, 09:13:15 pm
Hi,

has anyone managed to get the Microchip example website (WebPages2 folder) to work on the Web Platform?  In particular it seems that dynamic variable like ~inc:header.inc~ are not working.

EDIT: I mean in the SD card server.  They work fine in the EEPROM server.
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: Markus Gritsch on March 09, 2010, 05:29:48 pm
By stepping through HTTP2_MDD.c (which really is a mess of a state machine) I noticed, that the files 'DynRcrd.bin' and 'FileRcrd.bin', which are generated by MPFS2, have to be copied to the SD card too.

I did this, and now I get the attached screenshot.png.  Including ~inc:header.inc~ seems to work, but a lot of the other dynamic variables remain unsubstituted.

The LED in the browser is blinking, but when clicking a bit through the menu on the left side, the Web Platform locks up.  The LD1 on the board stops blinking and the debugger shows that it hangs in line 661 in SD-SPI.c:

                   while (!SPISTAT_RBF);

Maybe access to files on the SD is not very reliable?
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: ian on March 10, 2010, 04:16:54 pm
Sorry, I missed this notification.

If it freezes there I think it might be a PIC (or code) problem. Even if the SD card failed the PIC would just read garbage from SPI. For SPI to stall it might be configured incorrectly, poor code, or other bug.

Would you be interested in testing the uIP port? It compiles as of today, I'm going to start it under debug and see what it does.  Latest code is in trunkuIP_Pic33_port_k
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: Markus Gritsch on March 10, 2010, 04:53:05 pm
It compiled, but I cannot get it to work.  As I understand it, it currently does not use DHCP, so I changed the UIP_IPADDRx values in uipopt.h.  Visiting the address with a browser does not show any reply.  I would need more directions.
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: ian on March 10, 2010, 05:31:45 pm
It's not working for me yet either. I noticed several problems (updated in the current SVN):
1. The timeout interrupt didn't work (used polling dec instead)
2. The ENC28J60 routines polled the wrong SPI RX flag
3. ENC28J60 RESET and CS pins weren't properly configured at startup.

IT still doesn't work, but it's behaving better and I hope to get a ping soon.
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: wallabybob on April 06, 2010, 03:38:13 am
[quote author="Markus Gritsch"]
By stepping through HTTP2_MDD.c (which really is a mess of a state machine) I noticed, that the files 'DynRcrd.bin' and 'FileRcrd.bin', which are generated by MPFS2, have to be copied to the SD card too.
[/quote]

How do you get MPFS2 to generate DynRcrd.bin and FileRcrd.bin?

My attempts generated only one file: (default name) MPFSImg2.bin which I presume needs to be uploaded to the board. Supposedly this can be down through a web browser by adding /mpfsupload to the end of the url:, e.g. http://192.168.211.215/mpfsupload/ (http://192.168.211.215/mpfsupload/) but this only gets me a different variant of the home page.

Maybe I haven't found the appropriate documentation yet, but using the microchip software to make a web server seems unnecessarily complex.
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: wallabybob on April 06, 2010, 04:48:44 am
I tried the download (firmware.zip) in http://dangerousprototypes.com/forum/index.php/topic=324.30 (http://http://dangerousprototypes.com/forum/index.php/topic=324.30), connected to the home page, uploaded MPFSimg2.bin and the dynamic variables worked OK (the pages didn't display strings like ~inc:header.inc~.

I guess I have inadvertently selected an incompatible combination of build options trying to get the server to use just the SD card, not the EEPROM. I started with the Microchip TCPIP MDD SD Card Demo App
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: Markus Gritsch on April 06, 2010, 07:11:57 am
[quote author="wallabybob"]
How do you get MPFS2 to generate DynRcrd.bin and FileRcrd.bin?
[/quote]

In step 2. "Processing Options" of the MPFS2.exe utility you have to select the "MDD" radio button.
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: Markus Gritsch on April 06, 2010, 07:14:40 am
[quote author="wallabybob"]
I tried the download (firmware.zip) in http://dangerousprototypes.com/forum/index.php/topic=324.30 (http://http://dangerousprototypes.com/forum/index.php/topic=324.30), connected to the home page, uploaded MPFSimg2.bin and the dynamic variables worked OK (the pages didn't display strings like ~inc:header.inc~.
[/quote]

The firmware from the other thread uses the EEPROM server (MCstackDemo), which works fine.  This thread here describes problems with the SD card server (MCstack-SDcard-server).
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: wallabybob on April 07, 2010, 02:10:19 am
Markus: Thanks for the explanation about MPFS2.

I reinstalled the Microchip Libraries and updated the sources for TCPMDD SD Card Demo as described in the README.TXT file Google library BUT I retained the Microchip web page files which I copied to the SD card. I've reloaded the firmware and (powerup) restarted the web platform a number of times and I've only seen the dynamic page variables (e.g. ~version~) expanded the first time I ran the new build, though the ~inc:header.inc~ mostly seems to get processed. Typically the page text is truncated mid-word (e.g. page ends with "configu" rather than "configuration ..."

What do people use as an interactive debugger on the web platform?
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: Markus Gritsch on April 07, 2010, 07:16:28 am
I guess your webpage look similar to the attachmnent in

http://dangerousprototypes.com/forum/in ... 41#msg3241 (http://dangerousprototypes.com/forum/index.php?topic=373.msg3241#msg3241)

Ian recommended the PICkit 2, which I bought.  It is very low cost (about 25 €) and can do programming and rudimentary debugging (up to two simultaneous breakpoints, single stepping, varibale inspection).
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: wallabybob on April 07, 2010, 07:31:50 am
[quote author="Markus Gritsch"]
I guess your webpage look similar to the attachmnent in

http://dangerousprototypes.com/forum/in ... 41#msg3241 (http://dangerousprototypes.com/forum/index.php?topic=373.msg3241#msg3241)
[/quote]

Yes, but not as much is displayed.

About the PicKit2: need a special connector to link it to Web Platform? need special boot software or debug software in the web platform? (I've been using dsPIC30 to reflash the web platform.)
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: Markus Gritsch on April 07, 2010, 08:49:42 am
The PICkit 2 has a female pin connector and the Web Platform a male pin header, so theoretically they can be directly connected.  In practice I had do use a short selfmade parallel cable to reach the connector.

Once connected, select the PICkit 2 as the debugger in the MPLAB 'Debugger' menu.  (Make sure to select PICkit 2 support when installing MPLAB.)  MPLAB then tells you, that it has to rebuild the project for debugging.  Follow this, and off you go :)
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: Markus Gritsch on April 20, 2010, 10:18:31 am
Tony found out, that the problem described in this thread is related to MAX_HTTP_CONNECTIONS.  See this thread for more information: http://dangerousprototypes.com/forum/in ... opic=460.0 (http://dangerousprototypes.com/forum/index.php?topic=460.0)
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: dpropicweb on April 25, 2010, 04:47:02 pm
For a perhaps better solution, see my SD card server post: http://dangerousprototypes.com/forum/in ... opic=475.0 (http://dangerousprototypes.com/forum/index.php?topic=475.0).
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: Markus Gritsch on April 25, 2010, 07:32:29 pm
Unfortunately it seems to be broken in the same way as described in http://dangerousprototypes.com/forum/in ... 37#msg4037 (http://dangerousprototypes.com/forum/index.php?topic=460.msg4037#msg4037) because when I quickly click two times on a link in the navigation pane on the left side, I got the attached response from your server.
Title: Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working
Post by: dpropicweb on April 26, 2010, 10:00:24 am
I couldn't replicate the broken home page... checking my network setup, it seems my connections were going through my LAN web proxy. Once I removed the proxy, yes, the same broken home page would turn up with two successive clicks :( but at least it no longer locks up completely :). Back to the drawing board...

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01282120128session_write_close ( )...(null):0
20.01312251720ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01312252496Database_MySQL->query( ).../DatabaseHandler.php:119
40.05602391224Database_MySQL->error( ).../Db-mysql.class.php:273