This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

L138: NOR flash driver in ARM UBL



 Hi Daniel Allred,

Would like to consult you on the NOR flash driver in armubl-03.20.00.11 used for OMPAL138.

The driver supports both 8-bit and 16-bit data bus width.

When it is used for word configurationn (16-bit data bus width) flash, the address argument in all the APIs is address to single byte or address to single word ?

I expect it to be address to single word in the case for word configuration flash.

rgds,

kc Wong

  • For example, I am using 1Gb (64M x 16) Flash - PC28F00AP30EF from Micron (Numonyx).

    So, the CFI query will set the below.

    busWidth = 2 (BUS_16BIT)

    flashSize (in bytes) = 128 MB

    blockSize (in bytes) = 128 KB (0x20000)

    numberBlocks = 1024

    numberRegions = 1

    With this, NOR_getBlockInfo will always return the blockSize = 0x20000. Let's pick example on erase operation in NOR_erase. In the code, it will step through the block with blockSize 0x20000. But the address in NOR flash refers to a word (as shown in below picture).  

    addr = blockAddr + blockSize;

     So, what will happen is every alternate block will be skipped for erase because every block is 64 Kword (0x10000). Isn't it ?

    rgds,

    kc Wong

    // Erase Flash Block
    Uint32 NOR_erase(NOR_InfoHandle hNorInfo, VUint32 start_address, VUint32 size)
    {
     VUint32 addr  = start_address;
     VUint32 range = start_address + size;
     Uint32 blockSize, blockAddr;
     
     DEBUG_printString("Erasing the NOR Flash\r\n");
     
      while (addr < range)
      {
        if (NOR_getBlockInfo(hNorInfo, addr, &blockSize, &blockAddr) != E_PASS)
        {
          DEBUG_printString("Address out of range");
          return E_FAIL;
        }
      
      //Increment to the next block
        if ( (*Flash_Erase)(hNorInfo, blockAddr) != E_PASS)
        {
          DEBUG_printString("Erase failure at block address ");
          DEBUG_printHexInt(blockAddr);
          DEBUG_printString("\r\n");
          return E_FAIL;
        }
        addr = blockAddr + blockSize;
        
        // Show status messages
        DEBUG_printString("Erased through ");
        DEBUG_printHexInt(addr);
        DEBUG_printString("\r\n");

      }

      DEBUG_printString("Erase Completed\r\n");

      return(E_PASS);
    }