Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: SPI usage

2005-01-13 by Robert Adsett

At 11:42 AM 1/13/05 +1100, you wrote:
>I've written an interrupt based SPI driver to fit into the newlib
>structure (ioctl, read, write).
>
>It only handles SPI0 at present, but probably could be easily extended
>to handle SPI1 as a subdevice. (btw, Why are UART0 and UART1 handled as
>seperate devices rather than sub-devices in  newlib ? Is it because
>UART1 has full handshaking potential and UART0 doesn't ?).

I could give you a long winded explanation, but the truth is it was 
submitted to me that way.

I would have done it that way myself.  I suspect for the UARTs it's the 
correct way to go since it allows you to choose which one to use 
easily.  Feel free to implement a joint pair though I'd love to see it.

>Since SPI is inherently bi-directional, you use read before write to
>setup where you want the received data to go (if you wish). You must do
>a write for anything to happen (read or write), so if you only want to
>read (unusual in an SPI master) just write some crap. Both read and
>write return immediately (this is an interrupt based driver!). You can
>poll for transaction completion, however, by observing return status of
>write with 0 length requested.
>Open resets the buffer pointers to nowhere, and ensures only one thread
>can open an SPI device at a time.
>Ioctl can be used to setup the speed, clocking polarities and bit order.
>
>It will be quite a while before I'm in a position to test it. Anyone
>willing to give it a bash ? (probable bugs apologised for in advance).

I was going to tackle this shortly as well so I'd be will to take a crack 
at it.  I've got a board with some spots on it specifically so I could 
start testing SPI since I expect I will need it in the not too distant future.

Contact me  through one of the contact links on 
http://www.aeolusdevelopment.com That's probably the easiest way. (One of 
the links uses a obfuscated mailto link, if that doesn't work send me your 
contact through one of the forms.  If its marked clearly it'll get through 
to me).


Robert


" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.