Other Parts Discussed in Thread: MSP430F2274
Hello,
I want to do some SPI communication with "UCA0SOMI" and "UCA0CLK" with my MSP430F2274.
So I look the datasheet of my MSP430F2274 :

So I see that the "UCA0SOMI" and "UCA0CLK" are secondary peripheral module function.
So like the datasheet of the MSP430 says :

I just have to write this in my code :
"P3SEL |= 0x21; // P3.0 & P3.5 use for SPI communication UCA0CLK, UCA0SOMI
P3SEL2 |= 0x21; // P3.0 & P3.5 use for SPI communication UCA0CLK, UCA0SOMI"
But the compiler (IAR for MSP430) says to me :
"Error[Pe020]: identifier "P3SEL2" is undefined "
Someone can help me quickly, please ? (I have to do a demonstration for customers tomorrow.)
my entire code :
"#include "msp430x22x4.h" // for MSP430F2274
void Delay_100ms (void);
long j;
volatile unsigned char Data[3]={0};
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
UCB0CTL1 |= UCSWRST;
BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1MHz
DCOCTL = CALDCO_1MHZ;
P3SEL |= 0x21; // P3.2 & P3.3 use for SPI communication UCB0SOMI, UCB0CLK
P3SEL2 |= 0x21;
//P3SEL |= SPI_SOMI + SPI_CLK; plus propre
P2DIR |= 0x08; // P2.3 output direction for Chip Select
P2OUT &= ~0x08; // Initialisation chip select
P2OUT |= 0x08;
UCA0CTL0 |= UCCKPH + UCCKPL + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 0x02;
UCA0BR1 = 0x00;
UCA0MCTL = 0x00;
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
while(1)
{
P2OUT &= ~0x08; // MCP3551 start his conversion
P2OUT |= 0x08;
Delay_100ms ();
P2OUT &= ~0x08; // I want know get the result of the conversion
IFG2 &= ~UCA0RXIFG; // Clear int flag // I get the first byte
UCA0TXBUF = 0x00; // Dummy write to start SPI
while (!(IFG2 & UCA0RXIFG)); // RXBUF ready?
Data[0] = UCA0RXBUF; // Move value
IFG2 &= ~UCA0RXIFG; // Clear int flag // I get the second byte
UCA0TXBUF = 0x00; // Dummy write to start SPI
while (!(IFG2 & UCA0RXIFG)); // RXBUF ready?
Data[1] = UCA0RXBUF; // Move value
IFG2 &= ~UCA0RXIFG; // Clear int flag // I get the third byte
UCA0TXBUF = 0x00; // Dummy write to start SPI
while (!(IFG2 & UCA0RXIFG)); // RXBUF ready?
Data[2] = UCA0RXBUF; // Move value
P2OUT |= 0x08;
Delay_100ms ();
}
}
void Delay_100ms (void)
{
TACCTL0 &= ~CCIFG;
TACCTL0 = CCIE;
TACTL = TASSEL_1 + MC_1;
TACCR0 = 3277;
__bis_SR_register(LPM3_bits + GIE);
}
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A(void)
{
__bic_SR_register_on_exit(LPM3_bits + GIE);
}"