Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Valued Contributor III
1,208 Views

Flash doesn't work in NiosII

Hi all 

 

I want to read and write the 1MB 29LV800TE-90PFTN flash on DE2. I add a tri-state bridge and connect a CFI to it in the sopc builder and connect the pins as the demon does.  

 

1 When I use alt_flash_open_dev to open the flash, it always return 0.  

2 When I use the nios flash programmer, it shows no CFI table found. But the data shown below is correct.  

3 When I use the sof of the demon, the same problem also exists.  

4 The flash can work because I can use the control panel of DE2 to read or write the data.  

 

Could anyone give me some advice? I use quartusII 9.1 and niosII 9.1. 

 

thx!
0 Kudos
6 Replies
Highlighted
Valued Contributor III

Re: Flash doesn't work in NiosII

I had this same problem and it took me a day to find it. If you peruse the DE2 example pin assignments you find a pin for the flash that is not passed on to the flash core in the nios2 cpu.  

 

make sure that that pin - FL_RST_N (PIN_AA18) is driven high to enable the flash in your top level entity. this is NOT taken care of for you by the flash core. 

 

edit: The pin assignment is only for my particular DE2 board, it may be different in your revision.
0 Kudos
Highlighted
Valued Contributor III

Re: Flash doesn't work in NiosII

Thank you. I have already used 

// Flash 

assign FL_RST_N = 1'b1; 

in my design. 

I have also tried to set the setup, wait and hold time in cfi to be larger than 200ns, but have no effect. 

Do you use the same type of 1MB flash for most DE2 use the 4MB flash?
0 Kudos
Highlighted
Valued Contributor III

Re: Flash doesn't work in NiosII

Hey Crasic, 

 

Can you let me know the CFI's setup, wait and hold time that you specified for your S29AL032D flash? 

 

I've looked into the datasheets as well as Altera's documentation for its CFI block, but I just couldn't derive the proper parameters... 

 

Thanks :)
0 Kudos
Highlighted
Valued Contributor III

Re: Flash doesn't work in NiosII

Hi, 

In these case I normally proceed in this way: 

- use IOWR/IORD to directly access the device: with a few wr and rd (refer to flash datasheet) you can easily readback flash device info and make sure the hardware is working properly  

- then you can possibly step into alt_flash_open_dev and discover if there is any problem with the driver 

 

Cris
0 Kudos
Highlighted
Valued Contributor III

Re: Flash doesn't work in NiosII

Hi Cris, 

 

I've tried the flash using DE2 control panel and it worked fine. 

 

I did some debugging and found out that alt_flash_open_dev couldn't find my device under the name "dev/cfi_flash" in the llist... 

 

There's only 1 device in the llist which is my EPCS controller.. And when I try using EPCS it worked fine. 

 

Is it possible that faulty setting (like timing) cause that? Or maybe the driver's fault? :S..
0 Kudos
Highlighted
Valued Contributor III

Re: Flash doesn't work in NiosII

Finally found the problem... 

 

I used reduced driver and it seems that it is necessary to include the line  

 

# define ALT_USE_CFI_FLASH 

 

in alt_sys_init.c of BSP project... Nios2 documentation didn't mention bout this except for EPCS' flash..  

 

Thanks guys for your advices..
0 Kudos