Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21611 Discussions

program external nor flash (paralell) through cyclone iv (de0 nano)

Altera_Forum
Honored Contributor II
1,987 Views

Hi! 

I have a small project in the works involving 4x S29GL064N nor flash (paralell) on the same bus on a pcb. + a suitable fpga to handle the programming if possible.. 

 

My goal is to be able to read/write/erase them 4 individually using my de0 nano devboard to start with. 

And flash them one at the time with bin files I already have. 

 

Before I start digging, is this even possible let with a fpga? If so, any tips? 

 

I thought I'd start of with only 1x S29GL064N on a pcb and see if I can get the read / write / erase working... but before I start I thought I'd ask if it's even possible or if I would just waste my time trying? 

 

Thanks in advance!!
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
1,241 Views

Hi Bytestorm. 

 

Yes it is very doable. Since it's a parallel bus these use lots of pins, but if you get one working, it's just control signals to handle the others. 

 

You are on the right track.
0 Kudos
Altera_Forum
Honored Contributor II
1,241 Views

FPGA is a very high speed thing, Flash is a slow IC. for fpga this task is a piece of cake. if you'l get fpga model with many pins you may communicate with ~8 flash IC-s parallely. open your flash documentation, there will be described something that is called a communication protocol - a set of rules about how to communicate with the flash. i remember i'v studied it in 1-2days so it's very easy. especially if it uses "Common Flash Interface (CFI)" it's a very nicely described protocol with timing diagrams specified in the datasheet.

0 Kudos
Altera_Forum
Honored Contributor II
1,241 Views

Hey! 

 

Thanks for the replies! Sorry for my late reply, I didnt get the notice from the email notification :(. 

 

Well I am a little stuck in between a Cyclone IV fpga or a Atxmega128.. 

 

The last days I started to study how to get the flash programmed via a ATXMega128 mcu with C code just to try and understand it since I have 0 experience with programming FPGAs. 

Programming the AVR in C is quite simple but I will also need to code a win app for sending the BIN files throu the usb to the AVR.. wich I think would be simpler to do with altera? 

 

I do have the DE0 Nano board and would really love to use that one if possible. The difference is that for the FPGA i just have an "empty" cpu and I feel that I am not sure how to start? (use the nios cpu? make my own??) 

 

Since I cant use C programming (not that Im any good yet but), but instead learn Verilog or VHDL.. But then again, for the task at hand it might be simpler to program the flashes throu the fpga than bitbanging them all throu the AVR? 

 

Hmm..  

 

The main usage for the FPGA / AVR will be to program flash memories in this project so what do you think?
0 Kudos
Altera_Forum
Honored Contributor II
1,241 Views

Found the manual for usage of the pfl, paralell flash loader. It sure make it sound like a simple task when reading it.. I would like to try it out if I didn't forget my dev board at work! Gas :) 

 

Am I on the right track with the PFL? Is it really that " simple" to interface with external flash throu the cyclone iv? :)
0 Kudos
Altera_Forum
Honored Contributor II
1,241 Views

PFL is mainly used for different tasks not for uploading pictures and stuff in a flash but i guess it is also possible. have not messed with that to be honest. now... if you do not have experience with electronics, messing with an FPGA will be very hard for you since there are 1000 tiny things that you must already know in order to make it work. using FPGA is the hardest way in comparison to other methods.easy it is when you already know what's what. if you will use Nios, you will have to find specific C/C++ library written specifically for Nios to communicate with flash. i don't know where to search that. and i guess you were joking about developing your own CPU :) i guess you meant building a circuit inside FPGA to talk to the flash, yes, that one is feasible of course :) using an atmega microcontroller is the easiest.C++ libraries and functions for communicating between flash and atmega are openly available mostly for free (i guess...). but biggest difficulty ahead is communication between your PC and your Device which has a flash on board. this is painful task not only for you, but for many other developers. as i sense... shortest way would be to write a COMM driver... it's tutorials are available on the internet, then a file grabber which will grab the file and shoot it through COMM port, and connect another end of COMM to your atmega. in case of USB you will have to add a USB interfacing IC to your device. ...you know what.... simply buy an arduino it has everything soldered on it already, and get some app which sends and receives from the flash. and that's it...  

i have also noticed that emails do not come when getting new messages on this forum; thought it was my email's fault or something. looks like it's becoming a wider issue...
0 Kudos
Altera_Forum
Honored Contributor II
1,241 Views

Hi! 

Yeah I didn't really mean to create a own cpu, I mean more like making something that will handle the flash, like you said but I expressed myself bad haha :). It's the first time I mess with a fpga but electronics , schematics in general is no problem. I just bought the fpga dev board because fpgas seems so amazing but now it feels like I am standing in front of a 10 meter brick wall and don't know really how to start climbing :). I'll check around a bit more amongst the heaps of manuals that's are availible and see if I can find something. I could always try and connect a flash that I already have and see what I can come up with.. but yeah the avr seems simpler but man. ... that usb communication will be a big thorn, but there might be something written all ready that I could give a look! 

 

Wonder what went throu my mind when I bought the dev board hahaha but load g different soft cores and implementing stuff just seemed so easy when watching the videos :) 

 

Well I won't give up, and defenitly check the CFI mentioned above also!
0 Kudos
Altera_Forum
Honored Contributor II
1,241 Views

well; you must understand one crucially important thing in electronics industry: 

to communicate with things(flash,pc,usb,lan so on), first you need a technology -that so called "know how" which is kept in secret. these know hows boil money for somebody's pocket, so why should anyone put such a thing in the internet for free... it would be basically depreciation of a valuable thing because every passer-by would be able to do it. that's why companies pay thousands to schools and requalification of their employees; this is called acquisition of new technology and is always a painful process in sense of money. everyone struggles to survive. so, asking a communication protocol file for free is just ridiculous. documentations are written in such way that it would more likely make you forget everything you knew, -instead to teach something new :) . altera's QSPI flash protocol was quite easy to grab... but they are small like 16MB small and cost ~ 7$ .CFI is only documentation i have ever seen which was really nicely described you'l find it in almost any of Flash datasheets.so yes, you are before a brick wall this is a correct conclusion, here you have to choose; either you wrestle the goliath, or find some smart way around.microcontrollers are yesterday's technology. that is why i assume you'l more likely find something valuable there, than with the FPGAs. 

 

by the way you posted this a while ago and it already has 1000 views lol... looks like you started up a very actual question :))
0 Kudos
Altera_Forum
Honored Contributor II
1,241 Views

Ah I see your point :). Hmm may I ask where you bought the file? I can't find any place on the altera page to buy any documentation :/.. it's a little sad it's like that with the protocols and data but of course I understand they want cash for their things so. Funny the verilog description language looks quite close to C programming at first glance :) 

 

I am tempted to stay in my " safe " zone with mcus but at the same time it would be nice to learn something totally different. I might as well finish my prototype pcb with a mcu and flash first and then make another pcb batch and use my cyclone iv and the flash and try my best to get it working and after that decide wich to go with for the final pcb! Should be doable..  

 

I do realise that it will be quite difficult for me but it shouldn't be impossible as long as I invest enough time with verilog and the availible manuals and tutorials..
0 Kudos
Altera_Forum
Honored Contributor II
1,241 Views

by file do you mean documentations and datasheets? here this flash datasheet describes write and read methodologies for the flash on page 51 http://www.spansion.com/support/datasheets/s29al032d.pdf 

this is for QSPI flash https://www.altera.com/content/dam/altera-www/global/en_us/pdfs/literature/hb/cfg/cfg_cf52012.pdf but be careful with it, this IC is quite picky. 

 

rarely companies sell their datasheets. i'v seen only 1 or 2 protocols that are sold. most of them are freely available. all altera's documentations are also free. the thing is that altera changed their site design recently and many good documentation are not accessible anymore but if you google it might still find some good documents. 

here https://www.altera.com/support/literature/lit-index.html maybe you will find what you search here. and here in the middle you will see this tiny PDF symbols in a column. click any of them and it will open the datasheet for corresponding model, you may also click on the model name at left, it will take you into more detailed description page and with some additional documentation files. http://www.buyaltera.com/scripts/partsearch.dll?cat=2556262&pv-5=24296&pv-5=24297 

 

and regarding learning something new; don't get frustrated because it looks very hard, start bit by bit. most important thing here is how much time you have per day. if your family supports you financially, then you are in perfect condition to study. if you have to work and earn for living... then you will have to go on in harsh conditions. be careful with verilog it looks like C but they have nothing in common. these two work totally different ways. verilog describes what electronics should be wired where and how. it is not a software. it is a hardware description language; C is a software. only thing that they have in common is syntax. that is it.
0 Kudos
Reply