你好!MSP430FR5739 SPI 4线制无法工作,3线制测试是没问题,改了4线制后(P2SEL1 和UCMODE0), 就不能工作,也不能进行中断,请问是什么原因,谢谢!代码如下:
P1SEL1 |= BIT5;//+BIT4;
P2SEL1 |= BIT0 + BIT1;
P2SEL1 |= BIT4 + BIT5+ BIT6+ BIT3;
UCA0CTLW0 |= UCSWRST; // **Put state machine in reset** (0x0001u)
UCA0CTLW0 |= UCSYNC+UCCKPL+UCMSB+UCMODE0; // 4-pin, 8-bit SPI slave (0x0100u) (0x4000u) (0x2000u)
// Clock polarity high, MSB
UCA0CTLW0 |= UCSSEL_2; // SMCLK 2MHZ (0x0080u)
UCA0BR0 = 0x02; // /2
UCA0BR1 = 0; //
UCA0MCTLW = 0; // No modulation
UCA0CTLW0 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = UCA0RXBUF-0x01; // Echo received data
_NOP();
}