Hello,
In the experiment board I want to send SPI message from UCB1 to UCB0.
UCB0 is configured as SPI slave with the following code:
P3SEL |= BIT1; // P3.1 UCB0SIMO (Slave in, master out – USCI_B0 SPI mode)
P3SEL |= BIT2; // P3.2 UCB0SOMI (Slave out, master in – USCI_B0 SPI mode)
P3SEL |= BIT3; // P3.3 UCB0CLK (Clock in\out)
UCB0CTL1 |= UCSWRST; // **Put state machine in reset**
UCB0CTL0 |= UCSYNC+UCCKPL+UCMSB; // 3-pin, 8-bit SPI slave, Clock polarity high, MSB
UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCB0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
UCB1 is configured as SPI master with the following code:
P3SEL |= BIT7; // P3.7 UCB1SIMO (Slave in, master out – USCI_B1 SPI mode)
P5SEL |= BIT4; // P5.4 UCB1SOMI (Slave out, master in – USCI_B1 SPI mode)
P5SEL |= BIT5; // P5.5 UCB1CLK (Clock in\out)
UCB1CTL1 |= UCSWRST; // Put state machine in reset**
UCB1CTL0 |= UCMST+UCSYNC+UCCKPL+UCMSB; // 3-pin, 8-bit SPI master, Clock polarity high,MSB
UCB1CTL1 |= UCSSEL_2; // SMCLK
UCB1BR0 = 0x02; // /2
UCB1BR1 = 0; //
UCB1CTL0 = 0; // No modulation
UCB1CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
Then I tried to send one byte from UCB1 to UCB0 with:
while (!(UCB1IFG&UCTXIFG));
UCB1TXBUF = 5;
But the MCU hangs in the "while" line.
The wires on the board are connected in the following way:
Port x,y RF3
P3.7 (UCB1SIMO) P3.2 (15, UCB0SOMI)
P5.4 (UCB1SOMI) P3.1 (18, UCB0SIMO)
P5.5 (UCB1CLK) P3.3 (16, UCB0CLK)
Can you tell what am I doing wrong ?
Thank you in advance,
Z.V
P5.4Pdklfklfkldfioprio