[En-Nut-Discussion] SPI Bus
Bernd Walter
enut at cicely.de
Sat Feb 21 18:06:08 CET 2009
On Sat, Feb 21, 2009 at 10:08:52AM -0600, Tim DeBaillie wrote:
>
>
> On Feb 21, 2009, at 5:48 AM, Bernd Walter <enut at cicely.de> wrote:
>
> > On Sat, Feb 21, 2009 at 12:49:25AM -0300, Thiago A. Corrêa wrote:
> >> Hi,
> >>
> >> I'm now porting the SPI Bus, and as always, I'm taking the at91 as
> >> example. Is there any reason why the at91 driver is not using the PCS
> >> to let the chip auto manage the CSn line?
> >
> > The automangement often doesn't match with the slaves expectations.
> > Some slaves require the CS to be asserted over a complete sequence,
> > while the SPI controller deasserts it very quick.
>
> You don't have the port setup correctly then. You can configure this.
There are other drawbacks if you do that.
For example you might need the following
Assert CS
read something
setup an answer
deassert CS
A transaction is framed by holding CS.
You are not allowed to deassert CS during that, but have to for
finishing the transaction.
You either risc losing CS betweem the two transfers or don't
deassert at the end.
Of course you can toggle the mode, but this doesn't make it different
from using GPIO.
> > And sometimes people want more than 4 slaves.
>
> The SAM can controll up to 15 devices with a simple 4-16 multiplexer.
> The SAM has that built in to the SPI controller. You just have to set
> it up and attach the multiplexer.
True, hadn't though about that because it sounds senseless to attach
a multiplexer if enough GPIO are available.
> > I assume almost everyone is doing it manually.
>
> Not true. We are using the PCS control on 4 different boards.
You are not using it, but it doesn't prove my assumption wrong.
almost != everyone.
There are reasons to use it in automode, but IMHO the win is extremly
small and you have to read the datasheet carefull for unwanted side
effects.
The mixed transactions sounds interesting, but I never had an application
for it.
--
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
More information about the En-Nut-Discussion
mailing list