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++
12589 Discussions

Flash driver on Nios II Dev Board?

Altera_Forum
Honored Contributor II
888 Views

I have been trying to use the flash memory on my Nios II dev board, which is based on a Cyclone II C35. The flash memory is an AMD29LV128MH. I can't get it work with either JFFS2 or the basic IO API. 

 

I have added the flash IO package to my ecos configuration, and enabled the IO block device API with the device name "/dev/flash1". Then I tried to use some basic test code like this: 

 

char Buffer[80]; 

flash_init(printf); 

err = cyg_io_lookup("/dev/flash1", &FlashHandle); 

if (err == ENOERR) 

Length = 0; 

err = cyg_io_bread(FlashHandle, Buffer, &Length, 0); 

 

The problem seems to be that flash_init() fails. It finds the device in the device table but fails to set it up properly. The call to cyg_io_lookup works, but cyg_io_bread fails because the flash has not been initialised. 

 

I am using the standard design example for SOPC builder which includes a flash device called "ext_flash". 

 

I have noticed that the Nios dev board template in the ecos configuration tool adds a packed called "Altera Avalon AM29LV065D flash driver". Do you think it matters that the device on my board is actually an AM29LV128MH? the configuration tool won't let me remove the AM29LV065D package. Do I need to edit the template definition? If so, how do I do that? 

 

Can anyone help me? 

 

Mike
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
199 Views

I have solved my problem. The flash driver was trying to access the flash in 16-bit mode, but the Nios dev board has the flash device wired in 8-bit mode. I changed the flash_am29xxxxx.inl and flash_am29xxxxx_parts.inl files following the advice in this post: http://forum.niosforum.com/forum/lofiversi....php/t1841.html (http://forum.niosforum.com/forum/lofiversion/index.php/t1841.html). 

 

Mike
0 Kudos
Reply