定时器是这样配置的:
extern GPT_Config MyGptConfig = {
0, //Emulation management register当软件设置断点时,设置成到达断点定时器立即停止
0, /* GPIO interrupt control register配置成定时器时间到达即产生中断,而不是Timer input 1 sources the timer interrupt or event*/
0, //GPIO enable register
0, //GPIO direction register未定义成GPIO模式
0, //GPIO data register同上
0x927B, //Timer period register 1
0x0000, //Timer period register 2
0, //Timer period register 3
0, //Timer period register 4
GPT_GPTCTL1_RMK( //Timer control register 1
GPT_GPTCTL1_TIEN_NOT_GATED,
GPT_GPTCTL1_CLKSRC_VBUS,
GPT_GPTCTL1_ENAMODE_CONTINUOUS,
GPT_GPTCTL1_PWID_INACTIVE_1CYCLE,
GPT_GPTCTL1_CP_CLOCK_MODE, //clock mode
GPT_GPTCTL1_INVIN_DONT_INVERT_OUTPUT,
GPT_GPTCTL1_INVOUT_DONT_INVERT_OUTPUT
),GPT_GPTCTL2_RMK( //Timer control register 2(CTL2 is applicable only when the timer is configured in dual 32-bit timer unchained mode)
GPT_GPTCTL2_TIEN_NOT_GATED,
GPT_GPTCTL2_CLKSRC_VBUS,
GPT_GPTCTL2_ENAMODE_CONTINUOUS,
GPT_GPTCTL2_PWID_INACTIVE_1CYCLE,
GPT_GPTCTL2_CP_CLOCK_MODE,
GPT_GPTCTL2_INVIN_DONT_INVERT_OUTPUT,
GPT_GPTCTL2_INVOUT_DONT_INVERT_OUTPUT
),GPT_GPTGCTL1_RMK( /* Global timer control register _RMK macros make it easier
to construct register values based on field values */
GPT_GPTGCTL1_TDDR34_DEFAULT,
GPT_GPTGCTL1_PSC34_DEFAULT,
GPT_GPTGCTL1_TIMMODE_DEFAULT, //64-bit general-purpose timer
GPT_GPTGCTL1_TIM34RS_NOT_IN_RESET,
GPT_GPTGCTL1_TIM12RS_NOT_IN_RESET
)};
主频300M,这样配置完应该是1/4000s进入一次定时器中断,可是在线调试的时候大概1s进入2050次左右,我想应该是中断优先级配置问题
定时器:
extern void Gpt_init(void)//<<<<<<<<<<<
{
hGpt = GPT_open(GPT_DEV0, GPT_OPEN_RESET);//打开一个GPT设备使用
EventId0 = GPT_getEventId(hGpt);//返回事件ID的GPT设备打开
IRQ_clear(EventId0);
IRQ_plug(EventId0,&GptIsr);//初始化中断矢量表与必要的代码连接到指定的ISR
GPT_config(hGpt, &MyGptConfig);//配置包含GPT设备使用配置结构对应于每个成员GPT寄存器。这些值直接写入相应的GPT device-registers
IRQ_enable(EventId0);
GPT_start(hGpt); //启动定时器
}
DMA:
void DMA_InitialSet()
{
Uint16 srcAddrHi, srcAddrLo;
Uint16 dstAddrHi, dstAddrLo;
srcAddrHi = (Uint16)(((Uint32)(&DRR10)) >> 15) & 0xFFFFu;
srcAddrLo = (Uint16)(((Uint32)(&DRR10)) << 1) & 0xFFFFu;
dstAddrHi = (Uint16)(((Uint32)(&rcv)) >> 15) & 0xFFFFu;
dstAddrLo = (Uint16)(((Uint32)(&rcv)) << 1) & 0xFFFFu;
dmaRcvConfig.dmacssal = (DMA_AdrPtr)srcAddrLo;
dmaRcvConfig.dmacssau = srcAddrHi;
dmaRcvConfig.dmacdsal = (DMA_AdrPtr)dstAddrLo;
dmaRcvConfig.dmacdsau = dstAddrHi;
/* Open DMA channels 4 & 5 and set regs to power on defaults */
hDmaRcv = DMA_open(DMA_CHA0,DMA_OPEN_RESET);
/* Get interrupt event associated with DMA receive and transmit */
DMAId = DMA_getEventId(hDmaRcv); /* Clear any pending interrupts for DMA channels */
IRQ_clear(DMAId);
/* Enable DMA interrupt in IER register */
IRQ_disable(DMAId);
/* Place DMA interrupt service addresses at associate vector */
IRQ_plug(DMAId,&dmaRcvIsr);
/* Write values from configuration structure to MCBSP control regs */
IRQ_enable(DMAId);
/* Write values from configuration structure to DMA control regs */
DMA_config(hDmaRcv,&dmaRcvConfig);
}
可是优先级要怎么改呢??在哪里改?
Shine:
vc5502的中断优先级是固定好的,不能改变,可以看一下数据手册上的32个中断优先级。Table 3-77. Interrupt Tablehttp://www.ti.com/lit/ds/symlink/tms320vc5502.pdf
Cong Wu:
回复 Shine:
好的,那可以在软件设置优先级是吧?
Shine:
回复 Cong Wu:
可以用中断嵌套。