In my project I have:
- SPI (for the work with SD card): configured for USCI_A0;
- I2C (CC430 - how master, it configures TLV320AIC3254): configured for USCI_B0;
- I2S(through SPI mode) (CC430 - how slave of the TLV320AIC3254 for receiving audio): configured for USCI_B0 (after work with I2C).
This configuration is wrong, because "UCA0CLK function takes precedence over UCB0STE function".
I am going to configure I2S in "ASI Hybrid Modes" (BCLK is input and WCLK is output). Do anyone that?
But now, I simply try to receive any data from the codec with help of USCI_B0:
//================================== code ===========================================//
__disable_interrupt();
PMAPPWD = 0x02D52; // Get write-access to port mapping regs
PMAPCTL |= PMAPRECFG; //Enable reconfig during runtime
P3MAP5 = PM_UCB0SOMI; // Map UCB0SIMO output to P2.0
P3MAP4 = PM_UCB0SIMO; // Map UCB0SOMI output to P2.2
P3MAP3 = PM_UCB0CLK; // Map UCB0CLK output to P2.4
P3MAP2 = PM_UCB0STE; // Map UCB0CLK output to P2.4
PMAPPWD = 0; // Lock port mapping registers
P3DIR |= BIT2;
P3DIR |= BIT3;
P3DIR |= BIT4; // ACLK, MCLK, SMCLK set out to pins
P3DIR |= BIT5; // ACLK, MCLK, SMCLK set out to pins
P3SEL |= BIT2;
P3SEL |= BIT3;
P3SEL |= BIT4; // P2.0,2,4 for debugging purposes.
P3SEL |= BIT5; // P2.0,2,4 for debugging purposes.
UCB0CTL1 |= UCSWRST; // **Put state machine in reset**
UCB0CTL0 = UCSYNC | UCCKPL | UCMSB | CS; // 4-pin, 8-bit SPI slave, CS = 0 - active;
// Clock polarity high, MSB
UCB0BR0 = 0x02; // /2 (for slave doesn't mean anything)
UCB0BR1 = 0; //
UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCB0IE |= UCRXIE;
__bis_SR_register(GIE);
//================================== code ===========================================//
In the interrupt I receive only 0xFF values, but when I reconfigure I2S for USCI_A0:
//================================== code ===========================================//
__disable_interrupt();
PMAPPWD = 0x02D52; // Get write-access to port mapping regs
PMAPCTL |= PMAPRECFG; //Enable reconfig during runtime
P3MAP5 = PM_UCA0SOMI; // Map UCA0SIMO output to P2.0
P3MAP4 = PM_UCA0SIMO; // Map UCA0SOMI output to P2.2
P3MAP3 = PM_UCA0CLK; // Map UCA0CLK output to P2.4
P3MAP2 = PM_UCA0STE; // Map UCA0CLK output to P2.4
PMAPPWD = 0; // Lock port mapping registers
P3DIR |= BIT2;
P3DIR |= BIT3;
P3DIR |= BIT4; // ACLK, MCLK, SMCLK set out to pins
P3DIR |= BIT5; // ACLK, MCLK, SMCLK set out to pins
P3SEL |= BIT2;
P3SEL |= BIT3;
P3SEL |= BIT4; // P2.0,2,4 for debugging purposes.
P3SEL |= BIT5; // P2.0,2,4 for debugging purposes.
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL0 = UCSYNC | UCCKPL | UCMSB | CS; // 4-pin, 8-bit SPI slave, CS = 0 - active;
// Clock polarity high, MSB
UCA0BR0 = 0x02; // /2 (for slave doesn't mean anything)
UCA0BR1 = 0; //
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
__delay_cycles(100); // Wait for slave to initialize
UCA0IE |= UCRXIE;
__bis_SR_register(GIE);
//================================== code ===========================================//
After that codec send to me some data properly.
What are the differences between USCI_A0 and USCI_B0?
Why they work differently?