Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12599 Discussions

NIOS ii Generic tristate controller - FLASH - DE4

Altera_Forum
Honored Contributor II
2,193 Views

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
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
528 Views

Any idea is well come ! 

 

Thanks,
0 Kudos
Altera_Forum
Honored Contributor II
528 Views

Hi again, 

 

Know I'm pretty sure that there is a BUG in the QSYS, I re-regenerate the same project 

using the SOPC and I did not have any problem to write our read from the FLASH device 

using the nios ii CFI driver.  

 

The system.h generate from this sopcinfo has the attributes that I told before, and I can  

know open the FLASH device. 

 

I think that the new GENERIC_TRISTATE_CONTROLLER has some problem to generate the 

.sopcinfo so that the BSP generate from this file fails to associate the memory controller to 

the CFI driver. Associating it to the generic_tristate_controller not to the altera_avalon_cfi_flash. 

 

My software IDE version is the newest (12.0).  

 

How do I upload this bug to altera ? 

 

thkns 

 

Rafael Corsi - Electronic engineering  

corsiferrao@gmail.com
0 Kudos
Reply