您的位置: OpenADSP社区论坛 -> Blackfin专区 -> 技术讨论区 -> adsp707  spi通信dma模式,出错
本帖共有552个阅读者
发表帖子 发表投票 回复主题
adsp707 spi通信dma模式,出错
yao(论坛新手)
yao
头衔:社区公民
帮派:无帮无派
帖数:3
金钱:131
积分:5
注册时间:2017/8/23
楼主信息 | 留言 | Email | 主页 | 编辑 | 管理 | 离线
adsp707 spi通信dma模式,出错
adsp707  spi通信dma模式,按照cces里的demo写的程序。但是示波器测量没有clock。除了下面红色部分,还要做哪些配置吗?



    /* driver API result code */
ADI_SPI_RESULT result;

/* transceiver buffers */
uint8_t Prologue[3]  = {0xFC, 0xFF};
uint8_t TxBuffer[8]  = {0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x02, 0x03};
uint8_t RxBuffer[8];

/* transceiver configurations */
ADI_SPI_TRANSCEIVER Transceiver1  = {&Prologue[0], 4, &TxBuffer[0], 8, &RxBuffer[0], 8};
ADI_SPI_TRANSCEIVER Transceiver2  = {Prologue,      2, NULL, 0,RxBuffer ,        2 };

/* Initialize managed drivers and/or services */
adi_initComponents();
//ConfigSoftSwitches();
    /* open the SPI driver */
    result = adi_spi_Open(SPI_DEVICE_NUM, SPIDriverMemory, (uint32_t)ADI_SPI_DMA_MEMORY_SIZE, &hDevice);
    printf("------adi_spi_Open  %d----\n",result);

    /*
     * Use the driver API's to configure SPI
     */
   ConfigureDevice();


    /* Register a callback for the DMA */
result = adi_spi_RegisterCallback(hDevice, NULL, NULL);
printf("------adi_spi_RegisterCallback  %d----\n",result);
    /* Enable DMA */
result = adi_spi_EnableDmaMode(hDevice, true);
printf("------adi_spi_EnableDmaMode  %d----\n",result);
    /* submit the SPI transceiver's buffers */
result = adi_spi_SubmitBuffer(hDevice, &Transceiver1);
printf("------adi_spi_SubmitBuffer  %d----\n",result);
result = adi_spi_SubmitBuffer(hDevice, &Transceiver2);
printf("------adi_spi_SubmitBuffer  %d----\n",result);
    while(!bComplete)
    {

    }

/* close the SPI driver */
result = adi_spi_Close(hDevice);

    return 0;



/* Configure the SPI device for test */
uint32_t ConfigureDevice(void)
{
uint32_t Result = 0u;

    if (Result == 0u)
{
       /* device in master of the SPI interface */
   Result = (uint32_t)adi_spi_SetMaster(hDevice, true);
}
    if (Result == 0u)
{
       /* SPI slave select in controlled by software not hardware */
   Result = (uint32_t)adi_spi_SetHwSlaveSelect(hDevice, false);
}

    if (Result == 0u)
{
     /* data transitions on falling edge of clock */
     Result = (uint32_t)adi_spi_SetClockPhase(hDevice, false);


}
    if (Result == 0u)
{
     /* SPI clock is SCLK divided by 1000 + 1 */
     Result = (uint32_t)adi_spi_SetClock(hDevice, 1000u);
}
    if (Result == 0u)
{
     /* SPI slave select is on SPI slave select 1 pin */
     Result = (uint32_t)adi_spi_SetSlaveSelect(hDevice, ADI_SPI_SSEL_ENABLE2);
}
    if (Result == 0u)
{
     /* SPI data transfers are 8 bit */
     Result = (uint32_t)adi_spi_SetWordSize(hDevice, ADI_SPI_TRANSFER_8BIT);
}

return Result;
}



这家伙很懒,什么也没有留下!
等级:论坛新手 参考IP地址:*.*.*.*
2017/8/23 10:25:11
尊贵身份标志
OpenADSP(管理员)
OpenADSP
头衔:社区公民
帮派:无帮无派
帖数:5187
金钱:34761
积分:6369
注册时间:2011/6/7
1信息 | 留言 | Email | 主页 | 编辑 | 管理 | 离线
没做过,不太清楚,我们一般都是自己配寄存器,CCES里的demo没怎么用。

我是OP...
等级:管理员 参考IP地址:*.*.*.*
2017/8/23 11:23:41
yao(论坛新手)
yao
头衔:社区公民
帮派:无帮无派
帖数:3
金钱:131
积分:5
注册时间:2017/8/23
2信息 | 留言 | Email | 主页 | 编辑 | 管理 | 离线
spi dma模式的寄存器配置方法能发给例子给我参考一下吗?谢谢

这家伙很懒,什么也没有留下!
等级:论坛新手 参考IP地址:*.*.*.*
2017/8/23 11:28:34
尊贵身份标志
OpenADSP(管理员)
OpenADSP
头衔:社区公民
帮派:无帮无派
帖数:5187
金钱:34761
积分:6369
注册时间:2011/6/7
3信息 | 留言 | Email | 主页 | 编辑 | 管理 | 离线
我们没有这方面的例程

我是OP...
等级:管理员 参考IP地址:*.*.*.*
2017/8/23 17:42:27
Powered by OpenADSP Copyright © 2010 www.Openadsp.com. All rights reserved.154169 Call, 1 Queries, Processed in 0.031250 second(s),