none
Issue with FMD NOR Driver in Windows Embedded Compact 7 (WEC7) RRS feed

  • Question

  • Hi All, 

    We are developing FMD NOR driver for WEC7 on Altera Cyclone V SOC platform for accessing as a mass storage device in the file system. Interface to the flash is through Quad SPI(QSPI) of the Altera Cyclone V.

    Flash on board is a 128 MB Micron NOR Flash, already we have developed the raw access driver for Eboot.

    We have selected the FMD MDD/PDD model of OS driver, driver is integrated successfully and it is loading on boot.

    It is able to send the command also through SPI, but while reading the data we are getting the exception while accessing the data FIFO SRAM of QSPI Flash controller. QSPI data FIFO SRAM size is 1 MB. It is mapped to the virtual address for access.

    We had checked the memory map also, looks like it is fine.

    Below is the code snippet where the crash, and subsequent crash log.

    /* Mapping Data FIFO */

    g_pQSPIDataReg = (PCS5_QSPIDATA_REG) MmMapIoSpace(phyAddr2, 1024*1024,
            FALSE);

    /* Accessing the fifo */ 

    memcpy((void *)pDestPtr, (void *)g_pQSPIDataReg, QSPI_FIFO_WIDTH);

            u32Remaining -= QSPI_FIFO_WIDTH;


    +++++++ Crash Log +++++

    'Data Abort' (0x4): Thread-Id=00510002(pth=c0802478), Proc-Id=00400002(pprc=837d95e0) 'NK.EXE', VM-active=00400002(pprc=837d95e0) 'NK.EXE'
    PID:00400002 TID:00510002 PC=cedb2530(norfmd.dll+0x00002530) RA=8021b254(kernel.dll+0x00008254) SP=c48df05c, BVA=00000000

    Please guide us where could be the issue.

    Regards,

    Ashfaque

    Thursday, March 6, 2014 9:30 AM

All replies

  • Thursday, March 6, 2014 10:32 AM
  • Hi Vinoth,

    pDestPrt is passed by the FMD upper layer, it is a valid pointer.

    I had gone through the link, we identified that, it is the memcpy which is causing the exception.

    g_pQSPIDataReg is mapped to the Physical address of the QSPI Data FIFO -( Address 0xFFA00000).

    Similar mapping we had done for the QSPI CSR registers and  we are able to do the read/write access to it

    Thanks in advance for any further suggestions.

    Regards,

    Ashfaque

    Thursday, March 6, 2014 10:48 AM
  • Instead of using the memcpy(), can you write your own memcpy() ( for debugging purpose) to find the exact address (beginning location of the specified region or in the middle or when you exceeding the boundary, etc..) by printing the address and value.

    Also what is the value of QSPI_FIFO_WIDTH?

    is that FIFO allows you to increment? since it is a FIFO you can excess the data in the same location right?


    Please mark as answer, if it is correct.
    Please vote,if it is helpful post.
    Vinoth.R

    http://vinoth-vinothblog.blogspot.com
    http://www.e-consystems.com/windowsce.asp

    Thursday, March 6, 2014 11:12 AM
  • Hi Vinoth,

    QSPI_FIFO_WIDTH = 4, and the SRAM FIFO access is also 4 bytes. Identical driver we are using in the Eboot level and we are able to read and write to QSPI NOR.

    The only difference we found was the Virtual Address mapping functions

    OALPAtoUA in Eboot and MmMapIOSpace in WEC7 driver.

    Also the virtual address (with MmMapIOSpace) is 0xcedd0000, looks like withing range.

    We are stuck on to this issue.

    Please provide any help.

    Thursday, March 6, 2014 3:59 PM
  • i couldn't able to figure out the issue but i can share some general tips to debug.

    if you are not able to access the location means there could be the following issue.

    1) generally there will be some interface clock or bus clock to enable for accessing the SPI controller.  if you missed it, SPI FIFO won't be visible to access which will cause exceptions

    2) rarely i faced this issue, when demand page is enabled, and if you requested for a large memory may be the memory is reserved but will be commit later on demand. Accessing the memory may some times create fault and cause exceptions. you may disable the demand page and try once.


    Please mark as answer, if it is correct.
    Please vote,if it is helpful post.
    Vinoth.R

    http://vinoth-vinothblog.blogspot.com
    http://www.e-consystems.com/windowsce.asp

    Friday, March 7, 2014 2:44 PM
  • Hi Vinoth,

    We are able to fix the above problem with correct values programmed to QSPI Controller registers, now we are able to erase, write and read to QSPI.

    It is also detecting in the Storage Manager applet, but NOR Flash folder is not getting mounted in the MyDevice, also Manual Format through Storage Manager is failing.

    Below is the registry entry for NOR Flash, please let me know for any changes/corrections. Thanks.

       

    IF BSP_NORFMD
    [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\NORFMD]
        "Dll"="flashmdd.dll"
        "Order"=dword:30
        "FlashPddDll"="norfmd.dll"
        "Prefix"="DSK"
        "Ioctl"=dword:4
        "Profile"="NORFMD"
        "IClass"=multi_sz:"{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"
        "FriendlyName"="NOR FLASH Driver"
    ; "BootPhase"=dword:1
    ;   "IoBase"=dword:C0000000
    ; "IoLen"=dword:01D00000 ;NOR flash memory size is increased to 29MB
    "Flags"=dword:1000

    ; Override names in default profile
    [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\NORFMD]
        "Name"="NOR FLASH"
        "Folder"="NOR Flash"
        "PartitionDriver"="FLASHPART.dll"
    "AutoMount"=dword:1
    "AutoPart"=dword:1
    "AutoFormat"=dword:1
    "DefaultFileSystem"="FATFS"
    ;"DriverPath"="Drivers\\BuiltIn\\NORFMD"
    ;"LoadFlags"=dword:1

    ; Uncomment to autoload NOR driver before device manager.
    ; Needed if registry is stored in NOR. Eg persistent storage
    [HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\NORFMD]
    "DriverPath"="Drivers\\BuiltIn\\NORFMD"
    "LoadFlags"=dword:1
    "Order"=dword:0
    ;"BootPhase"=dword:0

    [HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\ObjectStore]
       "MountAsBootable"=-

    [HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\NORFMD\FATFS]
    "MountAsBootable"=dword:1
    ; "Flags"=dword:14
    ; "EnableWriteBack"=dword:1
    ; "FormatTfat"=dword:1 

    ENDIF

    Regards,

    Ashfaque

    Edit.

    On running in Debug mode, i am getting some prints from FlashPddHelpder.cpp

    "VerifySectorsAreFree - Sectors (0x0, 0x1) are not free." prints are being displayed.

    Below are the prints.. Please provide inputs.

    PID:00400002 TID:00510002 QspiInit: Detected QSPI NOR Flash: PID:00400002 TID:00510002 N25Q00AA
    PID:00400002 TID:00510002 FMD_GetInfo: 
    PID:00400002 TID:00510002 FMD_GetInfo: 
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x0
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000000 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48deb3c
    PID:00400002 TID:00510002 dwSector:0x0
    PID:00400002 TID:00510002 dwBlockID:0x0
    PID:00400002 TID:00510002 dwSectorOffset:0x0
    PID:00400002 TID:00510002 BlockAddr:0x7fc0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FC0000 
     MappedSectorInfoAddr 0x07FCF800!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x8
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x1
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000100 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48deb3c
    PID:00400002 TID:00510002 dwSector:0x100
    PID:00400002 TID:00510002 dwBlockID:0x1
    PID:00400002 TID:00510002 dwSectorOffset:0x8
    PID:00400002 TID:00510002 BlockAddr:0x7fd0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FD0800 
     MappedSectorInfoAddr 0x07FDF840!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x0
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x2
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000200 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48deb3c
    PID:00400002 TID:00510002 dwSector:0x200
    PID:00400002 TID:00510002 dwBlockID:0x2
    PID:00400002 TID:00510002 dwSectorOffset:0x10
    PID:00400002 TID:00510002 BlockAddr:0x7fe0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FE1000 
     MappedSectorInfoAddr 0x07FEF880!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x0
    PID:00400002 TID:00510002  StartSector:f8 
    PID:00400002 TID:00510002  SectorIndex:0 
    PID:00400002 TID:00510002  SectorCount:1 
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x000000F8 
     dwNumSectors = 1 
     pSectorBuff = 0xCCC90010 
     pSectorInfoBuff = 0x00000000
    PID:00400002 TID:00510002 dwSector:0xf8
    PID:00400002 TID:00510002 dwBlockID:0x1
    PID:00400002 TID:00510002 dwSectorOffset:0x0
    PID:00400002 TID:00510002 BlockAddr:0x7fd0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FD0000 
     MappedSectorInfoAddr 0x07FDF800!
    PID:00400002 TID:00510002 QSPI_Read++++ Data Read
    PID:00400002 TID:00510002  StartSector:1f0 
    PID:00400002 TID:00510002  SectorIndex:0 
    PID:00400002 TID:00510002  SectorCount:1 
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x000001F0 
     dwNumSectors = 1 
     pSectorBuff = 0xCCC50CE0 
     pSectorInfoBuff = 0x00000000
    PID:00400002 TID:00510002 dwSector:0x1f0
    PID:00400002 TID:00510002 dwBlockID:0x2
    PID:00400002 TID:00510002 dwSectorOffset:0x0
    PID:00400002 TID:00510002 BlockAddr:0x7fe0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FE0000 
     MappedSectorInfoAddr 0x07FEF800!
    PID:00400002 TID:00510002 QSPI_Read++++ Data Read
    PID:00400002 TID:00510002  StartSector:f9 
    PID:00400002 TID:00510002  SectorIndex:0 
    PID:00400002 TID:00510002  SectorCount:1 
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x000000F9 
     dwNumSectors = 1 
     pSectorBuff = 0xCCC90110 
     pSectorInfoBuff = 0x00000000
    PID:00400002 TID:00510002 dwSector:0xf9
    PID:00400002 TID:00510002 dwBlockID:0x1
    PID:00400002 TID:00510002 dwSectorOffset:0x1
    PID:00400002 TID:00510002 BlockAddr:0x7fd0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FD0100 
     MappedSectorInfoAddr 0x07FDF808!
    PID:00400002 TID:00510002 QSPI_Read++++ Data Read
    PID:00400002 TID:00510002  StartSector:1f1 
    PID:00400002 TID:00510002  SectorIndex:0 
    PID:00400002 TID:00510002  SectorCount:1 
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x000001F1 
     dwNumSectors = 1 
     pSectorBuff = 0xCCC50CE0 
     pSectorInfoBuff = 0x00000000
    PID:00400002 TID:00510002 dwSector:0x1f1
    PID:00400002 TID:00510002 dwBlockID:0x2
    PID:00400002 TID:00510002 dwSectorOffset:0x1
    PID:00400002 TID:00510002 BlockAddr:0x7fe0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FE0100 
     MappedSectorInfoAddr 0x07FEF808!
    PID:00400002 TID:00510002 QSPI_Read++++ Data Read
    PID:00400002 TID:00510002 FMD_GetInfo: 
    PID:00400002 TID:00510002 FLASH Init Step Finish
    PID:00400002 TID:00510002 FMD_GetInfo: 
    PID:00400002 TID:00510002  StartSector:f8 
    PID:00400002 TID:00510002  SectorIndex:0 
    PID:00400002 TID:00510002  SectorCount:1 
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x000000F8 
     dwNumSectors = 1 
     pSectorBuff = 0xCCC50E10 
     pSectorInfoBuff = 0x00000000
    PID:00400002 TID:00510002 dwSector:0xf8
    PID:00400002 TID:00510002 dwBlockID:0x1
    PID:00400002 TID:00510002 dwSectorOffset:0x0
    PID:00400002 TID:00510002 BlockAddr:0x7fd0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FD0000 
     MappedSectorInfoAddr 0x07FDF800!
    PID:00400002 TID:00510002 QSPI_Read++++ Data Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x0
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000000 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48de890
    PID:00400002 TID:00510002 dwSector:0x0
    PID:00400002 TID:00510002 dwBlockID:0x0
    PID:00400002 TID:00510002 dwSectorOffset:0x0
    PID:00400002 TID:00510002 BlockAddr:0x7fc0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FC0000 
     MappedSectorInfoAddr 0x07FCF800!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x8
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x1
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000100 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48de890
    PID:00400002 TID:00510002 dwSector:0x100
    PID:00400002 TID:00510002 dwBlockID:0x1
    PID:00400002 TID:00510002 dwSectorOffset:0x8
    PID:00400002 TID:00510002 BlockAddr:0x7fd0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FD0800 
     MappedSectorInfoAddr 0x07FDF840!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x0
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x2
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000200 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48de890
    PID:00400002 TID:00510002 dwSector:0x200
    PID:00400002 TID:00510002 dwBlockID:0x2
    PID:00400002 TID:00510002 dwSectorOffset:0x10
    PID:00400002 TID:00510002 BlockAddr:0x7fe0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FE1000 
     MappedSectorInfoAddr 0x07FEF880!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x0
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x0
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000000 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48de82c
    PID:00400002 TID:00510002 dwSector:0x0
    PID:00400002 TID:00510002 dwBlockID:0x0
    PID:00400002 TID:00510002 dwSectorOffset:0x0
    PID:00400002 TID:00510002 BlockAddr:0x7fc0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FC0000 
     MappedSectorInfoAddr 0x07FCF800!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x8
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x1
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000100 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48de82c
    PID:00400002 TID:00510002 dwSector:0x100
    PID:00400002 TID:00510002 dwBlockID:0x1
    PID:00400002 TID:00510002 dwSectorOffset:0x8
    PID:00400002 TID:00510002 BlockAddr:0x7fd0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FD0800 
     MappedSectorInfoAddr 0x07FDF840!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x0
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x2
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000200 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48de82c
    PID:00400002 TID:00510002 dwSector:0x200
    PID:00400002 TID:00510002 dwBlockID:0x2
    PID:00400002 TID:00510002 dwSectorOffset:0x10
    PID:00400002 TID:00510002 BlockAddr:0x7fe0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FE1000 
     MappedSectorInfoAddr 0x07FEF880!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x0
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x3
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000300 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48de82c
    PID:00400002 TID:00510002 dwSector:0x300
    PID:00400002 TID:00510002 dwBlockID:0x3
    PID:00400002 TID:00510002 dwSectorOffset:0x18
    PID:00400002 TID:00510002 BlockAddr:0x7ff0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FF1800 
     MappedSectorInfoAddr 0x07FFF8C0!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x0
    PID:00400002 TID:00510002 FMD_GetBlockStatus+: blockID=0x1
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x00000100 
     dwNumSectors = 1 
     pSectorBuff = 0x00000000 
     pSectorInfoBuff = 0xc48de8e8
    PID:00400002 TID:00510002 dwSector:0x100
    PID:00400002 TID:00510002 dwBlockID:0x1
    PID:00400002 TID:00510002 dwSectorOffset:0x8
    PID:00400002 TID:00510002 BlockAddr:0x7fd0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FD0800 
     MappedSectorInfoAddr 0x07FDF840!
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FMD_GetBlockStatus- dwResult 0x0
    PID:00400002 TID:00510002 FMD_EraseBlock
    PID:00400002 TID:00510002  StartSector:f8 
    PID:00400002 TID:00510002  SectorIndex:0 
    PID:00400002 TID:00510002  SectorCount:1 
    PID:00400002 TID:00510002 QSPI_Read+ startSectorAddr = 0x000000F8 
     dwNumSectors = 1 
     pSectorBuff = 0xCCC50D00 
     pSectorInfoBuff = 0xccc6a500
    PID:00400002 TID:00510002 dwSector:0xf8
    PID:00400002 TID:00510002 dwBlockID:0x1
    PID:00400002 TID:00510002 dwSectorOffset:0x0
    PID:00400002 TID:00510002 BlockAddr:0x7fd0000
    PID:00400002 TID:00510002 QSPI_Read: MappedSectorAddr 0x07FD0000 
     MappedSectorInfoAddr 0x07FDF800!
    PID:00400002 TID:00510002 QSPI_Read++++ Data Read
    PID:00400002 TID:00510002 QSPI_Read++++ Info Read
    PID:00400002 TID:00510002 FlashPddHelper::VerifySectorsAreFree - Sectors (0x0, 0x1) are not free.
    PID:00400002 TID:00510002 Unknown: DEBUGCHK failed in file d:\bt\1577\private\winceos\drivers\msflash\flashmddcore\flashpddhelper.cpp at line 842 
    PID:00400002 TID:00510002 DEBUG_BREAK @ef77d4b8 Ignored.
    PID:00400002 TID:00510002 Unknown: DEBUGCHK failed in file d:\bt\1577\private\winceos\drivers\msflash\flashmddcore\flashpddhelper.cpp at line 329 
    PID:00400002 TID:00510002 DEBUG_BREAK @ef77ba54 Ignored.

    Ashfaque

    • Edited by AshfaqEmd Monday, March 10, 2014 1:08 PM Added debug logs
    Monday, March 10, 2014 7:23 AM