Shop OBEX P1 Docs P2 Docs Learn Events
PINK internet module setup and testing — Parallax Forums

PINK internet module setup and testing

Peter VerkaikPeter Verkaik Posts: 3,956
edited 2005-11-10 19:51 in BASIC Stamp
Hi,
I received my module a couple of hours ago and have it setup like this:
Pink module:
ip = 10.10.10.71
network mask = 255.255.255.0
gateway = 10.10.10.1
dns = 10.10.10.8
baud = 9600
I connect direcly (using the crossover cable) to my pc network card.
Network card:
ip = 10.10.10.70
network mask = 255.255.255.0
gateway = 10.10.10.1
dns = empty
Everything works.
I have access to the Pink webserver.

I wrote a simple test program to read out the variables.
The values of all variables is NA when it arrived.
The status returns 0x01 which means connected and ready to send email
The post value is 0xFF, indicating no variable has been updated.

I modified Nb_var00 (ram) to PINK using the webbrowser (page VV_show.htm),
I could see the change by reading Nb_var00, but the status never set the update bit
and the post value remains 0xFF. Does the VV_show.htm page not use the POST method?

Also noted, not only the first 20 variables can be written to flash, but also all the
special purpose registers.

regards peter


Post Edited (Peter Verkaik) : 11/7/2005 4:14:21 PM GMT
«1

Comments

  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-11-07 16:59
    Peter, the status flag for a variable update will not set when you use the web interface to update the variables. You have to do that serially via a stamp.

    Have you played with the telnet debug window?

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-11-07 17:02
    Also: yes, the special regs can be written , this allows you to keep 'default' email settings in the module. (As well as UDP.)

    So Peter, what do you think?


    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-07 18:11
    Ryan,

    So the stamp is not informed when a variable is updated via the webbrowser,

    only when the stamp updates a variable itself, but then it already knows

    the value is updated, so for what purpose is the post register interesting (webpages?)

    Example please.

    I haven't use telnet yet, but was planning to use it as remote debug window,

    replacing the program port for debugging.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-07 18:37
    Ryan,

    The manual states at page 10:

    Nb_varSV will hold the number of the last variable updated from a web page POST.

    Is the manual incorrect regarding Nb_varSV?

    regards peter
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-11-07 18:45
    Web page post from a page served from the module. The VV page does not change the flag. The way my sample code in the docs does this:

    A webpage updates a variable.

    The flag that a variable has been changed is set.

    The stamp polls the PINK to see if a variable has been changed.

    The PINK responds with the value indicating that a variable HAS changed. (This read clears the flag on the PINK)-

    The stamp requests the NUMBER of the variable that was changed.

    The PINK responds with that value.

    The stamp then requests the value of the register.


    Think of the VV page as a debugging helper- changing the variables via that page does not change the flags (except for ready to send email)- Changing a variable via that page will NOT set the variable updated flag....

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-07 19:35
    Ok, that's clear now.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-07 20:42
    Some test results:

    When writing variables from the stamp

    the following applies:

    If writing up to 63 bytes plus CLS (binary 0) then the variable reads

    back as 63 bytes plus CLS

    If writing 64 bytes plus CLS, then the variable reads back as 64 bytes

    plus the contents of the next variable(s) until CLS.

    If writing 65 or more bytes plus CLS, then the variable reads·back as 64 bytes

    plus the contents of the next variable(s) until CLS.

    You must write the CLS character so PINK knows the end of input.

    So, when·writing more than 63 bytes, you must then explicitly write to the next variable if more

    than 64 bytes, or explicitly clear the next variable if exactly 64 bytes.

    If variables are filled up with 64 bytes, reading the variable continues with the next variable

    until a CLS is·read.

    regards peter

    Post Edited (Peter Verkaik) : 11/7/2005 9:02:24 PM GMT
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-11-07 20:56
    So, that implies that it can send 6400 bytes worth of data with a reference to only the 00 variable. If it rolls over to the next variable, and then the next and the next and so on. The first CLS encountered would serve as the end of file marker. huh?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-07 21:04
    Yes, I expect so (if the PINK parser behaves like when reading back variables).
    Must test that when I test the email sending.
    regards peter
    ·
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-07 21:11
    Tracy,
    my javelin test file can be found here
    http://groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/peripheral/web/
    I hope others will post basic stamp tests also.
    regards peter
    ·
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-11-07 21:16
    One may view the roll-over into the next variable as a bug- or a feature.

    It's fun to see people discover the module.

    I hope you all get as much enjoyment out of it as I do. I love using the thing.

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-07 21:24
    I think it is a feature. Too bad it isn't also so for writing.

    I will post my other javelin test results in this thread

    http://forums.parallax.com/showthread.php?p=557005

    regards peter
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-11-08 01:27
    I think rollover the 64 byte variable boundaries is a feature, too, but it will certainly turn out to be a bug for someone if it is undocumented! My PINK arrived at my office today via UPS, but unfortunately I'm not there to open it up. Tomorrow maybe it'll get real...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-11-08 20:10
    Okay, bear with me. I'm not familiar with how to set up networks.

    I wired up the netburner to a Stamp per instructions and connected the netburner via the red cable directly to the ethernet port on the PC. I used the red crossover cable because that is what Peter used. I'm not clear on when to use straight thru and when to use crossover. I think if I take this later and attach it to a port on the router, then I should use the straight thru blue cable, right?

    The netburner drew 170 milliamps of current. (I'm obsessive about checking current draw of things). Don't try to run this off of a 9 volt battery for long!

    The first time I started the IPsetup utility, all the fields were blank and there was nothing in the "Select a Unit" field. I filled in the fields in exaclty the same way as Peter did, then clicked on close. Still nothing indicated in the "Select a Unit" field.

    At that point I became lost. Where do you go on a PC to configure the network card? I'm a Mac guy. If I mess with the configuration, am I going to regret it later when I reconnect the ethernet cable to our office network and nothing works? I looked at a couple of control panels and got that feeling of not knowing at all what I am doing.

    So I restarted the IPSetup utility. Now, all the fields have zeros, baud rate is 115200, and the "Select a Unit" field now lists the SB70 as,
    SB70[noparse][[/noparse]00-03-F4-01-D3-12] DHCP'd at 0.0.0.0 running Parallax Web
    I tried clicking on the "Launch Webpage" button, but that comes up with a "Page cannot be displayed" error at http://0.0.0.0. I then clicked on the "Set" button in IPSetup, and got the following message "You must first select an NDK in the Select a Unit in the tree". Then when I click on the "Search Again" button, the SB70 reappears.

    Our office network is set up as DHCP via a router to the internet.

    So, I guess the question is, where do I go on a PC to set up a network card in a manner that also allows me to revert to the office network? Would I be better off just plugging in to the router with the blue cable?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-08 20:37
    Tracy,

    You should try to connect the pink to your router (or switch/hub) with the blue cable,

    especially if you only have one network card in your pc.

    If you run the ipsetup then, it should find the SB70. (click on search).

    regards peter
  • John R.John R. Posts: 1,376
    edited 2005-11-08 20:39
    A lot of ground to cover, but let's at least chip away:

    You have interpreted the cables correctly.· Think of things like an RS-232 and DCE vs. DTE equipment.· While not technically correct, let's go with the analogy.· Your PC and the PINKy are both DTE (or DCE, take your pick).· Routers, hubs and switches, etc. are the opposite.· When you connect any two, if they are different, you use a straight through cable.· If they are the same, you need the cross over cable.· Some newer network gear (switches, routers, hubs, etc.) can do an "auto configure" and can "change genders" as required.

    In terms of network setup, you need to get things in a state where they can talk to each other.· There are a bunch of ways to do this, and no right or wrong way (actually, there are a bunch of wrong ways, as you've already found out).

    Can you describe your basic network setup where you're working on this?· Is this at home or an office network?· Are you worried about others on your network "seeing" the PINKy?

    If this can wait until after 5:00 PM CST, I could maybe help over the phone.· Send me a Private Message if you are interested.

    In direct answer to where to set up the network card, you'll need to get to the properties page of the network connection (OS dependant on how to do this), and then got the properties dialog for the TCP/IP protocol.· You'll need to remember/record the settings for your office network, make changes for the PINKy and potentially change back.· Depending on concerns about others seeing the PINKy, and how your office network is setup, you may be better off plugging the PINKy into the router (assuming the PINKy can be set up this way.· I don't have mine yet, and have only glanced at the docs).



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-11-08 21:53
    Okay,

    I can connect fine via the wireless (+ethernet) router. The PINK is hardwired to the router via the blue straight through cable. All the computers in the shop can now connect to the Netburner default page via the DHCP assignment, which happens to be 192.168.0.104, which I found by looking at the status info page in the router config utility.

    John, thanks for the explanations. This is a small office setting with one PC and 3 Macs, hooked together via a D-link wireless router. For the initial test I unplugged the PC (which is setup for ethernet connection DHCP to the router) from the office network and did the tests as described in an earlier post.

    Now that it is working on the DHCP enabledd router, (which apart my initial miscue was as easy as falling off a log) I think I'll leave it there and proceed with the fun stuff of filling up some variables from the Stamjp and seeing them appear on a web page. I think for any application I might want it to be plugged into the router and exposed to view in so much as the dynamic DHCP allows. But for development, the router is not conveniently lcated and a direct connection to a Mac or PC will be easier to carry around.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • John R.John R. Posts: 1,376
    edited 2005-11-08 22:22
    Tracy;

    Now that the DHCP is all configured, life actually becomes easier if you want to move the PINKy to the PC.

    Use the interface to the PINKy and record the address and other information.

    Depending on how the PINKy handles the DHCP "lease", you might be all set.· Just move the PINKy from the blue wire to the red wire, plugged into the PC.· They should see each other just fine.· Eventually, the DHCP lease may expire, and then you'd need to move the PINKy back to the router, at least long enough to get the DHCP lease renewed.

    If the PINKy doesn't remember and/or hold it's DHCP IP address, move it back to the Blue wire, and let it get the DHCP address again.· Then go in and "hard code" that information (address, gateway, DNS, etc.) into the PINKy.· Now you should be able to move it back and forth between the router and a direct connect to the PC.

    Keep in mind, when you are connected directly from the PC to the PINKy, neither will have access to The Internet, or anything else on your local network (unless the PC has another network card or wireless connection).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-11-08 22:44
    With the netburner attached to the router, I ran IPSetup on the PC, and changed the IP to 10.10.10.71. Then brought the netburner over to a Mac powerbook and hooked it with the red cable, and set the IP address on the Mac to 10.10.10.70, and named the new configuration "PINK". Now the Mac has contact with the netburner web page and variables at the 10.10.10.71 address. And I have it as a named config to switch back and forth.

    After that, I took the netburner back over to the router, and ran the IPSetup utility on the PC and it was still able to contact the netburner and to read out its current IP settings. I then changed the IP to 192.168.0.120 (which is in the range of values assigned to the router). And pressed "Set", and now the netburner is accessible from all computers on address 192.168.0.120. I wasn't sure what would happen if I assigned it a fixed address within the range assigned to the router, if the router might freak out at not being able to assign the address, but it works.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • John R.John R. Posts: 1,376
    edited 2005-11-08 23:02
    It's working, at least·for now... (and probably will be for some time)

    The potential problem is that if the address you "hard coded" in is in a range that the router may use as a DHCP address, then there is a risk.· Depending on the dynamics of your network, how real this risk is, or could become, is questionable.· Here is the situation:

    _IF_ the address you assigned PINKy is in the range of addresses the router could use for a DHCP address, and _IF_ a new divices is added to the network that uses DHCP, and _IF_ said address is the next address to be assigned (this is not necessarily based on numeric order), then it is possible that the router will assing this address to the new divice.· This is not a good thing, and you would end up with two divices with the same IP address on the same network.

    There are a couple ways around this.· First, if you network is not changing, this is not likely to be a problem, and you can safely (relatively) ignore the issue.· If you are concerned, you can either assign a fixed address not in the "DHCP Address Pool", or, if the router supports "reservations", take out a reservation for the PINKy at that address.· This will work because you have the PINKy configured with a "fixed" address, so it will never ask for the DHCP address (and if it does, so what...).· If another device(s) asks for an address, it will never get PINKy's address because it is reserved, and the reservation is for a different device.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-11-08 23:25
    Thanks much for the clarifications, John. The "lease" business and the inner workings of DHCP have been a complete mystery (to me). I'll look into those other options to assign it properly. In the meantime, I've gotten it to send an email message successfully using Stamp data. Now I have to tear away from it for a while and do some work!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Robert KubichekRobert Kubichek Posts: 343
    edited 2005-11-08 23:57
    Tracy Allen said...
    Thanks much for the clarifications, John. The "lease" business and the inner workings of DHCP have been a complete mystery (to me). I'll look into those other options to assign it properly. In the meantime, I've gotten it to send an email message successfully using Stamp data. Now I have to tear away from it for a while and do some work!

    If you need any info on networking, I have some, PM me, and I can send you some..

    Wikipedia is a great place to find out just about anything. turn.gif

    Bob N9LVU scool.gif
  • John R.John R. Posts: 1,376
    edited 2005-11-09 00:40
    Tracy;

    There are a lot of "ifs" that need to happen before you have a problem. If your network isn't active in terms of new devices coming on line, you should have plenty of time before this becomes an issue. Just wanted you to know what's up in case it does come to bite.

    John
    Tracy Allen said...
    Thanks much for the clarifications, John. The "lease" business and the inner workings of DHCP have been a complete mystery (to me). I'll look into those other options to assign it properly. In the meantime, I've gotten it to send an email message successfully using Stamp data. Now I have to tear away from it for a while and do some work!
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • OrionOrion Posts: 236
    edited 2005-11-09 01:17
    John R. said...
    Tracy;

    There are a lot of "ifs" that need to happen before you have a problem.
    Ditto
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-09 10:54
    Update on the variable boundary rollover:

    This also applies to the special variables.

    The memory map (in order of address)

    00 to 99, BM, BI, EV, EC, ES, EF, ET

    Writing 64 or more bytes to ET, then ET reads back

    as 64 bytes immediately followed by the CLS character.

    Wether this is because the ET variable has a hardcoded 0 byte following it, I don't know.

    It could be an internal variable that happend to be 0.

    Because BM·may be overwritten due to received udp message, the maximum databytes

    for an email message, if you use this rollover, is·100*64-1 bytes, the last byte of

    variable 99 must be the CLS character to prevent rollover into BM.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-09 11:15
    Here are 2 programs to send·(udpclient) and receive·(udpserver)
    udp messages to/from the PINK.
    The port has been preset to 10000 which is the port PINK uses.
    The PINK truncates received udp messages to 63 bytes.
    regards peter
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-11-09 14:13
    Sorry I wasn't around to answer these yesterday, was in meetings almost all day. I will be more than happy to help, and to explain things as you go also.

    Depending on your router Tracy, the DHCP will see that the IP is already being used, and won't try to issue that IP to someone else. (Again that depends, but depending on your equipment, it should be fine.)

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-11-09 17:52
    Ryan, just curious. Are you doing the development of this there at Parallax using all those fancy tools available on the netburner web site? With respect to the variable rollover feature/bug, are you making a list of things like that to examine for release 1.1? It sounds like there are further developments in the works. That's great in my book, titled, "networks for dummies". (Maybe that is already taken.) I've read stuff and definitiona on Wikipedia and it a great, but so far I have to take it in more by osmosis than by understanding.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-11-09 18:18
    We are trying to come at this from both ends (Netburner and Parallax)-

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-11-10 14:53
    Trying my udpclient and udpserver tool on another machine

    gave the error Framework .NET v2.0 required

    You can download this runtime package here

    ·http://www.microsoft.com/downloads/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&DisplayLang=en

    regards peter
Sign In or Register to comment.