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

AT49xV32x flash programming algorithm

I am now trying to write my own flash programming algorithm since there is not one for my EN29LV320 flash memory in realview MDK. And as I was told in the online help, I should find a model to modify, which should be a short cut. I have looked over keil\ARM\Flash directory, however I just find several algorithm about external flash and they are all beginning with AT49, am I right?
Since my flsh is 4MB and 16bit, so I guess AT49xV32x maybe the right one for me, but I download the dadasheet of AT49BV320D,AT49BV320S,AT49BV322D,AT49SV322D, surprisingly their commands are different from the ones offered in AT49xV32x. For example,

EraseSector (unsigned long adr) {

  // Start Erase Sector Command
  M16(base_adr + 0x0AAA) = 0xAA;
  M16(base_adr + 0x1554) = 0x55;
  M16(base_adr + 0x0AAA) = 0x80;
  M16(base_adr + 0x0AAA) = 0xAA;
  M16(base_adr + 0x1554) = 0x55;
  M16(adr) = 0x30;

  return (Polling(adr));       // Wait until Erase completed
}


the second statement write 0x1554 to address bus and 0x55 to data bus, but I can't find this command in datasheet. Can anyone tell me what does this mean and which flash is right one for AT49xV32x
Thanks a lot!

  • The algorithm you are referring to is for AT49xV32x flash connected to a 16-bit bus (flash addresses A0..A[x] are connected to ARM CPU addresses A1..A[x+1]). Therefore the addresses for commands specified in the flash user manual actually need to be shifted left.

    Following is another variant of the EraseSector function which should be more explanatory:

    EraseSector (unsigned long adr) {
    
      // Start Erase Sector Command
      M16(base_adr + (0x555 << 1)) = 0xAA;
      M16(base_adr + (0xAAA << 1)) = 0x55;
      M16(base_adr + (0x555 << 1)) = 0x80;
      M16(base_adr + (0x555 << 1)) = 0xAA;
      M16(base_adr + (0xAAA << 1)) = 0x55;
      M16(adr) = 0x30;
    
      return (Polling(adr));       // Wait until Erase completed
    }
    

    I have glanced over the EN29LV320 flash user manual and it seems compatible with the AT49xV32x flash. So the existing algorithm for AT49xV32x should work already for EN29LV320.

    Algorithms regarding Boot Sectors:
    EN29LV320T (Top Boot) should be compatible with AT49xV32xT algorithm.
    EN29LV320B (Bottom Boot) should be compatible with AT49xV32x algorithm.