Forum Discussion

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

How to use M25P32 ?

Hi guys,

I want to use M25P32 in my design for its low cost. But unfortunately, it can't be recognized by Quartus programmer. It also can't be opened with the function "alt_flash_open_dev".

Some people has the same experience? Did you success? Please HELP!

Thank you very much.

Derek

6 Replies

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

    How are you trying to access it with the Quartus programmer? Via a dedicated AS programming header? Or indirectly via JTAG? Do you have either or (hopefully) both of these programming headers on your hardware? With a little more detail I think we should be able to make that bit work.

    Getting 'alt_flash_open_dev' working may be a little more involved but lets make sure you're hardware is working with the above step first.

    Cheers,

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

    Hi Alex,

    Thank you very much for your reply. I really need your help.

    I access the flash indirectly via JTAG, and I don't have a dedicated AS programming header. When I program the serial flash, I open the nios2eds shell, and using sof2flash and elf2flash to convert the sof/elf files to .flash format. There is a nios core inside sof, so I use nios2-flash-programmer to write the .flash files into the serial flash after nois2-configure-sof.

    I am using M25P32 to replace M25P16 for remote update function. When I use M25P16, everything goes well. I can program the flash with nios2-flash-programmer, and read/refresh it with altera epcs driver. But when I change to M25P32, all the tools cannot recognize it. I note there isn't EPCS32 in Altera's flash series. I don't know whether it is the reason.

    I am sorry for my poor English. Thanks again.

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

    Put the attached file into your ..\nios2eds\bin\ directory.

    If you already have a 'nios2-flash-override.txt' file, add the entry I've given to you into your existing file.

    Look at the guide Stuart has pointed you at - it explains why. However, it doesn't include a any EPCS memory examples. The attached should (I hope) tell the nios2 programmer how to use your particular Micron device.

    Cheers,

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

    Hi Stuart and Alex,

    It is really helpful! Thank you very much!

    Besides, I want to remote update the application image, so I also need a way to refresh the serial flash by the software, like the funtions inside "alt_flash.h" , such as "alt_flash_open_dev".

    Do you have some idea except a customized SPI bus? Can I just add some files or some code, so that the alt_flash command can recognize M25P32?

    Best wishes,

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

    Finally, I have found a way, and it is so simple. I just track the boot process step by step, and find alt_epcs_flash_query() function. I just add the following code, and the M25P32 can be accessed.

    else if (flash->silicon_id == 0x15) /* EPCS32 */

    {

    flash->dev.region_info[0].region_size = 32 * 1024 * 1024 / 8;

    flash->dev.region_info[0].number_of_blocks = 64;

    flash->dev.region_info[0].block_size = 65536;

    }

    Hope it will help others. Thanks again for Stuart and Alex. You make me solve this issue so quickly.

    Derek