To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 621
620  |  622
Subject: 
RE: NXT external storage
Newsgroups: 
lugnet.robotics.nxt
Date: 
Mon, 9 Apr 2007 12:22:47 GMT
Reply-To: 
<dickswan@#ihatespam#sbcglobal.net>
Viewed: 
18621 times
  
Yes, 9600 bits/s is really slow for storage access.
Is there a known way to increase the clock and transferrate of I2C?

Christian

Yes. RobotC already supports an optional "fast" mode that is five times
faster transmission when reading a single byte. For reading multiple
bytes from an I2C device, RobotC is about 15 times faster than the NXT-G
firmware.

There are a couple of things to note.

Multi-Byte I/O:
==============
Reading multiple bytes from an I2C device is currently broken /
unreliable in the current NXT-G firmware. So, you're forced to read one
byte at a time; the three bytes of I2C protocol overheads results in
four bytes of I/O to read a single byte. A multi-byte read of 8 bytes
has only 11 (3 + 8) bytes of I/O. Reading one byte at a time takes 32
bytes (8 x 4)!

A circular buffer can get overwritten in the standard firmware for
multi-byte I/O. I think LEGO/NI will implement the fix in their next
firmware release.

Faster I2C Clock Rate:
=====================
The I2C implementation on the NXT is a bit-banged approach. I2C driver
is written in software with frequent interrupts. The 9600 baud
implementation has an interrupt on every I2C clock transition which is
double the baud rate (i.e. interrupt every 50 microseconds). This is
pretty frequent!

All 3rd part sensors that I have tested support the fast mode. The LEGO
ultrasonic sensor does not. The 3rd party sensors use embedded CPUs that
provide hardware I2C support. The ultrasonic sensor implementation uses
a bit banged I2C in the sensor; it cannot keep up with the faster I2C
clock.

You can't simply increase the clock rate to implement a fast mode. To
get the faster performance, I had to do several things. Including:
1. Write an I2C bit-banged driver that is more real-time efficient
   that the standard version.
2. Reduced the overhead of invoking the interrupt handler by a
   factor of two.



Message is in Reply To:
  Re: NXT external storage
 
(...) Yes, 9600 bits/s is really slow for storage access. Is there a known way to increase the clock and transferrate of I2C ? Christian (17 years ago, 9-Apr-07, to lugnet.robotics.nxt)

4 Messages in This Thread:

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

Custom Search

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