请问28335中的DMA如何触发OVERFLG位,试了好多种方法都没有触发,也没有检测到该位置1。有没有知道的大神帮忙解决一下,或者提个思路。之前的思路是使用Timer0来触发DMA传送,然后设置burst_size为1023;timer0使用的是最小的周期,匹配的值为1;该触发方式相信已经很快了,我认为可以在传输FLAG置位以后的很短时间内(即burst传输开始前,或FLAG未清零前)再次给DMA传输中断信号,使其产生中断溢出,从而置位OVERFLG,但是没有发生这样的溢出。将DMA配置为溢出中断方式,也没有进入其中断,期间DMA传输照常进行,DMA传输完成中断照常进入。
就很迷,不会触发这个OVERFLG位。
附上源代码:
//###########################################################################
//
// Included Files
//
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
//
// Defines
//
#define BUF_SIZE 1024 // Sample buffer size
#pragma DATA_SECTION(DMABuf0,"DMARAML4");
#pragma DATA_SECTION(DMABuf1,"DMARAML5");
#pragma DATA_SECTION(DMABuf2,"DMARAML6");
volatile Uint16 DMABuf0[BUF_SIZE];
volatile Uint16 DMABuf1[BUF_SIZE];
volatile Uint16 DMABuf2[BUF_SIZE];
volatile Uint16 num1=0;
volatile Uint16 num2=0;
//
// Functions Prototypes
//
__interrupt void local_DINTCH1_ISR(void);
__interrupt void local_DINTCH2_ISR(void);
__interrupt void local_DINTCH3_ISR(void);
__interrupt void local_DINTCH4_ISR(void);
__interrupt void local_DINTCH5_ISR(void);
__interrupt void local_DINTCH6_ISR(void);
//
// Main
//
void main(void)
{
Uint16 i;
//
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP2833x_SysCtrl.c file.
//
InitSysCtrl();
//
// Step 2. Initialize GPIO:
// This example function is found in the DSP2833x_Gpio.c file and
// illustrates how to set the GPIO to it's default state.
//
// InitGpio(); // Skipped for this example
//
// Step 3. Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
//
DINT;
//
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the DSP2833x_PieCtrl.c file.
//
InitPieCtrl();
//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
IER = 0x0000;
IFR = 0x0000;
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in DSP2833x_DefaultIsr.c.
// This function is found in DSP2833x_PieVect.c.
//
InitPieVectTable();
//
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
//
EALLOW; // Allow access to EALLOW protected registers
PieVectTable.DINTCH1= &local_DINTCH1_ISR;
EDIS; // Disable access to EALLOW protected registers
IER = M_INT7 ; //Enable INT7 (7.1 DMA Ch1)
EnableInterrupts();
CpuTimer0Regs.TCR.bit.TSS = 1; //Stop Timer0 for now
//
// Step 5. User specific code, enable interrupts:
//
//
// Initialize DMA
//
DMAInitialize();
//
// Initialize Tables
//
for (i=0; i<BUF_SIZE; i++)
{
DMABuf0 = 1;
DMABuf1 = i;
DMABuf2 = i*10+1;
}
//
// Configure DMA Channel
//
////////CH1///////
DMACH1AddrConfig(&DMABuf0[0],&DMABuf1[0]);
DMACH1BurstConfig(1023,1,1);
DMACH1TransferConfig(31,1,1);
DMACH1WrapConfig(0XFFFF,0,0XFFFF,0);
DMACH1ModeConfig(DMA_TINT0,PERINT_ENABLE,ONESHOT_DISABLE,CONT_DISABLE,
SYNC_DISABLE,SYNC_SRC,OVEFLOW_ENABLE,SIXTEEN_BIT,
CHINT_END,CHINT_ENABLE);
//
//Init the timer 0
// load low value so we can start the DMA quickly
//
//CpuTimer0Regs.TIM.all = 1;
CpuTimer0Regs.PRD.all=1;
CpuTimer0Regs.TCR.bit.SOFT = 1; //Allow to free run even if halted
CpuTimer0Regs.TCR.bit.FREE = 1;
CpuTimer0Regs.TCR.bit.TIE = 1; //Enable the timer0 interrupt signal
CpuTimer0Regs.TCR.bit.TRB = 1;
CpuTimer0Regs.TCR.bit.TSS = 0; //restart the timer 0
// load low value so we can start the DMA quickly
//
//EALLOW;
//DmaRegs.PRIORITYCTRL1.bit.CH1PRIORITY=1;
StartDMACH1();
for(;;)
{
if(DmaRegs.CH1.CONTROL.bit.OVRFLG==1)
__asm (" ESTOP0");
//num2++;
};
}
//
// local_DINTCH1_ISR - INT7.1(DMA Channel 1)
//
__interrupt void
local_DINTCH1_ISR(void)
{
if(DmaRegs.CH1.CONTROL.bit.OVRFLG==1)
__asm (" ESTOP0");
//
//
// Next two lines for debug only to halt the processor here
// Remove after inserting ISR Code
__asm (" ESTOP0");
for(;;);
}
|