Steve Underwood <ste...@coppice.org> wrote:

> Dmitry wrote:
> 
> >The same thing.
> >
> >Does anybody have an experience in coupling max54xx DAC and msp430
> >via SPI ?
> >
> >~d
> >
> The attached code is used to drive a DAC8532 using an MSP430's SPI
> port. 

    while ((IFG1 & UTXIFG0) == 0)
        /*dummy loop*/;

According to TI (http://www-s.ti.com/sc/psheets/slau049b/slau049b.pdf,
page 278) it is necessary to test TXEPT:
| Note: Writing to UxTXBUF
| Writing data to the transmit-data buffer must only be done if buffer
| UxTXBUF is empty; otherwise, an unpredictable character can be
| transmitted.

I'm talking to a MMC in SPI-Mode, and if I don't check TXEPT (or
alternatively URXIFG0) it doesn't work reliably!

Now since my "TX-is-ready"-macro is looking like this:
#define SPI_TXC ((IFG2 & UTXIFG0) && (UTCTL0 & TXEPT))
all SPI-problems have vanished.

-- 
AVR-Tutorial, Forum, über 300 Links: http://www.mikrocontroller.net

Reply via email to