avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] SPI read/write as slave


From: Asko Kauppi
Subject: [avr-gcc-list] SPI read/write as slave
Date: Wed, 31 Dec 2003 11:03:51 +0200

Hi, all

I'm doing an SPI communications handler with avr-gcc where the (slave mode)
AVR would also respond to sent messages.
If i try to pass back return data to the master (= writing the SPDR
register) i get collisions in the status bit. 

What is the right order to do these things?

        INTERRUPT( SIG_SPI )    // SPIF should be automatically cleared,
coming here.
        {
        byte st= SPSR;
        byte data= SPDR;

        ...deal with incoming byte...

        if (...any outgoing data...)
                SPDR= data_out;
        }

This does not work, and the samples i find on the AVR specs are for
listen-only (and non-interrupt based) SPI traffic.

Thanks for the help!

-ak

###########################################
This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]