芯片用的是PIC24FJ128GA306
SPI初始化代码如下:
void SPI1_Initialize(void) {
// SPI Frequency = 8,000,000 Hz; SSEN disabled; PPRE 1:1; SMP Sample at Middle; MSTEN enabled; MODE16 disabled; DISSCK disabled; SPRE 2:1; CKE Idle to Active; DISSDO disabled; CKP Idle:High, Active:Low;
SPI1CON1 = 0x007B;
// SPIFSD disabled; SPIFPOL disabled; SPIBEN enabled; SPIFE disabled; FRMEN disabled;
SPI1CON2 = 0x8001;
// SISEL SPI_INT_SPIRBF; SPIEN enabled; SPISIDL disabled; SPIROV disabled;
SPI1STAT = 0x800C;
}
波形如下(CH1为SDO,CH2为NSS):
CH1为SDO,CH2为NSS
为什么NSS在数据还没发送完毕就被拉高了,折腾了N久,求大神指教
此帖出自
小平头技术问答
一周热门 更多>