- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all,
well, I´m using the uCLinux ported by Microtronix and I think that is great. So, I´m trying to use the web server, I did the example and I can see the initial page, and I can change it for any page I want, so far so good. But I don´t know how to use the web server to execute commands, for exemple, to light a led in the board through a web page. First of all, is that possible? If yes, how can I do it? Thanks a lot, Vinícius.Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey,
I think I understand what you're trying to do, but I can't say i've tried to control the board through a web interface. I believe the webserver on uClinux distribution is boa: www.boa.org. And I believe you should be able to write a CGI script to control the board. However I am not sure how to access the LEDs from linux. For an application like this, that is for controlling the board and for getting input from the board, I would take a different approach. First, I would write a server application that runs on the board and listens to UDP or TCP connections on a specific port. Then I would create a java applet on the PC to talk to the board. Then I would host that applet on the board, so that when you connect to it, the applet runs automatically. This way, you can have more control over what you can do as opposed to the simple web interface. Maybe I can throw together a small demo of this approach, if anyone's interested. -Thomas- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Thomas,
can you show me your demo?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, let's start by simply controlling the LEDs first.
-- Reconfigure the linux kernel. Under "Processor type and features" take off "Enable leds, seven segment display". This will prevent the kernel from automatically incrementing the LEDs when running. Recompile the kernel and upload to the board. -- Start a new project, "Microtronix Nios II" -> "Linux Application Project". Call it "LEDControl" or something like that. Press Finish. -- Create a make file. Right click on LEDControl in Navigator view, choose "New" -> "File" then call it "Makefile" -- In the Makefile, put include Rules.mak all: LEDControl.exe LEDControl.gdb -- Add new file again, this time call it "LEDControl.c". This will be the main program. -- Add this code to LEDControl.c, replace the nios2_system.h path with correct path of your linux kernel project. I couldn't get the include path to work properly in Eclipse, so this is a quick hack. /* program for writing to LEDs on the Nios board */# include <stdio.h># include <unistd.h> // for sleep()# include <C:\altera\kits\nios2\bin\eclipse\workspace\linux1\build\include\nios2_system.h> int main () { np_pio *pio = na_led_pio; pio->np_piodirection = 3; pio->np_piodata = 0; unsigned char mydata=0; while(1) { pio->np_piodata = mydata; mydata++; sleep(1); } return 0; } -- Right click on project and choose "Build Project". LEDControl.exe should have been built. -- Assuming you have a CF card and a mounted file system and ftpd running and all, ftp to the board and upload LEDControl.exe to the board. In my case it goes under /mnt/ide0. If your configuration is different, you must find a different way to get the executable to the board. -- I use telnet to access the board. So in my case i would telnet, then login as "root" "uClinux". cd /mnt/ide0. Make the app executable by typing "chmod 700 LEDControl.exe". Then execute the application "./LEDControl.exe" -- When it runs LEDs should start incrementing in a sequence. Press control+c to break the execution. - Thomas
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page