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.
根据TMS320F280039C的用户手册,若需要使用将DMA进行ping-pong配置,推荐在DMA转换开始时就产生中断。并且会在幅值给shadow寄存器后产生。
那如果在中断函数中进行地址的重新配置(从buffer1换为buffer2),那么地址配置的生效时间是本次DMA传输还是下一次DMA传输呢?
结合例程dma_lp_f28003x所给出的事例,在DMA中断函数中,执行的逻辑更像是DMA地址配置立即生效(因为此时在PingPongState == 0时,CPU在搬运buffer2中的数据,DMA地址配置为buffer1)
interrupt void dma_Ch1ISR(void)
{
// Clear the interrupt flags.
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP7);
// Start and reload the timer.
CPUTimer_startTimer(myCPUTIMER0_BASE);
uint16_t *AdcBufPtr = AdcBuf;
uint16_t *AdcBufRawPtr;
uint16_t i;
// Blink LED at about 1Hz. ISR is occurring every 1ms.
if (LedCtr++ >= 1000) {
GPIO_togglePin(myBoardLED0_GPIO);
LedCtr = 0;
}
if (PingPongState == 0) {
// Set DMA address to start at ping buffer.
DMA_configAddresses(DMA_CH1_BASE,
(const void *)AdcBufRaw,
(const void *)(ADCARESULT_BASE + ADC_O_RESULT0));
// Fill AdcBuf with contents of the pong buffer.
AdcBufRawPtr = AdcBufRaw + ADC_BUF_LEN;
for (i = 0; i < ADC_BUF_LEN; i++) {
*(AdcBufPtr++) = *(AdcBufRawPtr++);
}
} else {
// Set DMA address to start at pong buffer.
DMA_configAddresses(DMA_CH1_BASE,
(const void *)(AdcBufRaw + ADC_BUF_LEN),
(const void *)(ADCARESULT_BASE + ADC_O_RESULT0));
// Fill AdcBuf with contents on the ping buffer.
AdcBufRawPtr = AdcBufRaw;
for (i = 0; i < ADC_BUF_LEN; i++) {
*(AdcBufPtr++) = *(AdcBufRawPtr++);
}
}
// Toggle PingPongState.
PingPongState ^= 1;
// Delay to simulate more data processing.
for (i = 0; i < TaskDelayUs; i++) {
DEVICE_DELAY_US(1);
}
// Get the time stamp and check to see if interrupt completed within the
// required time frame of 1ms. Don't worry about overflows.
CPUTimer_stopTimer(myCPUTIMER0_BASE);
TimDiff = 0xFFFFFFFF - CPUTimer_getTimerCount(myCPUTIMER0_BASE);
if (TimDiff >= ((uint32_t)(0.001*DEVICE_SYSCLK_FREQ))) {
OverCnt++;
}
}
根据以上叙述,想请教一下各位专家这个在DMA传输的中断函数中对于地址配置的生效时间具体在什么时候?