Forum Discussion

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

Accessing EPCS controller

I have design with cyclone II device and EPCS16 serial flash. Currently I have "undefined board" selected in SOPC-builder. I have added EPCS-flash controller and I am able to generate SDK. Software runs OK and everything else in my test works just fine but I don't get anything out of flash memory.

I do not wish to use nios programmer to program the flash only to access flash from my nios software. I have tried both quartus 5.0 and 5.1 with same result.

2 Replies

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

    Further testing revealed that opening the flash device fails.

    I use following code and it compiles with no errors.

    alt_flash_fd* fd;

    int rval = 0xDEADBEEF;

    fd = alt_flash_open_dev(EPCS_CONTROLLER_NAME);

    if(fd) {

    rval = alt_read_flash(fd, address, data, length);

    alt_flash_close_dev(fd);

    }

    return rval;

    PS. I can't select a reference designator for EPCS controller. I don't see why that would be a problem because I can generate sdk. I have only one cyclone2 and one EPCS16 on my board so why should anyone care what designator was used when board was designed.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I have the same issue opening flash device in the debugger. However I am able to generate a flash device reference designator. I am pretty sure the compiler requires this. When the function is called it must pass the flash device name that is in the system.h file. That is done only from the command line shell with the mk_target_board command detailed here...

    http://www.altera.com.cn/literature/ug/ug_..._programmer.pdf (http://www.altera.com.cn/literature/ug/ug_nios2_flash_programmer.pdf)

    Does anyone know why I would get this error also, even with a correct fd name generated?