Hi there,
I am working on a project having a MSP430F5438A, which works as a Master in SPI mode along with a 8051 MicroController which works as a Slave. Slave has programmed in such a way that it mirrors the data it receives through MOSI pin and sends it back to SOMI pin. I need to use this signal to further configure the state of my project but I am not getting the required signal from SOMI pin. I am only getting continuous high regardless of CLK & TXBUFF signal.
I am using USCI A0 in 3-wire SPI mode.
This is how I am configuring the system:
//-------- define pins ------------------
#define UCA0CLK BIT0 //SPI_A0 CLK pin p3.0
#define UCA0STE BIT3 //SPI_A0 STE pin 3.3
#define UCA0SIMO BIT4 //SPI_A0 SIMO pin 3.4
#define UCA0SOMI BIT5 //SPI_A0 SOMI pin 3.5
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
//----------------- SPI PIN Config ---------------
//P3.0=UCA0CLK ; P3.3=UCA0STE ; P3.4=UCA0MOSI ; P3.5=UCA0MISO
P3OUT |= UCA0STE; // High Output to Pins P3.0,3,4,5. All other Pins are input, Read only.
P3DIR = 0x19 // Port Pins P3.0,3,4 configured as output
P3SEL = 0x31 // SPI A0 3-wire Peripheral module function is selected
//----------------- SPI INIT ---------------
UCA0CTL1 |= UCSWRST; // Software reset enabled
UCA0CTL0 |= UCMST + UCSYNC + UCMSB; //Master Mode; 3Pin SPI with slave active low; Synchronous Mode; MSB First
UCA0CTL1 |= UCSSEL_2; // BRCLK source clock is SMCLK
UCA0BRW |= 0x0002; // f(BitClock) = f(BRCLK)/2
UCA0MCTL |= 0; // Always Keep Zero
UCA0CTL1 &= ~UCSWRST; // Machine is Ready
UCA0IE |= UCRXIE; // Receive interrupt enable
P3OUT |= UCA0STE; // Setting STE=1
P3OUT &= ~UCA0STE; // Setting STE=0
As soon as I set "P3SEL = 0x31" , SOMI gives High Signal and RXBUF receivers 0xFF in return.
I figured it out that there is a problem with the initialization, therefore, I tried only setting the P3DIR in input or output direction but the moment I make SOMI pin as an input, it starts giving me the high signal. Even tried keeping the STE shorted to ground to always keep it zero, as Slave is active low, still the result is not changing.
Any suggestions or do I need to change the program??