Shop OBEX P1 Docs P2 Docs Learn Events
Sweet Jeebus! I cannot make my network test work! — Parallax Forums

Sweet Jeebus! I cannot make my network test work!

KamPuttyKamPutty Posts: 48
edited 2008-08-20 21:08 in Propeller 1
Hi all,

Well, I'm about to give up and sell everything I own and move to the middle of the desert and open a Kodak drive thru processing store.
I've been trying to get a stupid network "hello world" working and I cannot make it work! I had a nic board from FutureTek and could not make it work, so thinking that it was defective, I ordered a nic board from uController, soldered it all up and still no go! BLA! sad.gifsad.gifsad.gifsad.gifsad.gifsad.gifsad.gif

All I want to do is connect to a web site and display the contents (raw html) to the tv. I took the examples in the object exchange and changed only the "main" file to this

' simple ethernet test

CON

  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000

OBJ

  term          : "TV_Text"
  settings      : "settings"
  nic           : "driver_socket"
   
DAT

              long    0                       ' long alignment for addresses, don't remove

MAC           BYTE      $10, $00, $00, $00, $00, $01
IP            BYTE      10, 200, 1, 166
MASK          BYTE      255, 255, 255, 0
GATEWAY       BYTE      10, 200, 1, 1
DNS           BYTE      10, 0, 0, 1

REMOTEIP      BYTE      74, 125, 19, 104        ' www.google.com

VAR

  long stack[noparse][[/noparse]100]
  long handle
  byte rxChar
  
PUB init | i

  settings.start
  settings.setData(settings#NET_MAC_ADDR,@MAC,6)        ' set MAC  
  settings.setData(settings#NET_IPv4_ADDR,@IP,4)        ' set MY IP
  settings.setData(settings#NET_IPv4_MASK,@MASK,4)      ' set MASK
  settings.setData(settings#NET_IPv4_GATE,@GATEWAY,4)   ' set Gateway
  settings.setData(settings#NET_IPv4_DNS,@DNS,4)        ' set DNS
  

  ' Start the TV Terminal
  term.startWithMode(12,term#MODE_NTSC)

' lets start the nic services

' p0 = cs
' p1 = sck
' p2 = si
' p3 = so
' p4 = int

  if not \nic.start(0, 1, 2, 3, 4, -1)                  ' -1 = use external clock
    term.str(string("Unable to start networking!"))
    waitcnt(clkfreq*10000 + cnt)
    reboot

  term.str(string("Connecting to http server..."))
  term.out(13)

  handle:=nic.connect(@REMOTEIP, 80, 1234)
  term.str(string("Handle = "))
  term.dec(handle)
  term.out(13)

  ' wait to connect
  term.str(string("Waiting to connect..."))
  term.out(13)
  repeat until nic.isConnected(handle)

  term.str(string("Sending dummy character..."))
  term.out(13)
  nic.writeByte(handle, 65)
  nic.writeByte(handle, 10)
  nic.writeByte(handle, 13)

  ' read in all the chars forever  
  repeat 
   rxChar:=nic.readByte(handle)
   term.out(rxChar)
  




From the command line, if I do a "telnet 74.125.19.104 80" and press "x" and <cr>, I get back an error html string. Thats all I'm trying to do in the code
I'm sure my network settings are fine; doing a "ipconfig /all" I get the following (from my laptop - same network)

 IP Address. . . . . . . . . . . . : 10.200.1.103
 Subnet Mask . . . . . . . . . . . : 255.255.255.0
 Default Gateway . . . . . . . . . : 10.200.1.1
 DHCP Server . . . . . . . . . . . : 10.200.1.1
 DNS Servers . . . . . . . . . . . : 10.0.0.1




My wiring looks sound - was the same setup on both nic boards...

It just sits at the "waiting to connect" loop and never gets to the rest of the program...also, I picked "1234" as my local port, I changed this to make different values, but no luck!

Any thoughts? smhair.gif

~Kam The Sad cry.gif

Comments

  • KamPuttyKamPutty Posts: 48
    edited 2008-08-17 02:07
    BTW, on both boards, the link light comes on, and I do see the "activity" light blink...
  • jazzedjazzed Posts: 11,803
    edited 2008-08-17 04:19
    Hi Kam. What is your hardware? Can you make the system work as a ybox2 web-server?

    Wish I could help more, but can't now. Where's Harrison?

    Normally local port is a pid number ... seems like non-zero should be fine. Seems you don't check for handle < 0 before using it. Connect returns -1 on error.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • KamPuttyKamPutty Posts: 48
    edited 2008-08-17 14:58
    jazzed,

    The handle comes back as "1"...I'm using the Prop Demo Board.

    confused.gif

    ~Kam (^8*
  • KIHKIH Posts: 13
    edited 2008-08-17 15:25
    .. maybe just another "dead end", do you use correct ethernet cable?
    have been in the crosover-hell a few times here. [noparse]:)[/noparse]
  • KamPuttyKamPutty Posts: 48
    edited 2008-08-17 16:18
    KIH,

    I sure the cable is fine, I can take the *same* cable and plug it in my laptop and no issue getting IP...

    ~Kam The Sad
  • Beau SchwabeBeau Schwabe Posts: 6,560
    edited 2008-08-17 18:15
    KamPutty,
    ·
    "...I sure the cable is fine, I can take the *same* cable and plug it in my laptop and no issue getting IP..."
    ·
    Some·10/100/100 Ethernet cards can automatically detect the polarity of the cable and make the proper adjustments.· The fact that your laptop "works" may not be a true test because it can detect and compensate if the polarity happens to be reversed.· Check and see if you are using a network cable that swaps the polarity or if it is a straight through connection... sometimes it will say on the cable itself.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • KamPuttyKamPutty Posts: 48
    edited 2008-08-17 19:13
    Beau,

    The cable says "Patch Cable"...I tried 2 others, same result. Grrrr!

    For those people where the NIC *does* work, can you take my test program (in thread), and only change the IP info, can you make it work? Same program, different IP info. All it does it hit google, and google will return an error that I will capture...

    Thanks all for helping, this is driving me crazy!

    ~Kam The Super Sad confused.gif
  • jazzedjazzed Posts: 11,803
    edited 2008-08-17 19:38
    Kam,

    I've looked at this today, and I can get a connection using the steps in your code with static IP and DHCP addresses. For some reason I can't get page data though :<

    Looking at your configuration, it is unlikely that 10.xx.xx.xx is a normal IP address. You might have better luck if you try using DHCP.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Harrison.Harrison. Posts: 484
    edited 2008-08-17 19:43
    You need to long align the IP addresses in your DAT section. Darco's code assumes the connect IP is long aligned. This is likely why your code isn't connecting properly.

    So do this (note the long align is after the MAC address):
    DAT
    MAC           BYTE      $10, $00, $00, $00, $00, $01
    
                  LONG                                      ' forces long alignment
    IP            BYTE      10, 200, 1, 166
    MASK          BYTE      255, 255, 255, 0
    GATEWAY       BYTE      10, 200, 1, 1
    DNS           BYTE      10, 0, 0, 1
    
    REMOTEIP      BYTE      74, 125, 19, 104                ' www.google.com
    
    



    Also, what board / eeprom are you using? I believe the ybox2's settings object requires a 64KB eeprom in order to store / load settings. It looks like you can change one constant in settings.spin to make it work with a 32KB eeprom. This will only affect you if you call settings.commit.

    You should also try pinging your device to see if the driver is working. ICMP is way easier to get working than TCP across the internet.

    Post Edited (Harrison.) : 8/17/2008 7:52:17 PM GMT
  • jazzedjazzed Posts: 11,803
    edited 2008-08-18 00:42
    Hi Kam,

    I've attached some code that works which is a variation of the ybox2 stuff. If you set useDHCP <> 0 it will negotiate an IP address for you, otherwise you will have to change settings by hand. Don't forget to change the ENC start driver pin settings (mine are very different). Also, I'm testing this by loading RAM ... I'm pretty sure saving to EEPROM will not work.

    Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • jazzedjazzed Posts: 11,803
    edited 2008-08-20 15:55
    Kam, did you get anything working ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve
  • KamPuttyKamPutty Posts: 48
    edited 2008-08-20 17:10
    Hey Steve,

    Sorry for not letting ya'all know the results, and the result is.... confused.gif
    It's still a no go. Even using DHCP it just will not talk on the network. I'm wondering if the Demo Board is bad, as in a bad output pin.
    I've used different cables, different hugs/routers/switches....nada.

    I guess the next step is to put a LED on each pin and just make sure that they are functional...

    I'm just not sure where to go from here...very frustrating! cry.gifcry.gifcry.gifcry.gif

    I cannot even get ybox2's widgets to work...nothing!...I do get nice TV display!!! lol.gif

    Anyone in the San Jose area that can help? I'll buy pizza+beer!

    Maybe the first "San Jose Prop Get Together" event will be "Get Kams Stupid Network Working" lol.giflol.giflol.giflol.giflol.gif

    Well, back to work hell (client wants to add last minute functionality to the DVR product we're building for them! nono.gif )

    Take care all,

    ~Kam The No Network Sad Guy tongue.gif
  • parts-man73parts-man73 Posts: 830
    edited 2008-08-20 17:19
    Kam, I can assemble and test and send replacement if you need. If anyone ever has a problem with one of my products, I'll gladly replace any defectives.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Brian

    uController.com - home of SpinStudio - the modular Development system for the Propeller

    PropNIC - Add ethernet ability to your Propeller! PropJoy - Plug in a joystick and play some games!

    SD card Adapter - mass storage for the masses Audio/Video adapter add composite video and sound to your Proto Board
  • jazzedjazzed Posts: 11,803
    edited 2008-08-20 17:26
    Sorry to hear you have no progress. Rather than hooking up LED's you might consider adding Paul's Propeller Logic Analyser.
    http://forums.parallax.com/showthread.php?p=606048
    Space is tight with the ybox2 code, but you might be able to squeeze it in. I'm in San Jose, but not sure if we could find a good location for "Propellers and Beer" [noparse]:)[/noparse] Don't drink and spin [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve
  • KamPuttyKamPutty Posts: 48
    edited 2008-08-20 18:02
    Brian,

    I don't think it's your module, the same happens with the FutureTec board...
    What would be the best way of checking/validating that it works? I do have a logic analyzer, so it might be time to verify pins etc...
    Bandwidth is tight this week...stupid work.

    "Propellers and Beer" [noparse]:)[/noparse] Don't drink and spin <-- I love that!

    Okay, no beer then, just food!

    ~Kam The Feeling Better But Still Sad
  • Harrison.Harrison. Posts: 484
    edited 2008-08-20 21:08
    You should install Wireshark and watch to see if your prop is even sending packets. You'll need to make sure your computer can see the traffic. The best way to do this is to use a cheap hub (not a switch). Either that, or you can run the webserver on your packet capturing computer.
Sign In or Register to comment.