Confused about synchronous communications



I'm trying to implement a general prarallel port communications program but
I'm a little confused about the timing issues involved.

In all of the protocols I'm looking at(I2C, SPI, and ICSP) it seems that the
communications is edge triggered.

What I see is that a data bit is sent when the clock changes and then the
clock changes again.

something like


Data
/---------\
/ \
/ \----



\ /---\
\ / \
\---/ \---/
Clock


So is this normally the case? Also, when does the data have to be valid? On
the second edge transition? (So in some sense the clock is 2x the data rate
so actually the data would be sampled 1/2 inbetween the data transfer rate?)

Basically I'm trying to figure out how I am to write my routine as at the
moment I'm and just changing the clock with the the data but then I realized
that there is no way to keep it synched up perfectly.

I also thought about sorta offseting the clock half way sorta like the above
but with

Data
/---------\
/ \ /
/ \---------/



/---------\
/ \ /
------/ \---------/
Clock

But then this has a problem of the data changing towards the end of the
clock.

So, I guess my actual question is, when is it required for the data to be
valid?


Data
/*****-----\
/ \
/ \----



\ /---\
\ / \
\---/ \---/
Clock

Do I have to get "valid data" at **** so that it can be sampled by every
other edge(every rising edge in this case)? If so, is this pretty much how
all synchronous communications works?

Thanks,
Jon


.



Relevant Pages

  • Re: Timing in Synch Comm.
    ... Obviously the slave is synched to the master's clock ... there ever any problems if the clock timing is extremely unstable? ... I believe the OP wasn't talking about SPI. ... Actually I'm trying to do it any synch communications. ...
    (sci.electronics.design)
  • Re: Confused about synchronous communications
    ... In all of the protocols I'm looking atit seems that ... the communications is edge triggered. ... What I see is that a data bit is sent when the clock changes and then ... data rate so actually the data would be sampled 1/2 inbetween the data ...
    (sci.electronics.design)
  • Re: Confused about synchronous communications
    ... the communications is edge triggered. ... What I see is that a data bit is sent when the clock changes and then the ... at the same time then what you have is double data rate, ...
    (sci.electronics.design)
  • Re: Confused about synchronous communications
    ... In all of the protocols I'm looking atit seems that ... the communications is edge triggered. ... What I see is that a data bit is sent when the clock changes and then the ... at the same time then what you have is double data rate, ...
    (sci.electronics.design)
  • Re: I2C "SCL" line problem
    ... relating to data changing while on the clock is high state. ... > I was incrementing a counter on the negative edge of SCL(this clock is ...
    (comp.arch.fpga)