IDE and Flash Media InterfaceMCF5253 Reference Manual, Rev. 113-26 Freescale SemiconductorThe DATABITCOUNT is the number of bits in the packet. This includes the CRC bits. There are 16 CRCbits for each data line (16 CRC bits for the 1-bit bus, 64 CRC bits for the 4-bit bus). The number ofbits/bytes/longwords that need to be written to FLASHMEDIADATA1 corresponds withDATABITCOUNT. The user needs to write dummy data instead of the CRC bits toFLASHMEDIADATA1. The CRC value is calculated inside the Flash Media Interface, and the CRC bitswritten to FLASHMEDIADATA1 are discarded. All words, except the first word, written toFLASHMEDIADATA1 contain 32 bits of data. The first word contains the remainder. Data in the firstword must be left-justified.To read the CRC status, the host must read the FLASHMEDIADATA1 data register once. The CRC statusis the three LSB’s of the value read.During this sequence, the host must look for events on SHIFT_BUSY1 and INTERRUPT1. This isaccomplished by polling FLASHMEDIASTATUS or FLASHMEDIAINTSTATUS, or by waiting forinterrupts SHIFTBUSY1RISE, SHIFTBUSY1FALL, INTERRUPT1RISE, INTERRUPT1FALL.To read/write data to/from FLASHMEDIADATA1, the host can poll FLASHMEDIAINTSTAT, wait forinterrupt, or use a DMA channel. In Figure 13-26, the DATA lines default to a “P” state (strong ‘1’ drivenby host). This is only the case if DRIVEDATAMASK was set during last write to FLASHMEDIACMD2.Writing 0x3 to FLASHMEDIACMD1 must take place after SHIFTBUSY1 has gone high. One or morewrite packets can be sent to the card using this timing diagram.Figure 13-26. Read Data from CardThe DATABITCOUNT is the number of bits in the packet. This includes the CRC bits. There are 16 CRCbits for the 1-bit bus, 64 CRC bits for the 4-bit bus (16 CRC bits for the 1-bit bus, 64 CRC bits for the 4-bitbus). The number of bits/bytes/longwords that need to be read from FLASHMEDIADATA1 correspondswith DATABITCOUNT.The CRC can be read from FLASHMEDIADATA1, but the user does need to check the CRC in software.This is done in hardware. The CRC can be checked via bit 0 in register FLASHMEDIASTATUS afterpacket read. All words, except the first word read from FLASHMEDIADATA1 contain 32 bits of data.The first word contains the remainder. Data in the first word is right-justified.writeFLASHMEDIACMD1 =0x40000 +wideShiftMaskread one or moretimes fromFLASHMEDIADATA1Z Z S EdataBitCountP P PCard driving buswriteFLASHMEDIACMD1 =dataBitCount +readDataMask +wideShiftMaskDATA linesshift_busy1Note 3: Host interface will stop SCLK_OUT clock when needed to prevent transmit underrun or receive overrun. (not shown)Data CRCbitcounter1Note 1: For 4-bit wide bus, wideShiftMask is 0x400000, CRC length is 64 bitsFor 1-bit wide bus, wideShiftMask = 0, CRC length is 16 bits.Note 2: If read data packet followed by another read data packet (block read), setreadDataMask = 0x40000. If only one read data packet, set readDataMask = 0.readFLASHMEDIASTATUSExtract bit CRCOK1