uIP Webserver simple example

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

uIP Webserver simple example

3,965件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Fri Mar 04 14:39:05 MST 2011
Hello,

I have zero experience working with Internet in embedded environments, and would like to know the easiest way modify the sample "RDB1768cmsis_uIP" to read and write GPIO.

I know change a static page, but not while the example works.

Thanks.
0 件の賞賛
返信
21 返答(返信)

3,334件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jorgeschram on Sat Jan 12 16:24:13 MST 2013
Hi, i´m traing to modify this example, but i have a question, if i modify an html file i´m must run this on linux to see this modification??
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Fri Dec 07 16:31:10 MST 2012
Possibly missing initialize port as output, see post #4:
http://knowledgebase.nxp.com/showpost.php?p=7502&postcount=4
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NeoFireRaziel on Wed Dec 05 22:34:00 MST 2012
Sorry but I follow all the instructions in this thread about to get work the port toggle function in the original uIP example project but I can't get it to work.

I replace the file with the files in "uip-mod.zip" and run makefsdata in the webserver directory, compile with no errors, flash to the LPCXpresso dev board but nothing happens.

I have the "GPIO" tab but all the I get is:

Port status: Change

First I can't get the port status ("On" or "Off") and second when I click "Change" nothing happens.

Can you help me please to get this thing work?

Thanks a lot.

Mauro.
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by caprock on Sat Dec 03 18:17:11 MST 2011
James,
It's been a long time since I have looked at that sample, but I'll try to provide some general answers, but these are based on using one of the [B]uip[/B] Demo:

Basically, the uip V1.0 is a platform that you can use for the network stack.
A typical use may be as a Web Server where you can control I/O via the network. In this case, the ethernet interface itself is abstracted; you simpy provide data via the emac.

Perhaps a good place to start is the standard FreeRTOS distribution from NXP and it includes a working uip implementation, including a simple procedure for read/write of an I/O port. Check out the 'uIP_Task.c/h' for controlling the net. Note that this standard distribution is based on a board with 4 leds - not sure what you have, but a simple change can alter this for xpresso use with a single led.

Hope this helps. The uip can be confusing, but it does work.
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by james on Sat Dec 03 10:40:30 MST 2011

Quote: caprock
Thanks!

I was using the literal characters & not the symbolic names.:o

I was looking for a sample form use, such as filling in the network stats: IP, MAC. Ideally, this sample would search for the required field and replace it with the actual data.

At present, I have tried to change the port-status & port-change files to include a checkbox, and use this to determine which led gif is needed: simple light bulbs (led_on.gif/led_off.gif).

This I have done before with Wiznet, but can't seem to locate the correct hooks in uip as presented to the httpd-cgi.

Any additional samples would be appreciated.

Thank you for your assistance!  :)




Hi guys, I am also looking for tips/hints for solutions such as the one mention above. I tried easyweb example and it worked great, however I would like to send data to the lpc1768 via ethernet to change variables and control GPIOs.
What are the variables/ports that receive the information from the ethernet?
Any tips on where I should start from??
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jharwood on Wed Apr 20 13:30:08 MST 2011
If you download the latest FreeRTOS, unzip it and navigate to:
FreeRTOSV6.1.1\Demo\CORTEX_LPC1768_GCC_RedSuite\src\webserver

there's a version of the uIP webserver with a checkbox for the IO state.
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by caprock on Wed Apr 20 12:47:45 MST 2011
Thanks!

I was using the literal characters & not the symbolic names.:o

I was looking for a sample form use, such as filling in the network stats: IP, MAC. Ideally, this sample would search for the required field and replace it with the actual data.

At present, I have tried to change the port-status & port-change files to include a checkbox, and use this to determine which led gif is needed: simple light bulbs (led_on.gif/led_off.gif).

This I have done before with Wiznet, but can't seem to locate the correct hooks in uip as presented to the httpd-cgi.

Any additional samples would be appreciated.

Thank you for your assistance!  :)
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jharwood on Wed Apr 20 11:35:59 MST 2011

Quote: caprock
I have been searching for these special commands
(%! and %!:)
and can not find any references or definitions.

Understand that: %! port-toggle is used to call the cgi procedure in httpd-cgi.c:




Take a look at httpd.c, lines 137 to 143
    /* Check if we should start executing a script. */
    if(*s->file.data == ISO_percent &&
       *(s->file.data + 1) == ISO_bang) {
      s->scriptptr = s->file.data + 3;
      s->scriptlen = s->file.len - 3;
      if(*(s->scriptptr - 1) == ISO_colon) {
    httpd_fs_open(s->scriptptr + 1, &s->file);
   ...
Not very well documented, but when looking at the example script files and this section of code, it falls into place
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by caprock on Wed Apr 20 10:14:27 MST 2011

Quote:
HTML files with special codes called procedures:
Code:
%! port-toggle
Calls the procedure "port_toggle" in the CGI file.



With reference to the portchange.shtml file:

%! port-toggle

%!: /header.html
<h1>GPIO</h1>

Port status: %! port-status
<a href="portchange.shtml">Change</a>

%!: /footer.html


I have been searching for these special commands
(%! and %!:)
and can not find any references or definitions.

Understand that: %! port-toggle is used to call the cgi procedure in httpd-cgi.c:

static
PT_THREAD(port_toggle(struct httpd_state *s, char *ptr))
{
  PSOCK_BEGIN(&s->sout);
  LED_PORT->FIOMASK = 0;
  LED_PORT->FIOPIN ^= (1 << LED_PIN);
  PSOCK_END(&s->sout);
}


Also, it would seem that this code INCLUDES the file:

%!: /header.html


Can someone provide a link to these codes? (%! )
Thanks!
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jharwood on Sun Apr 17 10:04:33 MST 2011
Glad you found the problem :)
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by caprock on Sun Apr 17 09:41:55 MST 2011
Problem resolved.

Apparently the httpd-cgi.c file was never copied into my project as directed by the earlier posts from jharwood.

Now I see the cgi connection to the port io.

[B]This is a case of not following all directions.[/B]

Thanks to all - :o
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by caprock on Sun Apr 17 09:21:58 MST 2011
Thanks - I read this & yes, these cgi have been added and the perl script has been run to set the fs data.

As Luis just pointed out, the only connection to the system io is from the "port_toggle" in the cgi file.

I seem to have a 'disconnect' from the cgi to the gpio somehow. Just did a clean/rebuild again and still refuses to work. Using the peripheral view can set/clear the led and have re-confirmed the port/bit to control.

It would seem that the fact that the GPIO & Change hot spots are causing a transmission, that the makefsdata was done correctly.

Looking at the file httpd-cgi.c I see only the cals:

HTTPD_CGI_CALL(file, "file-stats", file_stats);
HTTPD_CGI_CALL(tcp, "tcp-connections", tcp_stats);
HTTPD_CGI_CALL(net, "net-stats", net_stats);

Shouldn't I see the "port_toggle" here as well?
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jharwood on Sun Apr 17 09:04:07 MST 2011
You did run perl mkfsdata ?
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Sun Apr 17 09:02:04 MST 2011
Hello caprock,

It's easy.

HTML files with special codes called procedures:
%! port-toggle


Calls the procedure "port_toggle" in the CGI file.

That's all folks.
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jharwood on Sun Apr 17 08:58:35 MST 2011
In my earlier post:


Quote:

- Modified httpd-cgi.c by adding two new CGI functions: port-status and port-toggle.

0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by caprock on Sun Apr 17 08:35:24 MST 2011
Thanks all for the replies.
I have confirmed that the LED is P0.22 & working.

However, in the _uIP demo that I am using, there is a cgi control to Change the GPIO state. What I am missing is the connection from uIP to the [I]action [/I]procedure that is supposed to be invoked.

Such a small detail, but clearly, I am overlooking something.

Where in this code is the [I]action [/I]procedure that is supposed to access the GPIO?:confused:
0 件の賞賛
返信

3,335件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by larryvc on Sat Apr 16 18:53:39 MST 2011
caprock,

Kind of a coincidence, see this post:

http://knowledgebase.nxp.com/showpost.php?p=7505&postcount=3

Not exactly the same as what you were working on, but it may help.
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jharwood on Sat Apr 16 18:01:02 MST 2011
Is there any chance that GPIO Port 0.22 may be set to one of the UART1 functions?

My main has:
    // Set P0_22 to 00 - GPIO
    LPC_PINCON->PINSEL1    &= (~(3 << 12));
    LED_PORT->FIODIR |= (1 << LED_PIN);
    LED_PORT->FIOCLR = (1 << LED_PIN);


That's about all I can think of that would cause a problem
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by caprock on Sat Apr 16 17:30:28 MST 2011
[SIZE=1]Win7/64: LPCXpresso/LPC1769[/SIZE]

All,

I just built the RDB1768cmsis_uIP project and made the changes for the upd_mods.zip as per jharwoods post of 3/6/2011.

Also initialized the LED as:

   #define LED_PORT 0// Port for led
   #define LED_BIT (1<<22)// Bit on port for led
   #define LED_ON 1// Level to set port to turn on led
   #define LED_OFF 0// Level to set port to turn off led

main:

   LPC_GPIO0->FIODIR = LED_BIT; /* pin defined as Output */
   LPC_GPIO0->FIOCLR = LED_BIT; /* turn off the LED */

But I can't seem to change the state with the GPIO Port Change and there are no errors or warnings.

All else is working - can anyone steer me to where in the code, and how the LED is updated from uIP?

Thanks
0 件の賞賛
返信

3,336件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Mon Mar 07 09:24:56 MST 2011
Works great! Now study the CGI file. Thank you very much.
0 件の賞賛
返信