Forum Discussion

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

Shared memory between hardware and uClinux

Hi all,

In my application, I receive data over serial port which I need to output at a constant rate (10khz) to some DACS. This rate this data is outputed needs to be deadly accurate... so im thinking software ISR is perhaps not a good option?

What may work well is if I could use a hardware timer and write some verilog code to get the data from some shared memory? Is this possible? There must be a way of sharing data between the NIOS and hardware.

Sharing external memory I suppose is not possible due to bus conflicts? If anyone has any ideas on how to share data that would be great! I would have thought it is a common thing to do?

Thanks

3 Replies

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

    IMHO, you in fact should create an Avalon bus master module (aka DMA) that reads memory data words from memory and writes them to the DACs.

    Why do you think that there is a problem with external memory ? Your Module just accesses the Avalon bus with the appropriate address. AFAIK the Avalon bus design automatically handles bus conflicts.

    You need to take care that the shared memory region is accessed with the CPU without the cache. When doing the appropria<te Linux device driver, the system offers macros to access "DMA-Memory" for that purpose. (NIOS nommu hardware handles this very different from NIOS mmu, but the Kernel should take care of this.)

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

    <div class='quotetop'>QUOTE (mschnell @ Sep 9 2009, 02:21 PM) <{post_snapback}> (index.php?act=findpost&pid=23795)</div>

    --- Quote Start ---

    IMHO, you in fact should create an Avalon bus master module (aka DMA) that reads memory data words from memory and writes them to the DACs.

    Why do you think that there is a problem with external memory ? Your Module just accesses the Avalon bus with the appropriate address. AFAIK the Avalon bus design automatically handles bus conflicts.

    You need to take care that the shared memory region is accessed with the CPU without the cache. When doing the appropria<te Linux device driver, the system offers macros to access "DMA-Memory" for that purpose. (NIOS nommu hardware handles this very different from NIOS mmu, but the Kernel should take care of this.)

    -Michael[/b]

    --- Quote End ---

    Thanks for your reply,

    The avalon bus cannot be accessed from hardware though it? When i say hardware I mean HDL? We need hardware to write to the DACS. I don&#39;t think DMA will do the trick because we need to manipulate the data in hardware before writting to the DACS.

    Basically, the application transits different wave forms, sort of like a signal generator. The PC will send this data which may be up to 600kb and the hardware will need to output this data at 10Khz.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    <div class='quotetop'>QUOTE (Gaz @ Sep 9 2009, 04:15 PM) <{post_snapback}> (index.php?act=findpost&pid=23796)</div>

    --- Quote Start ---

    The avalon bus cannot be accessed from hardware though it? When i say hardware I mean HDL?[/b]

    --- Quote End ---

    I don&#39;t see what you mean by this. Of course you can create a "hardware" component that actively accesses slave-components via the Avalon bus (e.g. a DMA controller).

    <div class='quotetop'>QUOTE (Gaz @ Sep 9 2009, 04:15 PM) <{post_snapback}> (index.php?act=findpost&pid=23796)</div>

    --- Quote Start ---

    We need hardware to write to the DACS. I don&#39;t think DMA will do the trick because we need to manipulate the data in hardware before writting to the DACS.[/b]

    --- Quote End ---

    The Avalon master interface of your component would read the data from memory, your hardware does the "manipulation" and writes it to the DACs.

    <div class='quotetop'>QUOTE (Gaz @ Sep 9 2009, 04:15 PM) <{post_snapback}> (index.php?act=findpost&pid=23796)</div>

    --- Quote Start ---

    Basically, the application transits different wave forms, sort of like a signal generator. The PC will send this data which may be up to 600kb and the hardware will need to output this data at 10Khz.[/b]

    --- Quote End ---

    What do you mean by "The PC will send this data" ? I suppose via some standard interface (serial, USB, Ethernet...). So I suppose you need some kind of FIFO or "repetition storage" between the input from the PC interface and the output to the DACs. This can be done as a "hardware" FIFO the NIOS writes to via the Avalon bus (so your component that includes the FIFO and the interface to the DACs will have an Avalon slave interface), or the CPU writes the data into a normal memory and your component will actively read the data from memory (so your component that has the interface to the DACs will have an Avalon master interface to do that, supposedly plus an Avalon slave interface to exchange command and status informations with the NIOS).

    -Michael