Shop OBEX P1 Docs P2 Docs Learn Events
Timing of SHIFTOUT, SHIFTIN, I2COUT and I2CIN — Parallax Forums

Timing of SHIFTOUT, SHIFTIN, I2COUT and I2CIN

ArchiverArchiver Posts: 46,084
edited 2003-06-13 21:59 in General Discussion
I needed to check some timings of the synchronous serial commands on
the BS2pe and BS2p.

SHIFTOUT...
On the BS2pe, a SHIFTOUT with one byte takes 950 microseconds. The
shift clock,runs at about 16 khz (same as the BS2). On a BS2p, the
same instruction takes 380 microseconds and the shift clock runs at
about 40 khz.


Formulae:
1) SHIFTOUT N bytes
N * 690 + 260 microseconds on BS2pe, divide by 2.5 for BS2p
2) SHIFTOUT N words
N * 1190 + 260 micoseconds on BS2pe, divide by 2.5 for BS2p

Shifting out 32 bits as two words on the BS2p takes about 1050 microseconds.

I did look at both the BS2pe and BS2p, and in fact all the timings
seemed to be different by x2.5, the ratio of the crystal frequencies.

The times are from the time chip select goes low, until it goes back
high, so the actual command time is a little less than stated, by the
time required for one HIGH pin command.

SHIFTIN;...
The timing for SHIFTIN of one byte is 910 microseconds on the BS2pe,
365 uS on the BS2p. The shift clock rates are the same as for
SHIFTOUT.


I2COUT
A simple one byte I2cOUT command to a DS clock chip took 950
microseconds, exactly the same as a SHIFTOUT. There is a lot more
going on though, in action on the clock and data lines to send I2C
commands and acknowledgements. The actual shift clock rate is about
55 khertz. (I didn't try that on the BS2p, but it _may_ be 2.5 times
faster).

I2CIN
A simple one byte I2CIN command took 1120 microseconds on the BS2pe.

The I2C timings were bracketed by a HIGH and LOW command on another
pin, so the actual command time is about 100 microseconds less than
stated.

I have worried without knowing if systems would lock up waiting for
ACK if there was a defect with an I2C chip. System lockup is baaaad.
It seems not, there is a timeout of some sort (Thank you Chuck!).
The I2COUT command times out after about 128 milliseconds, and the
I2CIN command after about 250 milliseconds.

Maybe this data will be of interest to others. I'll put it on my
timing web page when I get a chance.

-- regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...
Sign In or Register to comment.