Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

Problem with DMA between SDRAM and UART

Hello,

Thank you for this very instructive forum!

I have a problem with a DMA between an SDRAM controller and the Fifoed UART.

I transmit bytes from SDRAM to the UART.

Unfortunately, I lost the 518 first bytes.

This is my code :

tx_sdram_uart = alt_dma_txchan_open("/dev/dma_uart");

if(tx_sdram_uart==NULL)

printf("DMA NOT OPEN\n");

else

printf("DMA OPEN\n");

if( alt_dma_txchan_ioctl(tx_sdram_uart, ALT_DMA_SET_MODE_8, NULL) < 0)

printf("Error DMA_io\n");

else

printf("DMA_io OK\n");

if(alt_dma_txchan_ioctl(tx_sdram_uart, ALT_DMA_TX_ONLY_ON, (void *)(FIFOED_UART_BT_BASE+1) ) < 0)

printf("Error DMA_io\n");

else

printf("DMA_io OK\n");

tx_done = 0;

if( alt_dma_txchan_send(tx_sdram_uart, (void *)JPEG_IMAGE_BASE , nb_data_jpeg, dma_done, NULL)<0)

printf("Failed to post transmit request!, reason = %ld\n", rc);

else

printf("DMA_send OK\n");

while(tx_done == 0);

alt_dma_txchan_close(tx_sdram_uart);

If I change nb_data_jpeg by a number < 512 I have the correct transmission, but if the number of bytes is superior to 512 the first bytes are not transmit.

The dma is configured with SOPC builder. Not enable burst transfer and allowed transaction only byte.

Do you have an idea to resolve my bug.

I become crazy!!!

Thank you

Greg