这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » FPGA » F2812 用XINTF让DSP和FPGA通信 求助!!!

共2条 1/1 1 跳转至

F2812 用XINTF让DSP和FPGA通信 求助!!!

菜鸟
2015-11-28 17:25:31     打赏
新手学习F2812DSP  要用XINTF让DSP和FPGA之间通信,接收来自FPGA的四个数据。  我是给这四路数据在DSP XINTF的zone0里面分了地址,通过XINT2下降沿来触发中断从而将来自FPGA的数据读进DSP XINTF的zone0的对应地址。不知道为什么就是检测不到读写时能信号的跳变,也没法正常读数。以下是我的程序以及配置,求大神指导!

//地址分配头文件“EXFPGA.h”
#define ADC0 0x002000
#define ADC1 0x002100
#define ADC2 0x002200
#define ADC3 0x002300


unsigned int ADC0_Data;
unsigned int ADC1_Data;
unsigned int ADC2_Data;
unsigned int ADC3_Data;


nt *ptrADC0;
int *ptrADC1;
int *ptrADC2;
int *ptrADC3;


//XINTF的初始化配置文件“Xintf.c”
void InitXintf(void)
{

    XintfRegs.XINTCNF2.bit.XTIMCLK = 0;
    XintfRegs.XINTCNF2.bit.WRBUFF = 0;
    XintfRegs.XINTCNF2.bit.CLKOFF = 0;
    XintfRegs.XINTCNF2.bit.CLKMODE = 0;


    XintfRegs.XTIMING0.bit.XWRLEAD = 3;
    XintfRegs.XTIMING0.bit.XWRACTIVE = 7;
    XintfRegs.XTIMING0.bit.XWRTRAIL = 3;
    XintfRegs.XTIMING0.bit.XRDLEAD = 3;
    XintfRegs.XTIMING0.bit.XRDACTIVE = 7;
    XintfRegs.XTIMING0.bit.XRDTRAIL = 3;

    XintfRegs.XTIMING0.bit.X2TIMING = 0;

    XintfRegs.XTIMING0.bit.USEREADY = 0;
    XintfRegs.XTIMING0.bit.READYMODE = 0;  

    XintfRegs.XTIMING0.bit.XSIZE = 3;
}

//主程序“read_FPGA_ADC.c”

#include "DSP281x_Device.h"    
#include "DSP281x_System.h"  
#include "EXFPGA_2812.h"

unsigned int    read_ADC_data(void);
interrupt void    XINT_A(void);

void main(void)
{        

   InitSysCtrl();
   DINT;
   InitPieCtrl();
   IER = 0x0000;
   IFR = 0x0000;
   InitPieVectTable();
   InitGpio();
   InitXintf();

   InitXIntrupt();

   EALLOW;
   PieVectTable.XINT2 = &XINT_A;
   EDIS;

   IER |= M_INT1;
   PieCtrlRegs.PIEIER1.bit.INTx5=1;
   EINT;
   ERTM;
   while(1)
}         

unsigned int read_ADC_data(void)
{
        ADC0_Data=*ptrADC0;
        ADC1_Data=*ptrADC1;
        ADC2_Data=*ptrADC2;
        ADC3_Data=*ptrADC3;
}


interrupt void XINT_A(void)
{
        PieCtrlRegs.PIEACK.all=0xFFFF;
        PieCtrlRegs.PIEIFR1.bit.INTx5=0;


        read_ADC_data();


        if((ADC0_Data==0xFF00)&(ADC1_Data==0x00FF)&(ADC2_Data==0xAAAA)&(ADC3_Data==0x5555))//检测读到的数据是否与FPGA发送的约定的数据相同
        {
             GpioDataRegs.GPGTOGGLE.bit.GPIOG4=1;//若数据正确让该引脚翻转
        }
        else
              GpioDataRegs.GPGTOGGLE.bit.GPIOG4=0;

}



关键词: FPGA    

专家
2016-02-17 08:39:20     打赏
2楼
F2812 用XINTF让DSP和FPGA通信

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]