您的位置: OpenADSP社区论坛 -> Blackfin专区 -> 新手上路 -> BF531的SPI DMA问题
本帖共有521个阅读者
发表帖子 发表投票 回复主题
BF531的SPI DMA问题
尊贵身份标志
OpenADSP(管理员)
OpenADSP
头衔:社区公民
帮派:无帮无派
帖数:5195
金钱:34806
积分:6378
注册时间:2011/6/7
楼主信息 | 留言 | Email | 主页 | 编辑 | 管理 | 离线
BF531的SPI DMA问题
BF531的SPI的DMA问题
DMA设定为实际接收字节数时,DMA使能后,总是检测到DMA在运行,也即在数据传送完毕后,DMA还在运行,此时可以检测到当前传送计数已经变为0了,为什么DMA还不停止?另外一个问题,如果把DMA设定计数减少4个的话,DMA就可以停止,为什么?
DMA初始化代码如下:
void InitDMARead(unsigned CHAR * pDstBuf, unsigned int uiNumBytesToRead)
{
    
    // Set destination address for DMA
    *pDMA5_START_ADDR = pDstBuf;
    
    // Set the count to read in the DMA
    *pDMA5_X_COUNT = uiNumBytesToRead;
    *pDMA5_X_MODIFY = 1;

    // Set the DMA Enable bit, Increment Destination, Don’t Increment Source, 8-bit Trasnfers
    *pDMA5_CONFIG = 0x0003;  //DMA enable, 8 bit transfer, write operation
    
    // Initialize the SPI PORT: Slave, 8-bit Xfer, Clock SPI Opposite
    *pSPI_CTL = 0x4412; //spi slave, spi 8 bit, DMA reciever
    
    // DMA is now ready to receive the data...
}

DMA读程序
void FPSGetTESTImage (unsigned CHAR * pDstBuf)
{
    
    // Initialize and enable the DMA engine
    InitDMARead(pDstBuf, 1703);

    // Send "Get TEST Image" command to the sensor
    FPSWriteData(0x82);
    FPSWriteData(0x40); // Enable Operations
    FPSWriteData(0x80);
    FPSWriteData(0x04); // Enable Operations
    FPSWriteData(0x88);
    FPSWriteData(0x02); // change to 32uS column scan
    FPSWriteData(0xA2);
    FPSWriteData(0x02); // Force Finger On (simulate touching)
    FPSWriteData(0x98);
    FPSWriteData(0x2A); // Enable Histogram data
    FPSWriteData(0xAA);
    FPSWriteData(0x10); // image = 31 byte repeating pattern after E0 HEADER:
           FPSWriteData(0xAB);
    FPSWriteData(0x00);
    FPSWriteData(0x81);
    FPSWriteData(0x44); // Request 1 image slice

    //while (*pDMA5_CURR_X_COUNT != 0)
/*    while ((*pDMA5_IRQ_STATUS & DMA_RUN) != 0)
    {
        printD(".");
        printD("%4X\n",*pDMA5_IRQ_STATUS);
        printD("%4X\n",*pDMA5_CURR_X_COUNT);
        ezDelay(1);                
    }
*/

    ezDelay(3);
    printD("%4X\n",*pDMA5_IRQ_STATUS);
    printD("%4X\n",*pDMA5_CURR_X_COUNT);

         *pDMA5_CONFIG = 0x0002;  //DMA disable, 8 bit transfer, write operation
    printD("%4X\n",*pDMA5_IRQ_STATUS);
    // Now the TEST image data is available in the data buffer
}

我是OP...
等级:管理员 参考IP地址:*.*.*.*
2014/8/8 20:13:44
Powered by OpenADSP Copyright © 2010 www.Openadsp.com. All rights reserved.159340 Call, 1 Queries, Processed in 0.019531 second(s),