EmbeddedRelated.com
Forums
Memfault Beyond the Launch

HTTP_UPLOAD and RABIT WEB BL4S110 & Dynamic C 10.62

Started by "mr.mattyg" June 30, 2010
Hi All

A few questions.

I've read through documentation particularly AN421 and TCP/IP User's Manual Volume 2. I'm looking to place web files into FLASH memory using the FAT file system. I've decided that the best way for me to do this is using USE_HTTP_UPLOAD. So I'm trying to go off of the sample 'UPLD_FAT'. The main idea of the sample will work with my application however I've run into 2 problems.

The first being that using 'UPLD_FAT' and the defaultCGI handler only allows to upload certain file types (htm, c, txt, jpg). I would expect that my defined MIME table would be inherited into what is allowable for upload, but it doesn't seem to be the case. Do you know how I can modify what is allowable for upload? It seems like there is a default MIME table defined somewhere that maybe this defaultCGI handler is using, I just can't find it.

The second is that when I try to use both 'USE_HTTP_UPLOAD' and 'USE_RABBITWEB 1' I get the following compiler errors.
line 110 : ERROR RWEB_SUPPORT.LIB : Undefined (but used) global label _web_var_info
line 111 : ERROR RWEB_SUPPORT.LIB : Undefined (but used) global label _web_update_entry_ary
line 112 : ERROR RWEB_SUPPORT.LIB : Undefined (but used) global label _web_update_entry_ary_sz

There is a sample that is explained excellently in TCP/IP User's Manual Volume 2 that uses both 'USE_HTTP_UPLOAD' and 'USE_RABBITWEB 1' so I'd imagine this should work. Any ideas?

On Jun 30, 2010, at 3:51 PM, mr.mattyg wrote:
> The first being that using 'UPLD_FAT' and the defaultCGI handler only allows to upload certain file types (htm, c, txt, jpg). I would expect that my defined MIME table would be inherited into what is allowable for upload, but it doesn't seem to be the case. Do you know how I can modify what is allowable for upload? It seems like there is a default MIME table defined somewhere that maybe this defaultCGI handler is using, I just can't find it.

I'm not familiar with that problem -- is it possible that uploads are successful, but you can't view the files due to a MIME issue? After uploading, if you run the fat shell sample, do you see the files in the filesystem?

> The second is that when I try to use both 'USE_HTTP_UPLOAD' and 'USE_RABBITWEB 1' I get the following compiler errors.
> line 110 : ERROR RWEB_SUPPORT.LIB : Undefined (but used) global label _web_var_info
> line 111 : ERROR RWEB_SUPPORT.LIB : Undefined (but used) global label _web_update_entry_ary
> line 112 : ERROR RWEB_SUPPORT.LIB : Undefined (but used) global label _web_update_entry_ary_sz

This one is easy -- you'll get those errors if you don't have any "#web" statements in your program. You need to declare at least one "#web" variable or you'll see those warnings.

-Tom
Hi Tom,

Thank for the reply.

The first problem had ended up being that I wasn't use the 8.3 (index.htm)
format, so any files with the 8.4 (index.html) format were getting rejected
by the FAT file system. Probably if my engineering career began 10 or 20
years, I wouldn't have had this problem ;)

And yeah, the include of a #web var was all I need for the second problem.

Thanks,
Matt

On Tue, Jul 6, 2010 at 11:24 PM, Tom Collins wrote:

> On Jun 30, 2010, at 3:51 PM, mr.mattyg wrote:
>
> The first being that using 'UPLD_FAT' and the defaultCGI handler only
> allows to upload certain file types (htm, c, txt, jpg). I would expect that
> my defined MIME table would be inherited into what is allowable for upload,
> but it doesn't seem to be the case. Do you know how I can modify what is
> allowable for upload? It seems like there is a default MIME table defined
> somewhere that maybe this defaultCGI handler is using, I just can't find it.
> I'm not familiar with that problem -- is it possible that uploads are
> successful, but you can't view the files due to a MIME issue? After
> uploading, if you run the fat shell sample, do you see the files in the
> filesystem?
>
> The second is that when I try to use both 'USE_HTTP_UPLOAD' and
> 'USE_RABBITWEB 1' I get the following compiler errors.
> line 110 : ERROR RWEB_SUPPORT.LIB : Undefined (but used) global label
> _web_var_info
> line 111 : ERROR RWEB_SUPPORT.LIB : Undefined (but used) global label
> _web_update_entry_ary
> line 112 : ERROR RWEB_SUPPORT.LIB : Undefined (but used) global label
> _web_update_entry_ary_sz
> This one is easy -- you'll get those errors if you don't have any "#web"
> statements in your program. You need to declare at least one "#web"
> variable or you'll see those warnings.
>
> -Tom
>
>
Thanks in no small measure to the great advice I've gotten here, my
RCM5450W-based project is working. My intention is to publish it in a
magazine so others can build one for themselves (not quite ready to say what
it is.) But this leads to a problem: my unit has a config section that looks
like this:

#define TCPCONFIG 1

#define TCPCONFIG 1

#define _PRIMARY_STATIC_IP "192.168.2.45"

#define _PRIMARY_NETMASK "255.255.255.0"

#define MY_GATEWAY "192.168.2.1"

#define MY_NAMESERVER "192.168.2.1"

#define IFC_WIFI_SSID "ColwellWirelessNetwork"

#define IFC_WIFI_MODE IFPARAM_WIFI_INFRASTRUCTURE

#define IFC_WIFI_REGION IFPARAM_WIFI_REGION_AMERICAS

#define IFC_WIFI_ENCRYPTION IFPARAM_WIFI_ENCR_WEP

#define IFC_WIFI_WEP_KEY0_HEXSTR "xxxxxxxx"

Given that no readers are likely to have called their network
"ColwellWirelessNetwork", this won't do for anyone but me. If the readers
are willing to spring for Rabbit's dev board and compiler, or at least the
programming cable + compiler, they can just alter the appropriate fields,
recompile, and go. But that's expensive; my hope was that there would be a
way for each reader to configure his or her RCM module without requiring the
programming cable ($39).

Anyone got any better ideas?

Thanks -BobC
Hi Bob,

You can do the configuration at run time with the if_config() call. I do
this with a design that allows the user to configure for any network. All
the IP etc is done using DHCP or fixed, depending on the user's settings.
Same as for the WiFi key etc.

The Rabbit samples where you set it all with #define I really don't like and
these are really only suitable for test programmes. Read world programmes
need the ability to be changed without the need to recompile the
application.

The issue you have is how to get the information into the system. As I have
no idea if you have a display or any other input etc, it means you need a
way to get the settings from the user. Do you have an SD card reader in your
design? This is an ideal way to get settings into the unit. The other way,
and the way I do it is to have an engineer's serial port (as I call it) and
do the configuration via the likes of Hyperterminal. The engineers port runs
in its own task. All the settings are saved to the user block.

Dave...

---
Very funny Scotty, now beam down my clothes!!!
---
http://www.axoninstruments.biz
---

From: r... [mailto:r...] On
Behalf Of Bob Colwell
Sent: 18 July 2010 10:45
To: r...
Subject: [rabbit-semi] how to configure wireless w/o compiler & dev board

Thanks in no small measure to the great advice I've gotten here, my
RCM5450W-based project is working. My intention is to publish it in a
magazine so others can build one for themselves (not quite ready to say what
it is.) But this leads to a problem: my unit has a config section that looks
like this:

#define TCPCONFIG 1

#define TCPCONFIG 1

#define _PRIMARY_STATIC_IP "192.168.2.45"

#define _PRIMARY_NETMASK "255.255.255.0"

#define MY_GATEWAY "192.168.2.1"

#define MY_NAMESERVER "192.168.2.1"

#define IFC_WIFI_SSID "ColwellWirelessNetwork"

#define IFC_WIFI_MODE IFPARAM_WIFI_INFRASTRUCTURE

#define IFC_WIFI_REGION IFPARAM_WIFI_REGION_AMERICAS

#define IFC_WIFI_ENCRYPTION IFPARAM_WIFI_ENCR_WEP

#define IFC_WIFI_WEP_KEY0_HEXSTR "xxxxxxxx"

Given that no readers are likely to have called their network
"ColwellWirelessNetwork", this won't do for anyone but me. If the readers
are willing to spring for Rabbit's dev board and compiler, or at least the
programming cable + compiler, they can just alter the appropriate fields,
recompile, and go. But that's expensive; my hope was that there would be a
way for each reader to configure his or her RCM module without requiring the
programming cable ($39).

Anyone got any better ideas?

Thanks -BobC

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.839 / Virus Database: 271.1.1/3010 - Release Date: 07/18/10
01:35:00
Dave, if you would entertain one more ping: after staring at the Rabbit
sample code in, for example, dhcp.c, I realize I need to become better
educated about this DHCP stuff. What I think I want is for the module to
boot up knowing enough about my local network so that it can connect, and
then get a dynamic IP address from the server.

Then I want to browse to the homepage of the Rabbit module. When that's a
static IP address, it's easy, just go to http://192.168.2.45 (for instance).
But when it's a dynamic address, how do I reach it with a browser? Can I
somehow set the URL within the C code to something like www.BobsProject.net?
That can't be right, because I know I can't make up www.*.* URLs any old way
I want to. And I don't want this web site to be reachable from the internet
anyway. How do I browse to the Rabbit module's web site when I don't know
the IP address?

Thanks very much. -BobC
--- In r..., "Bob Colwell" wrote:
>
> Dave, if you would entertain one more ping: after staring at the Rabbit
> sample code in, for example, dhcp.c, I realize I need to become better
> educated about this DHCP stuff. What I think I want is for the module to
> boot up knowing enough about my local network so that it can connect, and
> then get a dynamic IP address from the server.
>
> Then I want to browse to the homepage of the Rabbit module. When that's a
> static IP address, it's easy, just go to http://192.168.2.45 (for instance).
> But when it's a dynamic address, how do I reach it with a browser? Can I
> somehow set the URL within the C code to something like www.BobsProject.net?
> That can't be right, because I know I can't make up www.*.* URLs any old way
> I want to. And I don't want this web site to be reachable from the internet
> anyway. How do I browse to the Rabbit module's web site when I don't know
> the IP address?
>
>
>
> Thanks very much. -BobC
>

There are several ways to do what you want. Scott Henion created a program that used UDP packets (if I remember correctly) to poll for rabbit modules. If they are on the same local subnet (and running the proper code), they will reply with their IP addresses. See this link:

http://www.shdesigns.org/rabbit/locateip.shtml

Another idea is to have the Rabbit send you an email with its IP address any time it powers up. I did that with some products I designed at my last job. Actually, it sent its first email to a mailing list, since we had no way of embedding our customer's email addresses in a virgin unit. They simply powered up their units and went to the online mailing list to find the email, then clicked on the link to access their setup page in the Rabbit. I still have the mailing list running on my server, but that company is now out of business. See http://ilf100.com/pipermail/ilf100_ilf100.com/ for an example. The links in the emails only work if you are already connected to the same local subnet, so this was a very safe way to "discover" the units' IP addresses.

If this is just something you will be using, you can just hard code your email address in your Rabbit and have it email you when it powers up.

If all else fails, login to your router and look at its DHCP clients table. It will probably be the one with no Client Host Name (unless you added to code for that in your Rabbit).

>
> If all else fails, login to your router and look at its DHCP clients table. It will probably be the one with no Client Host Name (unless you added to code for that in your Rabbit).
>

I use the following defines to at least get the host name to show up in the dhcp table of the router on my network (a Netopia DSL router).

#define DHCP_SEND_HOSTNAME
#define DHCP_CLASS_ID "RabbitBL4SXXX-TCPIP:Rabbit:Test:1.0.0"

Then later on in the code I have:

sethostname("RabbitBL4S1xx");

This seems to work for my setup YMMV :)

Regards,
Peter

--- In r..., "petermcs" wrote:
>
> >
> > If all else fails, login to your router and look at its DHCP clients table. It will probably be the one with no Client Host Name (unless you added to code for that in your Rabbit).
> > I use the following defines to at least get the host name to show up in the dhcp table of the router on my network (a Netopia DSL router).
>
> #define DHCP_SEND_HOSTNAME
> #define DHCP_CLASS_ID "RabbitBL4SXXX-TCPIP:Rabbit:Test:1.0.0"
>
> Then later on in the code I have:
>
> sethostname("RabbitBL4S1xx");
>
> This seems to work for my setup YMMV :)
>
> Regards,
> Peter
>

Yes, I did something similar in our products. I even made it a user-changeable field on the product's network configuration page. But really, all he needs to do is look for his Rabbit's MAC address in the DHCP Clients Table. I think the last 6 digits are the serial number that is on the barcode label.

Hi Bob,

If this is being installed in a network with a router, this is not a
problem. All routers allow you to allocate a fixed IP address that will
always be assigned to that MAC address when the module does a DHCP request.
This is how I have a couple of embedded devices setup on my network here.

This way your coding will work with any network and it is simply a matter of
setting up the networks router to point any traffic on port 80 to your
device.

You will need to make sure that the IP address of the actual network you are
on has a static IP address to the internet, but if not, there is usually a
DYNAMIC DNS option in most router setups that allow you to assign a
www.xxx.com domain to it. I use www.dyndns.com to always have a domain name
to reach my network. Even if the ISP changes my IP address, using this I can
get access to the Rabbit module etc.

Dave...

---
Very funny Scotty, now beam down my clothes!!!
---
http://www.axoninstruments.biz
---

From: r... [mailto:r...] On
Behalf Of Bob Colwell
Sent: 20 July 2010 11:00
To: r...
Subject: RE: [rabbit-semi] how to configure wireless w/o compiler & dev
board

Dave, if you would entertain one more ping: after staring at the Rabbit
sample code in, for example, dhcp.c, I realize I need to become better
educated about this DHCP stuff. What I think I want is for the module to
boot up knowing enough about my local network so that it can connect, and
then get a dynamic IP address from the server.

Then I want to browse to the homepage of the Rabbit module. When that's a
static IP address, it's easy, just go to http://192.168.2.45 (for instance).
But when it's a dynamic address, how do I reach it with a browser? Can I
somehow set the URL within the C code to something like www.BobsProject.net?
That can't be right, because I know I can't make up www.*.* URLs any old way
I want to. And I don't want this web site to be reachable from the internet
anyway. How do I browse to the Rabbit module's web site when I don't know
the IP address?

Thanks very much. -BobC

Memfault Beyond the Launch