用示波器测的ARM向字库芯片发送数据时SCLOCK和MOSI信号正确,但是接收时SCLOCK和MISO没信号,请问是什么问题? GPIO_Config(GPIO0, 0x0077, GPIO_AF_PP); //Configure GPI00 on mode Alternate function Push Pull GPIO_Config(GPIO2, 0x8000,GPIO_OUT_PP); GPIO_BitWrite(GPIO2, 15,1); BSPI_BSPI0Conf(ENABLE); //Enable the BSPI0 interface
//------------------------------------------- //Configure BSPI0 as a Master //-------------------------------------------
BSPI_Init(BSPI0); //Initialize BSPI0 BSPI_ClockDividerConfig(BSPI0, 6); //Configure Baud rate Frequency: ---> APB1/6 BSPI_Enable(BSPI0, ENABLE); //Enable BSPI0 BSPI_MasterEnable(BSPI0, ENABLE); //Configure BSPI0 as a Master BSPI_ClkActiveHigh(BSPI0, ENABLE); //Configure the clock to be active high BSPI_ClkFEdge(BSPI0, DISABLE); //Enable capturing the first Data sample on the first edge of SCK BSPI_8bLEn(BSPI0, ENABLE); //Set the word length to 16 bit BSPI_TrFifoDepth(BSPI0, 7); //Configure the depth of transmit to 7 words pTxBuffer = bArray; //Point on the word to transit
//------------------------------------------- //Configue BSPI1 as a Slave //-------------------------------------------
BSPI_Init(BSPI1); //Initialize BSPI1 BSPI_ClockDividerConfig(BSPI1, 8); //Configure Baud rate Frequency :-->APB1/8 BSPI_Enable(BSPI1, ENABLE); //Enable BSPI1 BSPI_MasterEnable(BSPI1, DISABLE); //Configure BSPI0 as a Slave BSPI_ClkActiveHigh(BSPI1, ENABLE); //Configure the clock to be active high BSPI_ClkFEdge(BSPI1, DISABLE); //Enable capturing the first Data sample on the first edge of SCK BSPI_8bLEn(BSPI1, ENABLE); //Set the word length to 16 bit BSPI_RcFifoDepth(BSPI1, 5); //Configure the depth of receive to 5 word
//--------------------------------------------- //Send five words of buffer ---> BSPI0 //---------------------------------------------
get_zm(); //BSPI_BufferSend(BSPI0, pTxBuffer, 5);
while(1) { GPIO_BitWrite(GPIO2, 15,0); BSPI_BufferSend(BSPI0,ZiKu_Command, 5); //5 //BSPI_MasterEnable(BSPI0, DISABLE); BSPI_BufferReceive(BSPI0, pRxBuffer, 8); //8 GPIO_BitWrite(GPIO2, 15,1); //BSPI_MasterEnable(BSPI0, ENABLE); for(k=0;k<8000;k++); // for(i=0;i<8;i++) // test=*pRxBuffer++; } |