UpDATE^3: I
FINALLY got the
RVHE working with a two-way NATed UDP conversation with a host over the Internet. Well, OK, it seems to work
half the time, it is unclear to me if this is an issue related to NAT or not, hopefully I can do some
Etherealing tonight to double check.
SO: You have to, by hand, specify the RVHE gateway. No, DHCP won't set it. For example:
10 GW0=192:GW1=168:GW2=0:GW3=1AND: You also have to, by hand, specify the RVHE gateway MAC address. No, DHCP won't set it. For example:
70 V=1696
75 BYTE(V)=0,9,91,109,143,106This kind of annoys me, because it means
Touch won't be automagically plug-and-play without hooking up a serial connected terminal and setting the gateway IP and MAC. But at least I can prototype with it.
AND: The RVHE initially sets the UDP time-to-live (TTL) value to zero. This means if your packet will be dropped by the first router it hits.
Undocumented, it turns out the TTL is set by the byte at the packet header address plus 10 bytes. However, too high a TTL will break the packet header checksum routine (which also means your packets won't make it). So I suggest keeping the TTL at 70 (decimal) which should get you across the longest Internet connection, but doesn't appear to break the packet header checksum routine.
For example:
70 V=169680 BYTE(V+6)=8,0,0,0,70,17Where the 70 is the TTL.
AND: Let's not forget that the RVHE only receives UDP packets that start with the password in PASS0,PASS1,PASS2,PASS3, then "AB" (which is not documented). The password defaults to "RVHE". If instread you add "AA", it will only work with "autoanswer" (which is documented).
For example (from a host with Python):
s.sendto("RVHEAB12345",('192.168.0.12',1234))So here is an entire program to send and receive packets:
10 D=DHCP(1)12 IF D>0 THEN GOTO 1013 GW0=192:GW1=168:GW2=0:GW3=115 PRINT "IP:",IP0,IP1,IP2,IP320 UDPPORTIN=1640 INTIP=100050 INTERRUPTS60 PAUSE 100070 V=169675 BYTE(V)=0,9,91,109,143,10680 BYTE(V+6)=8,0,0,0,70,17,198,31,44,99,0,16,0,1681 F=217682 BYTE(F)=6685 PRINT "SENDING..."86 PRINT SECONDS90 D=IPSENDUDP(5)95 GOTO 60and in Bank 1:
1000 PRINT "INTERRUPT"1010 B=IPGETDATA(1)1020 PRINT "BANK= ";B1030 C=RELEASE(B)1040 E=((B-2)*128)+17921050 PRINT BYTE(E),BYTE(E+1),BYTE(E+2),BYTE(E+3),BYTE(E+4)2000 RETI