Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

read or write date through flash

hello

the below sentences is in flash_AM29LV065d.c .

volatile unsigned char *fb = (unsigned char *) flash_base;

fb[0x555] = 0xAA; // 1st cycle addr = XXX, data = AA

if the sentences run,the date of the address 0x555 in flash will be 0xAA ?

I don't use the date cache and instruction cache.

Thank you !

16 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    To BadOman & wombat:

    What does the 31st do? I my flash has only 20 address lines, where is the 31st address line?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Please read the posts at the start of the thread for information about what bit31 does. In short, it's a way for software to change the behaviour of the cache - it doesn't get to the external memory.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    To BadOman & wombat:

    I think that transfering data to\from the flash can use some routine

    to carry out .For example in niosI the routing amd29Lv065.c can do this .

    But in the routing there are not the above problems.

    fb=ext_flash_base;

    fb[0x55]=0xAA;

    the above two sentenses can realize flash writing easily.

    the cache problem still exists ?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The Nios I code will not work on Nios II because the cache architecture is different, and because the software infrastructure is different.

    If you want already written code to program the flash then please look at the code in the altera_avalon_cfi_flash component - accessed through the header file sys/alt_flash.h (in altera_hal/inc)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    To wombat:

    the code can be used to test any type flash?

    I use the AMD29LV320DT-90.

    Thank you!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The altera_avalon_cfi_flash component should work with any CFI compliant flash which supports programming algorithm 1, 2 or 3. You should check the datasheet for your device to see whether it supports CFI.

    Unfortunately a small percentage of older flash devices claim to be CFI compliant but actually aren't. Most of the new ones are OK.

    But I would expect this flash to work correctly because its from the same family as the 29LV065 which is on the development board.