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问题

Other Parts Discussed in Thread: MSP430F5438A

void spi_init()

 {  

   P3SEL |= BIT0 + BIT1 + BIT2 + BIT3;                          // 功能复用,使用UCB0

   P3DIR |=BIT0 + BIT1 + BIT3;                               //P3.0,1,3为输出  

   UCB1CTL1 |= UCSWRST;                                  // 复位

   UCB1CTL0 |=  UCMST + UCSYNC + UCMODE1 + UCCKPH + UCMSB;       //上升沿发送数据,MSB,四线主机,同步

   UCB1CTL1 |= UCSSEL_2;                                 // SMCLK

   UCB1BR0 =2;               

   UCB1BR1 = 0;                           

   UCB1CTL1 &= ~UCSWRST;                                 // **Initialize USCI state machine**  

   UCB0IE |= UCRXIE;

}

   

void DAC_Reg_Write (unsigned char reg_address)//写一个寄存器
{


P3OUT&= ~BIT0; // 拉低STE


while (!(UCB0IFG&UCTXIFG));                           // USCI_B0 TX buffer ready?

UCB0TXBUF = reg_address;                                              // 发送需要写入的寄存器地址
while (!(UCB0IFG&UCTXIFG));                             // USCI_B0 TX buffer ready?


__delay_cycles(40);

P3OUT|=BIT0; // 写入完成,拉高STE
}

问题是,spi初试化后STE始终是低电平输出,SCLK始终没有始终输出,而且,P3.0片选信号根本就没办法拉高