Shop OBEX P1 Docs P2 Docs Learn Events
Timothy Swieter's UDP Echo demo — Parallax Forums

Timothy Swieter's UDP Echo demo

schillschill Posts: 741
edited 2010-11-17 08:24 in Accessories
I'm having a bit of a problem running Timothy Swieter's UDP echo demo from the OBEX:

Brilldea_W5100_UDP_Echo_Demo_indirect_Ver005.spin

I'm using this driver with it:

Brilldea_W5100_Indirect_Driver_Ver006.spin


This example echos any UDP messages that come into a port back out to the original sender. I'm running it on a Spinneret.

From outside the Spinneret, everything seems to be working fine. I have a program on a PC sending messages and I'm getting them back (the original behavior of my program was not what I was expecting, but that's a different story and the Spinneret end is working fine).

So, the messages are being echoed but the code running on the Spinneret is not doing everything I expect.

I'm afraid my spin skills aren't what they should be but I'm having a problem with this section of the code:
    'Stay in this loop forever - receiving and echoing
    repeat
      temp0 := 0
      bytefill(@data, 0, _bytebuffersize)

      PST.Str(string("Waiting to receive...."))
     
      repeat until temp0 := ETHERNET.rxUDP(0, @data[0])
     
      PST.Str(string("received "))
      PST.dec(temp0)
      PST.Str(string(" bytes and echoing...."))
      
      ETHERNET.txUDP(0, @data[0])
      PST.Str(string("sent", PST#NL))

It should be sending messages through the USB port back to the computer. I'm running PST on the computer. I see all the messages up to and including the first "Waiting to receive..." (these messages include things like the ip, port address, wiznet status, etc. and are not shown in the code I "snipped").

But after that first "Waiting to receive..." I never see anything else. It does not show the "received" message or the byte quantities. It does not send "Waiting to receive..." the next time through the loop.

But, everything else appears to be working. It is echoing the UDP messages back to the computer.

I'm at kind of a loss here. I wouldn't expect only part of this loop to be working. Is it possible that something is causing the USB link to stop working? I can reset or reprogram the prop and start over anytime I want.

Like I said before, my spin skills aren't the greatest but I don't see anything wrong. Has anyone else run into this or have any ideas?

Comments

  • Mike GMike G Posts: 2,702
    edited 2010-11-17 04:52
    I think you're saying, I don't see a response on the Parallax Serial Terminal?

    The Parallax Serial Terminal closes the serial port connection when it losses focus. Have your PC application loop and enable the PST.
  • schillschill Posts: 741
    edited 2010-11-17 08:24
    Mike:

    I will try again and see if this is what's happening. I have two versions of my PC code, one that requires manual intervention ("click the button") and one that loops. I was running the looping version.

    But, now that I think of it I think there was other stuff running on the machine at that time which I know can sometimes steal focus when it shouldn't. I'll try my tests again tonight and be more careful about what's running on the machine, use a different machine to monitor the serial communications, or run a different terminal program.

    Thanks
Sign In or Register to comment.