This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5438A的SPI使用UCB0相关例程

Other Parts Discussed in Thread: MSP430F5438A

MSP430F5438A的SPI使用UCB0,官方没有参考代码,我们自己写的,CLK没有时钟信号输出,请问UCB SPI到底改如何操作?

以下是我们当前初始化SPI代码

P3SEL |= 0x0E; // P3.1,2,3 SPI option select
UCB0CTL1 |= UCSWRST ; // 复位SPI状态机
UCB0CTL0 &= ~(UCCKPH + UCCKPL + UC7BIT + UCMSB + UCMST + UCMODE_3 + UCSYNC);

UCB0CTL1 &= ~(UCSSEL_3);
UCB0CTL1 |= UCSSEL__SMCLK ; // 选择SCK参考源为SMCLK
UCB0BR0 = 0x02; // /2
UCB0BR1 = 0; //

UCB0CTL0 |= UCMST+UCSYNC+UCCKPL+UCMSB + UCMODE_0 ; // 3-pin, 8-bit SPI master, Clock polarity high, MSB

UCB0CTL1 &=~UCSWRST ; // SPI状态机使能
UCB0IE |= UCRXIE; // Enable USCI_B0 RX interrupt

//Wait for slave to initialize
__delay_cycles(100);


__bis_SR_register( GIE); // CPU off, enable interrupts