To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 828
827  |  829
Subject: 
Re: patch for lnpd ( Collision problem in far-mode )
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sun, 13 Feb 2000 02:03:49 GMT
Viewed: 
3202 times
  
No matter what I do (opening the window, turning on more lights etc) I can't
get the tower to stop seeing collissions. I must admit that IR reflects so
well in my house that the TV remote works form other rooms.

So I tried loading your patch Martin. Sorry to be a pain, I assume this is how
I apply the patch you wrote?

abacus:~/lego/lnpd+liblnp/lnpd$ patch transceiver.c patch-trans
patching file `transceiver.c'
patch: **** malformed patch at line 4: static unsigned char* tx_next;

I need to be told I am an idoit every now and then :)

Michael.

In lugnet.robotics.rcx.legos, Martin Cornelius writes:
Toni Martinez-Colom wrote:

I have observed the same behavior... only by night. I think it must be the
tower receiving echoes of its own packets.


i had never seen this interesting effect, because i always had my tower
in near mode, where it only happens if you put the tower straight in
front of a wall. I suspect it's a little more complex to explain what
happens here, because the tower always receives it's own packets -- this
actually is the principle of collision detection. We just test if every
byte we sent out comes back immediately, if not, or the uart tells us a
framing error occured, we regard this as a collision.

I guess there is some analog circuitry inside the tower that screws up
sometimes. If you modifiy lnptest to have the packets sent contain all
the same value in the data section, there are much less errors.

However, i found some kind of solution, that seems to make things much
better. I just removed the frame-error checking code from lnpd.
Actually, this code is not necessary, we have a checksum at the end of
each frame that should detect garbled data anyways. Obviously the uart
often detects frame errors although the content of the byte was received
correctly.
Perhaps we could also remove frame error detection from legOS with
positive results, i`ll check that.
Anyways, here is the patch for lnpd: You can still get the
frame-checking by adding -DCHECK_FRAMING to the CFLAGS, but by default
it will not be there, making lnpd even a little smaller.

Please, tell me if that helps,  Martin

------------- snip here -------------------
--- transceiver.c.old Sat Feb 12 23:12:20 2000
+++ transceiver.c Sat Feb 12 23:08:45 2000
@@ -32,9 +32,11 @@
static unsigned char* tx_next;
static unsigned char* tx_verify;
static unsigned char* tx_end;
-static struct serial_icounter_struct tty_error_info;
static struct timeval inter_byte_time, keep_alive_time,
tx_allowed_time;
static const unsigned char keepalive_byte = KEEP_ALIVE_BYTE;
+#ifdef CHECK_FRAMING
+static struct serial_icounter_struct tty_error_info;
+#endif

// convert a time in milliseconds to struct timeval
static void msecs2timeval(int msecs, struct timeval *tval)
@@ -58,7 +60,7 @@
int result = select(0,NULL,NULL,NULL,&wtime);
if ( result < 0 && errno != EINTR ) error_exit("select()");
if (gettimeofday(&now,NULL)) error_exit("gettimeofday");
- if (timercmp(&now,&end,>)) break;
+ if (!timercmp(&now,&end,<)) break;
timersub(&end,&now,&wtime);
} while (1);
}
@@ -94,7 +96,9 @@
static void rx_flush(void)
{
    if ( tcflush(rcxfd,TCIFLUSH)) error_exit("tcflush");
+#ifdef CHECK_FRAMING
    if ( ioctl(rcxfd,TIOCGICOUNT,&tty_error_info)) error_exit(ioctl);
+#endif
}

// discard all characters in the output queue of tty
@@ -156,10 +160,14 @@

static int rcx_read(void)
{
- int badframe, bytes_read, total_read = 0;
+    int bytes_read, total_read = 0;
unsigned char rcv_buffer[RCV_BUFFER_SIZE];
    unsigned char *rcvd;
+
+#ifdef CHECK_FRAMING
+ int badframe;
    struct serial_icounter_struct new_error_info;
+#endif

while (1)
{
@@ -170,6 +178,7 @@
if ( bytes_read < 0 ) error_exit("read");
        // log(LNPD_LOG_DEBUG,"read %d from tty",bytes_read);

+#ifdef CHECK_FRAMING
// check for frame errors
        if ( ioctl(rcxfd,TIOCGICOUNT,&new_error_info))
error_exit("ioctl");
        badframe =
@@ -187,6 +196,7 @@
         log(LNPD_LOG_LOGICAL,"Frame Error");
        break;
        }
+#endif

for (rcvd = rcv_buffer; rcvd < rcv_buffer + bytes_read ; • ++rcvd)
{
@@ -269,7 +279,9 @@
    // wait for IR to settle
    msleep(100);
    rx_flush();
+#ifdef CHECK_FRAMING
    if ( ioctl(rcxfd,TIOCGICOUNT,&tty_error_info)) error_exit("ioctl");
+#endif

    // check if we can read back what we sent
    write(rcxfd,&keepalive_byte,1);
------------- snip here -------------------



Message has 1 Reply:
  Re: patch for lnpd ( Collision problem in far-mode )
 
(...) Pardon, Mike, i should have anticipated that, because i had the same problem when i first tried to apply a patch. The usage of patch is a little uncommon: You have to provide the patch through stdin !. Thus, i'd suggest the following (...) (25 years ago, 13-Feb-00, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  patch for lnpd ( Collision problem in far-mode )
 
(...) i had never seen this interesting effect, because i always had my tower in near mode, where it only happens if you put the tower straight in front of a wall. I suspect it's a little more complex to explain what happens here, because the tower (...) (25 years ago, 12-Feb-00, to lugnet.robotics.rcx.legos)

21 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR