Forum Discussion
Altera_Forum
Honored Contributor
14 years ago --- Quote Start --- How about your txrxDone function? Ensure that the txrx_done variable is declared as volatile to prevent any optimisations from reading the value properly. --- Quote End --- I have declared it already. --- Quote Start --- Check that tx_data and rx_buffer are pointed to valid memory areas, and memories the DMA's avalon masters are actually connected to. --- Quote End --- I think I have connected it right. (*picture attached)
void* tx_data = (void*)SSRAM_BASE; /* pointer to data to send */
void* rx_buffer = (void*)SDRAM_1_BASE; /* pointer to rx buffer */
--- Quote Start --- If it still doesn't work, put some Signaltap probes on the DMA component to see what it is doing and if/where it gets stuck. --- Quote End --- I haven't tried this coz I don't know how to do it :( --- Quote Start --- And don't forget to flush/bypass the data cache where appropriate. --- Quote End --- Sorry but I don'g get it.. I am new to SOPC stuff. can you please give more explanation? Besides , from this thread http://www.alteraforum.com/forum/showthread.php?t=13023 ,it seems like this code (or the code from NIOS II Software's Developer user guide) have some bug, since "while (!dma_done);" doesn't work at all. I have changed it by using if-statement
if (txrx_done == 1)
{
printf ("Transfer Function Done!\n");
/* Post the receive request */
if ((rc = alt_dma_rxchan_prepare (rxchan,
rx_buffer,
0x10,
rx_done,
NULL)) < 0)
{
printf ("Failed to post read request, reason = %i\n", rc);
exit (1);
}
else
{
printf ("Succeed to post read request when rc = %i\n",rc);
printf ("txrx_done = %d\n",txrx_done);
//printf ("done = %d",done);
}
but it still doesnt work! :confused: Is it a bug on the callback function?? since txrx_done never become 1.
//callback function when DMA transfer done
static void tx_done(void * handle, void * data)
{
txrx_done = 1;
}
Any reply will be appreciated:) Yuyex:)