Forum Discussion
Altera_Forum
Honored Contributor
21 years agoMemory -> DMA -> UART
Quartus 4.2 | NIOSII 1.1 | EP1S25 DSP-Board | Win2k Hi there, i got the DMA working with HAL to send data from memory to memory. My next wish is to send data from memory to the UART. My UA...
Altera_Forum
Honored Contributor
21 years agoint fdterm; // FILEDESCRIPTOR RETURNED BY OPEN
int i; // for for(); FILE * fpterm; // FILE pointer returned by fdopen int uart1_rxcount = 0; //counts received data from uart alt_u8 uart1_rxbuffer[5]; //stores received data from uart int pattern=0xF;//data to fill memory unsigned int *p = (unsigned int*)(0x00010000);//Startadress unsigned int *j = (unsigned int*)(0x00010100);//Destinationadress //DMA_BASE= 0x00020880 //UART_BASE = 0x00020820 int main(void) { //Write to memory something for (i=0; i<5; i++) { IOWR_32DIRECT(p/*+i*/, 0, pattern);//writes pattern from memory to memory+5 } //to open the uart-channel in read/write-modus // fdterm = open("/dev/uart1", O_RDWR | O_NONBLOCK | O_NOCTTY); // fpterm = fdopen(fdterm,"rw+"); // fprintf(fpterm,"UART1 STARTED\r\n"); // check initial output //printf("JTAG STARTED\r\n"); IOWR_ALTERA_AVALON_DMA_CONTROL(DMA_BASE, 0x0); // dma transfer disabled //Send some words IOWR_ALTERA_AVALON_DMA_STATUS(DMA_BASE, 0); IOWR_ALTERA_AVALON_DMA_RADDRESS(DMA_BASE, (int)p); //Pointer to memory IOWR_ALTERA_AVALON_DMA_WADDRESS(DMA_BASE, (int)j); //Pointer to your device IOWR_ALTERA_AVALON_DMA_LENGTH(DMA_BASE, 4); //Sending words (1 word == 4 bytes) IOWR_ALTERA_AVALON_DMA_CONTROL(DMA_BASE, 0x0CC); //See description of dma control register return 0; } This is the code which copies from p (memory) to j(memory). Why can´t i copy from p(memory) to j(uart)? I hope there is no huge thinking mistake http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif thanks for help!