Re: SPI on the User Port ... Mode Hang-Ups.
- From: BruceMcF <agila61@xxxxxxxxxxxx>
- Date: Mon, 28 Jan 2008 12:45:33 -0800 (PST)
On Jan 28, 2:52 pm, Jim Brain <br...@xxxxxxxxxx> wrote:
BruceMcF wrote:
Actually, the data*** states data is valid on SP when the CLK falls,
so it is actually MODE 2. so you should be able to just invert the CLK
line and get MODE 0.
No, in Mode2/Mode0, the data has to be valid on MISO/MOSI prior to the
clock transition. The low bit of the Mode number is the phase ... data
is either valid *through* phase 0 or *through* phase 1 of the clock
cycle, the high bit is the default state of the clock.
Or lining them up by the actual transition, Mode 0, Mode 3: Data is
valid before, during, and after the CLK rise. Mode 0, CLK rise is the
leading edge of the clock phase, Mode3, CLK rise is the trailing edge.
Most dual mode devices *that I have seen datasheets for* (I have by no
means seen a large number) are Mode0 or Mode3.
Mode1, Mode 2: Data is valid before, during, and after the CLK fall.
Mode 1 is default low, so clock fall is phase0, Mode 2 is default
high, so the clock fall is phase0.
The data*** says: "Data shifted out becomes valid on the falling
edge of CNT and remains valid until the next falling edge." So its the
trailing phase of the clock that data is available *through* a clock
transition. For Mode 0, it has to be the leading phase of the clock
that has data available *through* a clock transition.
http://archive.6502.org/datasheets/mos_6526_cia.pdf(p 7)
You well need SS lines for each slave device you wish to talk to. Since
you won't talk to more than 1 at a time, I suggest a '138 to select 1 of
8 targets, using 0 as "idle". (G1 tied to Vcc, G2A to Bit3. G2B tied
to bit 4 of PortB). A second 138 can be used (G1 tied to Bit3, G2A tied
to GND, G2B tied to bit 4) for 16 targets, address 0 still being "idle".
Jim
Having too many slave SPI devices is a headache in any event, but I'll
think about that.
Fewer parts is better ... if I can get by with Mode3 alone, I'll be
grinning.
.
- Follow-Ups:
- Re: SPI on the User Port ... Mode Hang-Ups.
- From: Jim Brain
- Re: SPI on the User Port ... Mode Hang-Ups.
- References:
- SPI on the User Port ... Mode Hang-Ups.
- From: BruceMcF
- Re: SPI on the User Port ... Mode Hang-Ups.
- From: Jim Brain
- SPI on the User Port ... Mode Hang-Ups.
- Prev by Date: Re: SPI on the User Port ... Mode Hang-Ups.
- Next by Date: Re: C16 played Atari 2600?
- Previous by thread: Re: SPI on the User Port ... Mode Hang-Ups.
- Next by thread: Re: SPI on the User Port ... Mode Hang-Ups.
- Index(es):