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.

DMA 问题

利用DMA从L4向L5传输数据,为什么源地址和目的地址需要设为全局变量,不能设为局部变量,如下程序,将DMABuf1中的数据传输给DMABuf2,但是自己将DMABuf1和DMABuf2在main函数里设为局部变量是传输错误,设为全局变量就可以了,求解?

#include "DSP2833x_Device.h"
#include "DSP2833x_Examples.h"
#include "DMA.h"

#pragma DATA_SECTION(DMABuf1,"DMARAML4");
#pragma DATA_SECTION(DMABuf2,"DMARAML5");

Uint16 DMABuf1[2] = {0x0001, 0x0002};
Uint16 DMABuf2[2] = {0x0000, 0x0000};
Uint16 i;

void main ()
{
	InitSysCtrl();
	InitPieVectTable();
	dma_init (DMABuf1, DMABuf2);
	dma_interrupt_init();
	dma_start ();

	EALLOW;
	DmaRegs.CH1.CONTROL.bit.PERINTFRC = 1;
	EDIS;
	while(1);
}
  • 利用DMA从L4向L5传输数据,为什么源地址和目的地址需要设为全局变量,不能设为局部变量,如下程序,将DMABuf1中的数据传输给DMABuf2,但是自己将DMABuf1和DMABuf2在main函数里设为局部变量是传输错误,设为全局变量就可以了,求解?

    Eric:

    局部变量一般是放在RAMM0 和RAMM1, 看你的CMD文件.stack。

    DMA Overview:
    • 6 channels with independent PIE interrupts
    • Peripheral interrupt trigger sources
    – ADC sequencer 1 and sequencer 2
    – Multichannel Buffered Serial Port A and B (McBSP-A, McBSP-B) transmit and receive
    – XINT1-7 and XINT13
    – CPU Timers
    – ePWM1-6 ADCSOCA and ADSOCB signals
    – Software
    • Data sources/destinations:
    L4-L7 16K x 16 SARAM
    – All XINTF zones
    – ADC memory bus mapped result registers
    – McBSP-A and McBSP-B transmit and receive buffers
    – ePWM1-6 / HRPWM1-6 Peripheral Frame 3 mapped registers