打印

STR710的SPI驱动字库芯片时的问题

[复制链接]
1270|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
fmc|  楼主 | 2008-8-12 16:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
用示波器测的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++;
}

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

fmc

10

主题

12

帖子

0

粉丝