Sunday, June 25, 2006

RVHE Network Issues

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=1

AND: 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,106

This 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=1696
80 BYTE(V+6)=8,0,0,0,70,17
Where 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):

So here is an entire program to send and receive packets:

10 D=DHCP(1)
12 IF D>0 THEN GOTO 10
13 GW0=192:GW1=168:GW2=0:GW3=1
15 PRINT "IP:",IP0,IP1,IP2,IP3
40 INTIP=1000
60 PAUSE 1000
70 V=1696
75 BYTE(V)=0,9,91,109,143,106
80 BYTE(V+6)=8,0,0,0,70,17,198,31,44,99,0,16,0,16
81 F=2176
82 BYTE(F)=66
95 GOTO 60

and in Bank 1:

1020 PRINT "BANK= ";B
1040 E=((B-2)*128)+1792
2000 RETI


curious_jp said...

May be fixable by thunking down a programmable gateway box ( linux machine etc ) between it and The Great Internet and writing a bunch of packet massaging modules. Good luck!

t11s said...

Heh, my goal is not to have PCs involved, otherwise I could throw away the microcontroller and just use a serial servo controller & A/D system hanging off of PCs.

Actually I am now not sure that the zero UDP checksum is what's wrong, I think it might be destination MAC address, Ethereal should tell me tonight.

Anonymous said...

what happened to rvhe? their website is down...

t11s said...

This site says about the guy who created the RVHE:

In June 2006, John Bordynuik founded John Bordynuik Inc for international parts sourcing

Otherwise, I have no clue! For about the same price as the RVHE, you can purchase a CUBLOC CB220 and a Lantronix Xport, and the TCP/IP stack works a lot better.

Anonymous said...

I have an RVHE but never got UDP to work, and your program does nothing tcpdump can see. I have firmware 146. Was there a release after that ?