Hi TI-Team,
During my programming on SPI communication I detected something strange. An enabled pull up/down functionality disables SPI output of slave. In this case if P1REN Bit 6 is set no data are sent from UCB0 on SOMI port. On pull up the other side receives 0xff. On pull down it receives 0x00. If P1REN Bit 6 is disabled then data are received on the other side.
For your background: SPI is enabled on a P1 edge interrupt as several MSP430G2203 communicate over the same line. To avoid an open line I intended to use REN to give it a defined value. Here is my code for SPI enable:
UCB0CTL1 |= UCSWRST;
P1SEL |= (BIT5 +BIT6 + BIT7); //Enable Ports
P1SEL2 |= (BIT5 +BIT6 + BIT7);
/*
* Control Register 0
*
* ~UCCKPH -- Data is changed on the first UCLK edge and captured on the following edge
* ~UCCKPL -- Inactive state is low
* UCMSB -- MSB first
* ~UC7BIT -- 8-bit
* ~UCMST -- Slave mode
* UCMODE_0 -- 3-Pin SPI
* UCSYNC -- Synchronous Mode
*
* Note: ~<BIT> indicates that <BIT> has value zero
*/
UCB0CTL0 = UCMSB + UCMODE_0 + UCSYNC;
/*
* Control Register 1
*
* UCSSEL_2 -- SMCLK
* UCSWRST -- Enabled. USCI logic held in reset state
*/
UCB0CTL1 = UCSSEL_2 + UCSWRST;
/* Enable USCI */
UCB0CTL1 &= ~UCSWRST;
UCB0TXBUF = 0x5a;
IFG2 &= ~(UCB0RXIFG); //enable SPI RX interrupt
IE2 |= UCB0RXIE;
If you find a mistake in my code please let me know. By the way I scanned family datasheet and errata sheet and did not detect any hint into this direction.
Regards
Guenther