I've Tried it both ways, I used objdump to check to see if it was
calling spiReadWriteByte twice, It wasn't so I'm not quite sure what
would cause this. It used to work, Though it does act as if the
processor knows its sending both bytes cause I will get an OE error on
U0RCTL, So it knows its running over itself.
for the meantime ive written a software spi function set that can be
easily replaced. Its just the USART is faster and less resource
intensive than software. I guess I'll look through more assembler code.
--Del
Chris Liechti wrote:
Delbert Martin IV wrote:
I have done some more work with this and found that if the device is
freshly programmed, it will work until I restart the board. Once I
restart it, it begins to send 2 bytes instead of 1, I will Post some
Code.
#define waitSPI_RXTX() while((IFG1 & URXIFG0) == 0)
in slau049c.pdf, they talk about UTXIFG not RX. and a colleague that
used the SPI did this: write to TXBUF wait for TXIFG, then wait for
RXIFG, finaly read RXBUF
void setupSPI() {
U0CTL = 1; /* Software Reset */
U0TCTL = 0x73;
U0BR0 = 0x02;
U0BR1 = 0x00;
U0MCTL = 0;
ME1 |= USPIE0;
U0CTL = CHAR+SYNC+MM;
}
char spiReadWriteByte(char b){
char a;
U0TXBUF = b;
waitSPI_RXTX();
a = U0RXBUF;
return a;
}
Chris Liechti wrote:
Delbert Martin IV wrote:
When I Send a byte with USART1 on an MSP430F149 It double Sends the
byte, which causes CHAOS to anything I am working with. I'm
probably not doing something right, anyone know what might cause
this phenomenon.
i'm using the USART1 without problems
It sends the second byte about 1 uS after the first, which is
faster than my program does it, ~68uS. So Im pretty sure its
something in hardware.
are you sure you're not writing the byte twice to the TXBUF1?
i usualy poll TXEPT to ensure that the last byte was sent:
void putchar(char c) {
while (!(TXEPT & UTCTL1)) {}
TXBUF1 = c;
}
chris
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads,
discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
--Delbert Martin
Administrator IT Systems
Kionix, Inc.
36 Thornwood Dr.
Ithaca NY 14850
(PHN) (607)257-1080 x199
(FAX) (607)257-1146