Forum Discussion

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

Which nios version to use with mSGDMA

I am trying to use the economy nios with the mSGDMA to save streaming data to SDRAM on the DE0-Nano board. Should I be using the standard or fast nios instead. I am not able to get data to even begin saving to SDRAM.

The code writes descriptors to the dispatcher, and then the dispatcher fifo fills up and no new descriptors can be written. To me it seems that the descriptors are not being executed. I tried using the standard and extended versions of the dispatcher. Neither writes the streaming data to SDRAM. I've tried using Burst and Stride options in the extended dispatcher, they don't work either.

Let me know what I am doing wrong or if this is related to the nios set up (i am using /e). It seems I'm missing something fundamental but I can figure out what...

Thanks.

My qsys set up is as follows:

Transfer mode: streaming to memory

Descriptor fifo: 32

Data width: 32

Length width: 20

FIFO depth: 64

Burst Enable: on

Maximum Burst Count: 16

Force Burst Alignment: on

Full Word Access Only

Here is a snippet of my code:

alt_ic_isr_register (MODULAR_SGDMA_DISPATCHER_CSR_IRQ_INTERRUPT_CONTROLLER_ID, MODULAR_SGDMA_DISPATCHER_CSR_IRQ, sgdma_complete_isr, NULL, NULL); // register the ISR

enable_global_interrupt_mask(MODULAR_SGDMA_DISPATCHER_CSR_BASE);

reset_dispatcher(MODULAR_SGDMA_DISPATCHER_CSR_BASE);

start_dispatcher(MODULAR_SGDMA_DISPATCHER_CSR_BASE);

write_address = DATA_DESTINATION_BASE;

//This sets up the dispatcher.

//next in a do while loop...

alt_dcache_flush_all();

while ((RD_CSR_STATUS(MODULAR_SGDMA_DISPATCHER_CSR_BASE) & CSR_DESCRIPTOR_BUFFER_FULL_MASK) != 0)

{

printf("fifo full");

} // spin until there is room for another descriptor to be written to the SGDMA

control_bits = (sequence_field == test_end - 1) ? DESCRIPTOR_CONTROL_TRANSFER_COMPLETE_IRQ_MASK : (DESCRIPTOR_CONTROL_EARLY_DONE_ENABLE_MASK | DESCRIPTOR_CONTROL_ERROR_IRQ_MASK);

construct_standard_st_to_mm_descriptor(a_descriptor_ptr,(alt_u32 *)write_address,0xFFFFFFFF,control_bits);

printf("0x%lx\n",sequence_field);

//increment 16kB address:

write_address = write_address + MAXIMUM_BUFFER_SIZE;

sequence_field++;

if (write_address > RAM_SPAN + RAM_BASE_ADDRESS){

write_address = DATA_DESTINATION_BASE;

}

if(write_standard_descriptor(MODULAR_SGDMA_DISPATCHER_CSR_BASE, MODULAR_SGDMA_DISPATCHER_DESCRIPTOR_SLAVE_BASE, a_descriptor_ptr) != 0)

{

printf("Failed to write descriptor 0x%lx to the descriptor SGDMA port.", sequence_field);

return 1;

}

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Krasner,

    The msgdma is simple to use, you can do a simple test by creating the descriptors your self using nios. Use the io.h library and use iowr_32Direct(address,offset,value). use the standard descriptor for your test. Make sure when you create the control section to enable the GO bit. This bit tells the dma to execute. ill look into it some more..

    -Trukng
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Trukng,

    I got the dma working with the nios/f and some code that was provided: http://www.alteraforum.com/forum/showthread.php?t=47299&page=2

    Basically it did what you said - use the io library to write in the control bits.

    I have yet to see if using the /e or /s versions of nios affect the performance of the dma. As I understand, the /e version doesn't have a data cache...

    Thanks,

    krasner