Hi,
if I configure the USART0 as SPI using the following code, the sent byte is sent twice.
// Init SPI
P3DIR |= 0x0B; // P3DIR_0 = 1; // STE0
// P3DIR_1 = 1; // SIMO0
// P3DIR_2 = 0; // SOMI0 (D/S)
// P3DIR_3 = 1; // ULCK0
// Pin select function
P3SEL |= 0x0E; // P3SEL_0 = 0; // STEO0
// P3SEL_1 = 1; // SIMO0
// P3SEL_2 = 1; // SOMI0 (D/S)
// P3SEL_3 = 1; // ULCK
P3OUT |= 0x01; // STE0 to high
U0CTL = SWRST; // Initialize USART state machine while held in reset
U0CTL |= CHAR+SYNC+MM; // SPI Mode, 8bit, Master mode
U0TCTL = CKPH+SSEL1+SSEL0+STC; // 3pin Mode, clock->SMCLK, no CKPL (poliarity), no CKPH (phase)
U0BR0 = 0x02; // UCLK/2
U0BR1 = 0x00;
UMCTL0 = 0x00; // no modulation (in spi mode don't used)
ME1 |= USPIE0; // Enable SPI0
U0CTL &= ~SWRST; // get USART out of reset state
// dummy transmission
P3OUT &= ~0x01; // STE0 to low
U0TXBUF = 0xAA;
while (!( IFG1 & UTXIFG0)); // Wait for TX to finish
IFG1 &= ~UTXIFG0; // clear flag
P3OUT |= 0x01; // STE0 to high
I see 2 identical bytes on the scope, the second comes about 5us after the first.
ACLK is 32,768 kHz
Does anyone know whats wrong here?
Best Regards,
Alex