Forum Discussion

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

Timing DMA routines and wondering about measurements observed.

I have a "free standing" NIOS II design with hard PCIe connecting to a host system.

The NIOS II code processes descriptors generated by the host ARM system and uses the Avalon MM DMA controller to perform data movement when the

descriptor requires it ... ( the descriptor may request other non-data movement tasks for the NIOS II to perform ).

I used one of the user_LED's on the Arria V starter kit to measure time in various code sections.

I am trying to understand the numbers as they look too large. The bulk of the time is in the alt_dma_rxchan_prepare (rxchan,rx_buffer,64,done,NULL) routine,

then alt_dma_txchan_send (txchan,tx_data,64,NULL,NULL) and a small time waiting for rx_done to be set by the callback routine.

As a sanity check , toggling the LED was achieved in about 2 uS.

I can debug through the code, but suspect something else is at play.

In addition, the 1.5 uS waiting for the rx_done to be set, is very repeatable, BUT on occasions it gets stretched out to a much longer value like an

interrupt service routine went active and interrupted normal activity. I can try to turn off all console output as I would think only the JTAG_UART could

involve such long delays.

Thanks in Advance, Bob Dixon.

/* Post the transmit request */

// 29 uS

leds = 0xFFFF; // all on

IOWR_ALTERA_AVALON_PIO_DATA( LED_PIO_BASE , leds );

if ((rc = alt_dma_txchan_send (txchan,tx_data,64,NULL,NULL)) < 0)

{

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

exit (1);

}

leds = 0x0000; // all off

IOWR_ALTERA_AVALON_PIO_DATA( LED_PIO_BASE , leds );

/* Post the receive request */

// 87 uS

if ((rc = alt_dma_rxchan_prepare (rxchan,rx_buffer,64,done,NULL)) <0 )

{

printf ("Failed to post read request, reason = %i\n", rc);

exit (1);

}

else

{

// printf ("Passed post read request\n");

}

/* wait for transfer to complete */

// 1.5 uS

while (!rx_done)

{

printf ("Waiting on rx_done = %i\n", rx_done);

}

// printf ("Transfer done!\n\n");
No RepliesBe the first to reply