Skip to main content
Topic: Dynamic Variables (~inc:header.inc~) in SD Card Server not working (Read 10234 times) previous topic - next topic

Dynamic Variables (~inc:header.inc~) in SD Card Server not working

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.

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #1
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?

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #2
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
Got a question? Please ask in the forum for the fastest answers.

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #3
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.

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #4
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.
Got a question? Please ask in the forum for the fastest answers.

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #5
[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/ 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.

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #6
I tried the download (firmware.zip) in 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

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #7
[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.

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #8
[quote author="wallabybob"]
I tried the download (firmware.zip) in 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).

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #9
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?

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #10
I guess your webpage look similar to the attachmnent in

http://dangerousprototypes.com/forum/in ... 41#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).

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #11
[quote author="Markus Gritsch"]
I guess your webpage look similar to the attachmnent in

http://dangerousprototypes.com/forum/in ... 41#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.)

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #12
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 :)

Re: Dynamic Variables (~inc:header.inc~) in SD Card Server not working

Reply #13
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