Altera_Forum
Honored Contributor
17 years agoDMA for 16 bit?
I have two DMA working, the one is used to send data from SRAM memory to a DSP custom block, another DMA reads from the DSP block and stores data again into SRAM memory.
I have allowed DMA in SOPC Builder to sending and receiving 8bit,16bit and 32bit. My data lenght to send and receive is 16 bit. The problem is I only receive the firsts 8 bit (LSB) although I have set the DMA in NIOS to send and receive data of 16 bit Is there anything wrong?
alt_u16 *tx_buf;
alt_u16 *rx_buf3
printf ("starting DMA HAL API DSP...\n");
alt_dma_txchan_ioctl(txchan, ALT_DMA_TX_ONLY_ON, tx_buf);
alt_dma_txchan_ioctl(txchan, ALT_DMA_SET_MODE_16, NULL);
alt_dma_rxchan_ioctl(rxchan, ALT_DMA_RX_ONLY_ON, rx_buf3);
alt_dma_rxchan_ioctl(rxchan, ALT_DMA_SET_MODE_16, NULL);
if ((rc = alt_dma_txchan_send (txchan,tx_buf,MAX_BYTES,NULL ,NULL)) < 0)
printf ("Failed to post transmit request, reason = %i\n", rc);
if ((rc = alt_dma_rxchan_prepare (rxchan,rx_buf3,MAX_BYTES,End_Rx_DMA,NULL)) < 0)
printf ("Failed to post read request, reason = %i\n", rc);
while(!DMA_rx_done);
DMA_rx_done=0;