EmbeddedRelated.com
Forums

AVR External Flash

Started by Ken Jewell March 18, 2004
Hi,
      does anyone know if there are any existing routines already written to
access external Flash RAM (64k x 8) in either ANSI C or Assembler?

Thanks in advance,
Ken.


Ken Jewell wrote:
> Hi, > does anyone know if there are any existing routines already written to > access external Flash RAM (64k x 8) in either ANSI C or Assembler?
Sure. That shouldn't such a problem. whatever the connection, I2C, SPI, parallel, it is just a few line sof code for some port lines going up and down. Rene -- Ing.Buero R.Tschaggelar - http://www.ibrtses.com & commercial newsgroups - http://www.talkto.net
Flash isn't descriptive enough. There are many manufacturers of Flash,
each have their own architecture.  There are also many different
busses that are used to communicate with a Flash memory peripheral. 
Is this connected by some type of serial bus like SPI or IIC, or like
a flash array that is used for interface to an 8-bit memory bus? 
There are also other standards for data storage Flash such as MMC or
CompactFlash.

If you have a model number and datasheet for the Flash you are trying
to use, it would be helpful.
-J

"Ken Jewell" <ken.jewell@NOSPAMpdtuk.com> wrote in message news:<4059be5f$0$31700$fa0fcedb@lovejoy.zen.co.uk>...
> Hi, > does anyone know if there are any existing routines already written to > access external Flash RAM (64k x 8) in either ANSI C or Assembler? > > Thanks in advance, > Ken.
"Ken Jewell" <ken.jewell@NOSPAMpdtuk.com> skrev i meddelandet
news:4059be5f$0$31700$fa0fcedb@lovejoy.zen.co.uk...
> Hi, > does anyone know if there are any existing routines already written
to
> access external Flash RAM (64k x 8) in either ANSI C or Assembler? > > Thanks in advance, > Ken. >
It really depends on what you want to do. If you use a parallel flash memory you have fast access but waste a lot of pins. You also need a latch to demultiplex the bus. 64kB x 8 is quite small for a parallell flash memory nowadays and you risk obsolecense. If you want to execute code out of the AVR; then you should forget that, since the Instruction Bus is not available, but I guess you dont. If you are looking for serial interfaces, then you should search the application notes at www.atmel.com or www.avrfreaks.net. -- Best Regards, Ulf Samuelsson ulf@a-t-m-e-l.com This is a personal view which may or may not be share by my Employer Atmel Nordic AB
Hi Ken,

After reading the other posts, I would agree, you need to give more 
information.

But, 1) Flash is not RAM. 2) there are NO 64kx8 RAM ( or flash AFAIK).

So there is not even guessing what you want to do.

Now, If you asked for a serial data flash i.e. AT45DB041B, I could help you.

But.......

Ken Jewell wrote:
> Hi, > does anyone know if there are any existing routines already written to > access external Flash RAM (64k x 8) in either ANSI C or Assembler? > > Thanks in advance, > Ken. > >
Hi,
       ok this is what I need to do.

I am using the AVR Mega32 to which I have a flash part HY27US08-121M

http://www.hynix.com/datasheet/eng/flash/detail11.jsp?PartNo=HY27US(8/16)121M&product_kind=512M

which is a NAND flash 512Mbits (64M x 8bit) connected as follows;

IO0 - IO7   connected to   PORT B D0 - D7
ALE,  CLE, /RE, /WE, /WP and /RB are all connected to their own port pins

PORT B is also shared with 2 other parallel interfaces.

Serial flash is not an option in this project, it must be parallel flash
because it has already been purchased in large quantity. :-O

I basically want a simple file system for recording digital data which is
being parallel loaded at a maximum bit rate of 224kbps

I dont think it is nesseary for me to use a full FAT12 or FAT16 but
something more simple like this as my file table system;

offset + 0x0000    FF    FF    FF    FF    FF    FF    FF    FF    (file
name - 8bytes)
offset + 0x0008    FF    FF    FF    FF    FF    FF    FF    FF    (start
address 4bytes / end address 4bytes)

The data will never be read from a PC, its only ever to be used by the AVR.

Thanks in advance,
Ken.


"Ken Jewell" <ken.jewell@NOSPAMpdtuk.com> wrote in message
news:4059be5f$0$31700$fa0fcedb@lovejoy.zen.co.uk...
> Hi, > does anyone know if there are any existing routines already written
to
> access external Flash RAM (64k x 8) in either ANSI C or Assembler? > > Thanks in advance, > Ken. > >
"Ken Jewell" <ken.jewell@NOSPAMpdtuk.com> wrote in message
news:4059be5f$0$31700$fa0fcedb@lovejoy.zen.co.uk...
> Hi, > does anyone know if there are any existing routines already written
to
> access external Flash RAM (64k x 8) in either ANSI C or Assembler? > > Thanks in advance, > Ken. > >
I've used an Atmel AT45DCB004 DataFlash card for a data logger together with an AVR. Serial, so very few pins, and easy to interface: http://www.atmel.com/dyn/products/product_card.asp?family_id=616&family_name=DataFlash%AE&part_id=1885 Rob
> which is a NAND flash 512Mbits (64M x 8bit) connected as follows;
I think you need to rethink this a bit... these devices are not guaranteed 100% error free. At the very least you should implement SSFDC-style block allocation and ECC.
> I am using the AVR Mega32 to which I have a flash part HY27US08-121M > >
http://www.hynix.com/datasheet/eng/flash/detail11.jsp?PartNo=HY27US(8/16)121M&product_kind=512M
> > which is a NAND flash 512Mbits (64M x 8bit) connected as follows; > > IO0 - IO7 connected to PORT B D0 - D7 > ALE, CLE, /RE, /WE, /WP and /RB are all connected to their own port pins > > PORT B is also shared with 2 other parallel interfaces. > > Serial flash is not an option in this project, it must be parallel flash > because it has already been purchased in large quantity. :-O
> > I basically want a simple file system for recording digital data which is > being parallel loaded at a maximum bit rate of 224kbps > > I dont think it is nesseary for me to use a full FAT12 or FAT16 but > something more simple like this as my file table system; > > offset + 0x0000 FF FF FF FF FF FF FF FF (file > name - 8bytes) > offset + 0x0008 FF FF FF FF FF FF FF FF (start > address 4bytes / end address 4bytes) > > The data will never be read from a PC, its only ever to be used by the
AVR.
> > Thanks in advance, > Ken. >
As Lewin pointed out, you need to have a flash file system which maps out the bad sectors in the NAND flash, and this is complex. SPI dataflash is soo much easier to use. Atmel has some code for this but you would have to switch to ARM and need 50k volume which I guess may be less attractive. Maybe you can find something in the ARM Linux source distribution. -- Best Regards Ulf at atmel dot com These comments are intended to be my own opinion and they may, or may not be shared by my employer, Atmel Sweden.
> As Lewin pointed out, you need to have a flash file system which maps out > the bad sectors in the NAND flash, and this is complex. > SPI dataflash is soo much easier to use.
I can give the OP my SSFDC code, which does not have GPL restrictions. But I need to remove it from its current context. It's pretty damn ugly but easy to understand. Frankly I agree with Ulf et al that the SPI flash memories are easier to use but since the OP already invested in boatloads of NAND, that's life...