Forum Discussion

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

How to use an EPCS Flash

Hallo together,

I'm actually trying to save data from NIOS II into an EPCS64 device. My system contains an EPCS controller. But now the confusion is complete, there are so many files for using an flash... and I'm not sure which to use. There are:

- altera_avalon_epcs_flash_controller.h

- sys\alt_flash.h

- epcs_commands.h

And all these headers include different read/write functions.

Then I tried an example from the Internet to start.


static alt_flash_fd* epcs16_dev_ptr;
static flash_region *p_epcs_reg_info;
static int num_epcs_regs;
void epcs_open(void)
{
    epcs16_dev_ptr = alt_flash_open_dev(EPCS_FLASH_CONTROLLER_NAME);                         
    if (epcs16_dev_ptr == NULL)
    {
        alt_printf("** Can't open flash device **\n\n");
        return;
    }
    alt_epcs_flash_get_info(epcs16_dev_ptr, &p_epcs_reg_info, &num_epcs_regs);               
    return;
}

But to open the EPCS flash always fails. Is there something else to configure in the EPCS controller before start?

Which header and functions are the right?

Greets

Sim

47 Replies

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

    If you are talking about device like Numonyx M25P64 or something like that, the answer is "Yes you can...". I'm using ECPS controller with Numonyx M25P16.

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

    I forgot to give maybe an important information, my flash device is no original altera epcs flash!

    Could I access such an flash with an epcs controller?

    Had I maybe to use other functions (for cfi- flash or something)?

    Thanks.

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

    Try calling epcs_open() twice and look if you get the same error.

    I remember I once had to use this workaround, although I can't remember what was the actual problem, neither if I fixed it.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yes to both questions. :)

    I can boot from EPCS and the signals are connected to NIOS II processor.

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

    Your I/O configuration is correct.

    Included headers and alt_flash_open_dev call are ok, too.

    Silly questions:

    - Is epcs correctly connected to fgpa and operating; namely, can you already configure fpga (and possibly boot Nios) from epcs?

    - Did you route signals from Nios epcs controller to i/o pins?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for the reply, but I think that is not the Problem. Here my configuration...

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

    First of all make sure you configured epcs pins as Regular I/O, otherwise you could not use them after fpga has configured.

    You find this in Quartus design assignments: device and pin options -> dual-purpose pins