基于EDMA可以实现pingpong缓存,从而实现ADC的连续不断的采样。但主要用于ADC采样的uPP接口使用的是专用的DMA控制器,而不是EDMA。由此得一个问题,使用uPP接口是否可实现ADC连续不断的采样?
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.
附件里的upp例程里有。
for(i = 1; i < 1464843; i++)
{
UPP->UPQD0 = (uint32_t)&xmit_buffer;//add next DMA transfer
UPP->UPQD1 = 0x00010080; //1 lines 128 bytes per line
UPP->UPQD2 = 0x00000080; //no offset between lines
while(UPQS2r->bits.PEND == 1){};
}
你好Tony Tang ,
我的程序是这样写的:
UARTPuts("ping\n",-2);
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_ping;
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(upp_buffer_ping[0]);
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(upp_buffer_ping[0]);
UARTPuts("pong\n",-2);
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_pong;
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(upp_buffer_pong[0]);
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(upp_buffer_pong[0]);
我是想让这两个buffer连续接收FPGA端发送的数据(目前数据是自己造的,0-32766,循环发送),即upp_buffer_ping接收0-1023,upp_buffer_pong可以继续接收后面的数据1024-2048。但实际上,两个buffer都是接收的0-1023,这是什么原因呢?
你好,听了您的建议加了pend位判断,问题得到改善,原来是我的判断语句写成了1,现在改成了2: while((upp_reg_hdl->UPIS2 & CSL_UPP_UPIS2_PEND_MASK) == 2){UARTPuts("p\n",-2);};
现在
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_test[pingpong_buffer_num];
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Uint16);
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(upp_buffer_ping[0]);
while((upp_reg_hdl->UPIS2 & CSL_UPP_UPIS2_PEND_MASK) == 2){UARTPuts("p\n",-2);};
// UARTPuts("ping\n",-2);
pingpong_buffer_num = ++pingpong_buffer_num;
upp_reg_hdl->UPID0 = (Uint32)upp_buffer_test[pingpong_buffer_num];
upp_reg_hdl->UPID1 = ((Uint32)upp_line_count << 16) | (Uint32)upp_line_size*sizeof(Uint16);
upp_reg_hdl->UPID2 = (Uint32)upp_line_offset*sizeof(upp_buffer_ping[0]);
while((upp_reg_hdl->UPIS2 & CSL_UPP_UPIS2_PEND_MASK) == 2){UARTPuts("g\n",-2);};
这样执行下来没问题,但是对以上程序段做一个循环,因为我的程序中有一个中断处理函数,循环后每执行一次DMA都会进入一次中断服务函数,似乎因为这样耽误了时间,导致upp_buffer_test[pingpong_buffer_num];中每个upp_buffer_test[]之间的数据不连续了,例如:upp_buffer_test[0][254]=47666,upp_buffer_test[0][255]=47667,upp_buffer_test[1][0]=5519,upp_buffer_test[1][1]=5520 。为什么这样说呢,因为我将程序中的中断换成了空体中断,执行时间短了,两个test之间的数据间隔也小了好多。可是如果不加一个中断像这样
void UPPInterruptInit(void)
{
// Initialize interrupt
upp_int_enable(upp_isr_bit_eoli);
upp_int_enable(upp_isr_bit_eowi);
// IntRegister(C674X_MASK_INT5,uPPIsr); //注释掉中断
IntEventMap(C674X_MASK_INT5, SYS_INT_UPP_INT);
IntEnable(C674X_MASK_INT5);
}
程序就停在第二个PEND位检测处了。如果不调用这个UPP中断初始化函数,接收到的数据也不是连续的。
我看到您给我的测试程序并没有类似的中断处理函数,那您是怎样做到的呢?