DocID025202 Rev 7
276/1080
RM0365
Flexible static memory controller (FSMC)
286
To perform an ECC computation:
1.
Enable the ECCEN bit in the FMC_PCR2/3 register.
2. Write data to the NAND Flash memory page. While the NAND page is written, the ECC
block computes the ECC value.
3. Read the ECC value available in the FMC_ECCR2/3 register and store it in a variable.
4. Clear the ECCEN bit and then enable it in the FMC_PCR2/3 register before reading
back the written data from the NAND page. While the NAND page is read, the ECC
block computes the ECC value.
5. Read the new ECC value available in the FMC_ECCR2/3 register.
6. If the two ECC values are the same, no correction is required, otherwise there is an
ECC error and the software correction routine returns information on whether the error
can be corrected or not.
14.6.7 PC
Card/CompactFlash
operations
Address spaces and memory accesses
The FMC supports CompactFlash devices and PC Cards in Memory mode and I/O mode
(True IDE mode is not supported).
The CompactFlash and PC Cards are made of 3 memory spaces:
•
Common Memory space
•
Attribute space
•
I/O Memory space
The nCE2 and nCE1 pins (FMC_NCE4_2 and FMC_NCE4_1 respectively) select the card
and indicate whether a byte or a word operation is being performed: nCE2 accesses the odd
byte on D15-8 and nCE1 accesses the even byte on D7-0 if A0=0 or the odd byte on D7-0 if
A0=1. The full word is accessed on D15-0 if both nCE2 and nCE1 are low.
The memory space is selected by asserting low nOE for read accesses or nWE for write
accesses, combined with the low assertion of nCE2/nCE1 and nREG.
•
If pin nREG=1 during the memory access, the common memory space is selected
•
If pin nREG=0 during the memory access, the attribute memory space is selected
The I/O space is selected by asserting nIORD space for read accesses or nIOWR for write
accesses [instead of nOE/nWE for memory space], combined with nCE2/nCE1. Note that
nREG must also be asserted low when accessing I/O space.
Three type of accesses are allowed for a 16-bit PC Card:
•
Accesses to Common Memory space for data storage can be either 8-bit accesses at
even addresses or 16-bit AHB accesses.
Note that 8-bit accesses at odd addresses are not supported and nCE2 will not be
driven low. A 32-bit AHB request is translated into two 16-bit memory accesses.
•
Accesses to Attribute Memory space where the PC Card stores configuration
information are limited to 8-bit AHB accesses at even addresses.
Note that a 16-bit AHB access will be converted into a single 8-bit memory transfer:
nCE1 will be asserted low, nCE2 will be asserted high and only the even byte on D7-D0
will be valid. Instead a 32-bit AHB access will be converted into two 8-bit memory