Hi All,
I am new to MSP430. - MSP430F5309
I am using 4 - pin SPI in my code. With the evaluation board, I was unable to see any clock or any data on the Tx pin and the clock when a data is getting transmitted on the SPI.
My code is like this.
/* Enable the sPI to work in master mode */
UCB1CTL0 |= UCMST;
/* Select the 4 pin SPI mode with UCSTE active low
* Active low is required since for the aDC the CS bit
* is active low.
*/
UCB1CTL0 |= UCMODE1;
/* Select synchronous mode with MSB first */
UCB1CTL0 |= (unsigned char)(UCSYNC + UCMSB);
/* Select SMCLK as the clock for this peripheral - 12 MHz */
UCB1CTL1 |= UCSSEL1;
/* Select the divider as 24 i.e., the CLK is 12M/24 = 0.5 MHz */
UCB1BR0 = 24;
UCB1BR1 = 0;
/* Set UCB1STE as output - P4.3 pin */
P4DIR |= BIT3;
/* Start the conversion for the ADC */
P4OUT &= ~BIT3;
//PM_UCB1STE = 0;
/* Initialize the ADC in auto -1 mode - low byte*/
UCB1TXBUF = 0x28;
/* Wait till the transfer is over */
while(UCB1STAT & UCBUSY == UCBUSY)
{
UCB1STAT &= ~UCBUSY;
}
__delay_cycles(1000);
/* High byte for auto -1 mode */
UCB1TXBUF = 0x40;
/* Wait until transmission is over */
while(UCB1STAT & UCBUSY == UCBUSY)
{
UCB1STAT &= ~UCBUSY;
}
__delay_cycles(1000);
/* Stop the conversion */
P4OUT |= BIT3;
Since I am using UCB1, the STE pin of this is defined as PM_UCB1STE. So how to set this bit to start SPI transfer?
Or is there anything wrong in my code.?
Note: My SPI pins are unconnected and I am not initializing any clock assuming it will take 1 MHz as the default clock
Thanks
Chaithra