This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Flash memory Am29F160D

Hello,

I'm using a PhyCore167HSE board (from Phytec). There is on this board a C167CSL40M and flash memory Am29F160DT.
The problem is :
- how can I write, read and erase in this memory.
I have ever look on documentation and examples but I don't arrive to make run any function.

Help Me please!!!

Thank you
Benoît

  • I have ever look on documentation and examples but I don't arrive to make run any function.
    does that include the Am29F160DT datasheet?

    you can not just "write to an address" for most flash memories, you need to supply a string of commands (typically about 5 bytes) which will do the job.

    Of course, you need to erase the section/page/chip first.

    as an example I include a write flash routine for another processor/another flash, but it should give you the idea

    void WriteFlash (U32 WFLaddr, U8 WFLbyte)
    {
    U16 WFLoffs;
    U8  WFLpage;
    U8  WFLsvSfpg;
    U8  WFLsvIE;
    
      WFLoffs = (U16) (WFLaddr & 0xFFFF);
      WFLpage = (U8)  ((WFLaddr >> 16) & 0xFF);
      SF_P4       &= 0xe0;
      SF_P4       |= WFLpage;
      WFLsvIE     = SG_IE;
      SBG_IE_EA   = FALSE;
      WFLsvSfpg = SG_SFRPAGE;
      SG_SFRPAGE  = 0x00;
      S0_EMI0CF   = 0x3c; // select external memory
      XBYTE [0x0AAA] = 0xaa;
      XBYTE [0x0555] = 0x55;
      XBYTE [0x0AAA] = 0xa0;
      XBYTE [WFLoffs] = WFLbyte;
      S0_EMI0CF   = 0x30; // select internal memory
      SG_SFRPAGE  = WFLsvSfpg;
      SG_IE       = WFLsvIE;
    } // end WriteFlash
    Erik

  • I have the latest version of C166 and a project for programming this device was included under C:\Keil\C166\Flash. I beleive it is used for programming with ulink but you can easily include the source files with your project.

  • Hello,

    Thank you for the responses but I have always the same problem.
    Is it possible somebody give me a project where this part is ok?

    Thank you
    Benoît

  • I have always the same problem

    What exactly is the problem that you are referring to?

  • Hello Walter,

    For example, when I read the memory documentation,I understand that in 6 cycles, I erase a complete sector but this doesn't work. Why?
    Same problem for write read... The documentation and that my program do are very different; Why?

    Thank you
    Benoît

  • The documentation and that my program do are very different; Why?

    That is what you will have to figure out. The place I would start is to make sure your bus is configured correctly for your hardware. These are controled by register such as EBCMODX, TCONCSSM, FCONCSX, TCONCSX, ADDRSELX and etc.

    Also, make sure you understand byte vs word mode. The sequences to access the command registers of the FLASH depend on which mode you are using. The best way to test all of this is to read the device and manufacturer's ID from the FLASH. If you can successfully do this, then move on to writing and reading data.

    -Hope this helps