This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DSP与FPGA数据通过UPP传输问题

我想实现的功能就是通过GP8_9提供信号通知FPGA,然后FPGA反馈一个GP8_8信号进入中断,利用UPP进行数据的接收。下面是部分代码,但是一直是没法正常的接收数据,我想问下具有什么原因,请教TI大神帮我分析分析,卡了好几天了。我代码中UPP初始化了两次是不是有问题
main()
{
     int  target_int_count=1;
       open_int();                                                 //打开中断                       
	UPID0  =   (unsigned int)&fpga8way; //Window Address
	UPID1  =   0x00028000; //Line Count,Byte Count
	UPID2  =   0x00008000; //Line Offset Address
	while(UPIS2 & 0x2){};

	GPIO_OUT_DATA8 &=(0<<9);
	for(i=0;i<1000;i++);
	GPIO_OUT_DATA8 |=(1<<9);                    //通过gp8_9信号给FPGA让其反馈gp8_8外部中断信号
while(upp_interrupt_count_1<target_int_count)                             //upp_interrupt_count_1表示是否接收完成,完成赋值1                                                   
	{
		//asm(" nop");
		if(flag_8way==1)                                                                //flag_8way置1代表的是进入了中断     if{}体内的代码是由于有的时候不能够正常的接收到数据重新再发送一次GP8_9信号,再进行接收数据,如果upp_interrupt_count_1计数为1则跳出循环表示成功接收到数据
		{
			UPP_init();
			UPID0  =   (unsigned int)&fpga8way; //Window Address
			UPID1  =   0x00028000; //Line Count,Byte Count
			UPID2  =   0x00008000; //Line Offset Address
			while(UPIS2 & 0x2){};
			//delay(1000000);
			printf("delay1000\n");
			GPIO_OUT_DATA8 &=(0<<9);
			for(i=0;i<1000;i++);
			GPIO_OUT_DATA8 |=(1<<9);
		}
	}
}

 
void UPP_init()
{

	UPPCR = 0x00000010;                        //复位 Set the SWRST bit in the uPP peripheral control register (UPPCR) to 1
	sw_wait(300);   //Wait at least 200 device clock cycles
	UPPCR = 0;                           //复位结束
	UPCTL = 0x02020006;     //16位数据,CHA收,CHB发
	//UPICR = 0X21000100;                 //uppCLK=300/2=150Mhz   I/O_clk=150/2/(CLKDIVB + 1)=75Mhz  //Channel B data pins are in a high-impedance state while idle(29 bit)
	UPICR = 0X053f051f;      
	UPIVR = 0x10000000;    //0x10000000    4096
	UPTCR = 0;                    //64byte DMA bursts read / write
	UPDLB=0;
	UPIES = 0X00001818;                      
	UPPCR = 0x0000000e;                //使能UPP
}
interrupt void serv_upp(void)
{
	interrupt_status = UPIER;
	while (interrupt_status != 0)
	{
		if (interrupt_status & 0x0010 )//EOLI
		{
			UPIER |= 0x10; // clear EOLI
		}
		if (interrupt_status & 0x0008)//EOWI
		{
			UPIER |= 0x0008;// clear EOWI
			upp_interrupt_count_1++;

		}
		if (interrupt_status & 0x0004)//ERRI
		{
			UPIER |= 0x0004; // clear ERRI
			upp_error_count++;
		}
		if (interrupt_status & 0x0002)//UORI
		{
			UPIER |= 0x0002; // clear UORI
			upp_error_count++;
		}
		if (interrupt_status & 0x0001)//DPEI
		{
			UPIER |= 0x0001; // clear DPEI
			upp_error_count++;
		}
		if (interrupt_status & 0x1000)//EOLQ
		{

			UPIER |= 0x1000; // clear EOLQ
		}
		if (interrupt_status & 0x0800)//EOWQ
		{
			UPIER |= 0x0800; // clear EOWQ
			upp_interrupt_count++;
		}
		if (interrupt_status & 0x0400)//ERRQ
		{
			UPIER |= 0x0400; // clear ERRQ
			upp_error_count++;
		}
		if (interrupt_status & 0x0200)//UORQ
		{
			UPIER |= 0x0200;// clear UORQ
			upp_error_count++;
		}
		if (interrupt_status & 0x0100)//DPEQ
		{
			UPIER |= 0x0100; // clear DPEQ
			upp_error_count++;
		}
		// loop again if any interrupts are left
		interrupt_status = UPIER;
	} // end of while
	// write end of interrupt vector to allow future calls
	UPEOI = 0;
} // end of function
interrupt void gpio8_8(void)                                 //触发中断信号由FPGA提供
{
	printf("gpio8_8 falling singal received\n");
	flag_8way=1;
}
  • 那个  UPID1的行数为1的时候有时候是可行的,但是改成其他的行没成功过,不知道是什么问题。

             UPID1 = 0x00028000; //Line Count,Byte Count

    	UPID2  =   0x00008000; //Line Offset Address
    	while(UPIS2 & 0x2){};
    
  • 每次都只能接收到一行,导致没办法进入UPP中断upp_interrupt_count_1无法计数,我想问下是什么原因

  • 请问问题解决了没有?我也有类似的疑问.

    我想问:ByteCount的值除了必须是偶数外还有其他的限制吗?

    EDMA3是三维的计数器acount、bcount、ccount. 其中如果使用EDMA3的外设比如I2C没有FIFO,那么acount设为1才行。upp的FIFO和ByteCount的值有没有什么联系?

  • Tong xie 说:
    upp的FIFO和ByteCount的值有没有什么联系?

    没有联系.

    Tong xie 说:
    其中如果使用EDMA3的外设比如I2C没有FIFO,那么acount设为1才行

    是的.

  • qiqi michal 说:
    每次都只能接收到一行,导致没办法进入UPP中断upp_interrupt_count_1无法计数,我想问下是什么原因

    你的中断服务程序里只对end of window中断进了计数,没对end of line中断计数。end of window本来就只有一次。

    while (interrupt_status != 0)
        {
            if (interrupt_status & 0x0010 )//EOLI
            {
                UPIER |= 0x10; // clear EOLI
            }
            if (interrupt_status & 0x0008)//EOWI
            {
                UPIER |= 0x0008;// clear EOWI
                upp_interrupt_count_1++;
            }
            if (interrupt_status & 0x0004)//ERRI
            {
                UPIER |= 0x0004; // clear ERRI
                upp_error_count++;
            }
            if (interrupt_status & 0x0002)//UORI
            {
                UPIER |= 0x0002; // clear UORI
                upp_error_count++;
            }
            if (interrupt_status & 0x0001)//DPEI
            {
                UPIER |= 0x0001; // clear DPEI
                upp_error_count++;
            }
            if (interrupt_status & 0x1000)//EOLQ
            {
                UPIER |= 0x1000; // clear EOLQ
            }
            if (interrupt_status & 0x0800)//EOWQ
            {
                UPIER |= 0x0800; // clear EOWQ
                upp_interrupt_count++;
            }
  • 对end of line中断不用计数吧? Q通道不是也有end of window吗?应该计数为2才对啊?我也有这个问题
  • 一个是行中断,一个是窗口中断,看你对哪个进行识别了,都可以的

  • 我想了解下,关于UPP 初始化的函数全部都是您自己对寄存器进行配置的吗,我在学习的时候使用的开发板是库函数的,用不惯,所以想咨询下,谢谢
  • 用现成的比价方便吧,自己配置比较麻烦,还容易出错