Altera_Forum
Honored Contributor
13 years agoNIOS ii Generic tristate controller - FLASH - DE4
Hello All,
I'm using a Terasic DE4 Stratix IV development board, i'm facing a problem using the GENERIC TRISTATE CONTROLLE to control a CFI Flash memory (Axcell 28F512P30-65nm). I've used the template created from the preset library named "Flash memory Interface (CFI)" and adjusted all timing to my memory. The Module parameters are: embeddedsw.configuration.hwClassnameDriverSupportList : altera_avalon_cfi_flash embeddedsw.configuration.hwClassnameDriverSupportDefault : altera_avalon_cfi_flash ... ( I don't know what this means) embeddedsw.memoryInfo.DAT_SYM_INSTALL_DIR: SIM_DIR embeddedsw.memoryInfo.FLASH_INSTALL_DIR : APP_DIR and embeddedsw.configuration.isFlash = 1 embeddedsw.configuration.isMemoryDevice = 1 embeddedsw.configuration.isNonVolatileStorage = 1 The system.h generate from the bsp give me this: # define __ALTERA_AVALON_JTAG_UART # define __ALTERA_AVALON_ONCHIP_MEMORY2 # define __ALTERA_AVALON_PIO # define __ALTERA_AVALON_SYSID_QSYS # define __ALTERA_AVALON_TIMER #define __altera_generic_tristate_controller # define __ALTERA_NIOS2_QSYS # define __ALTPLL /* * FLASH configuration * */ # define ALT_MODULE_CLASS_FLASH altera_generic_tristate_controller # define FLASH_BASE 0x4000000 # define FLASH_HOLD_VALUE 50 # define FLASH_IRQ -1 # define FLASH_IRQ_INTERRUPT_CONTROLLER_ID -1 # define FLASH_NAME "/dev/FLASH" # define FLASH_SETUP_VALUE 110 # define FLASH_SIZE 16777216u # define FLASH_SPAN 16777216 # define FLASH_TIMING_UNITS "ns" #define flash_type "altera_generic_tristate_controller" # define FLASH_WAIT_VALUE 110 The first problem I see here is that the #define __altera_avalon_cfi_flash is not defined on my system.h. I have a old reference project that come with the DE4 board but uses old quartus version and this is defined. Know when I try to open the Flash device doing: flash_handle = alt_flash_open_dev(FLASH_NAME); if (flash_handle) { alt_write_flash(flash_handle, 0, flash_content, 10); alt_flash_close_dev(flash_handle); error = 0; } the flash_handle is null. I've the singnal tap debugging the FLASH I/O and I can see the I/Os moving when i direct access the flash by writing to the flash_base address. But I need to access it using the CFI interface, otherwise I can't write on the device. When I open the bsp_editor and go to drivers, the flash driver is set to altera_avalon_cfi_flash_driver, but why the system.h is not set to this ? Resume: Shouldn't i see this: # define __ALTERA_AVALON_CFI_FLASH # define FLASH_TYPE "altera_avalon_cfi_flash_driver" instead of # define __ALTERA_GENERIC_TRISTATE_CONTROLLER # define FLASH_TYPE "altera_generic_tristate_controller" Please help me. Thank you, Rafael Corsi - Brasil corsiferrao gmail.com