Page 3
The following revision history table summarizes changes contained in this document. For your convenience, the page number designators have been linked to the appropriate location. Revision History Revision Page Date Description Level Number(s) 01/2005 Initial release MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 4
Revision History MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
DVD-ROM drives. The UF32 also enables controls of different common Flash memory devices including: CompactFlash, Secure Digital, MultiMediaCard, SmartMedia and Memory Stick memory cards. The availability of up to 75 programmable I/O lines helps to minimize the system costs and enhance flexibility. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
The UF32 contains CF, MS, SM and SD host controller interfaces that can direct connect to the memory cards. Only pullup and pulldown resistors are needed to connect the UF32 to the memory cards. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 10
System Overview MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
UF32, a 12V to 5V DC-DC converter, a RS-232 transceiver and some other glue logics. It has built-in sockets for the mass storage memory cards. Please refer to the user manual of the board for detail operations. Figure 2-1. M68EVB912UF32 Evaluation Board MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Timer, Voltage Regulator, IQUEUE RAM, IQUEUE, and USB Controller. The main program continually checks and serves different event tasks. The memory card host controller will be initialized after the card is inserted. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
100ms. The time interval is defined in the timer hook function. If any card is detected to be inserted, the handler will enable and initialize the card host controller. If any card is detected to be removed, the handler will disable the card host controller. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
USB Device Requests are sent and completed through Control Transfer using endpoint 0. The requests and the parameters are sent to the device in the setup packet. There are two kinds of requests. They are called standard requests and class specific requests. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
USB Bulk IN and OUT endpoints, set the Queue channels for USB transmit and receive, enable USB Bulk IN and OUT endpoint interrupts, and set the maximum buffer sizes of the Bulk-IN and OUT endpoints depending on the USB speeds. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
When reading data from a memory card, QC1REQ is set to USB receive and QC2REQ is set to Memory Card transmit. When writing data to the device, QC3REQ is set to USB transmit and QC4REQ is set to Memory Card receive. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
The host shall send out a Command Block Wrapper through an OUT endpoint before sending out data or requesting the device to return data. The device then responses with the Command Status Wrapper. Figure 6-1 shows the command data status flow. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Each card has its individual mass storage processor file. For example, the “CFMS_Processor.c” handles the USB command block wrapper for CompactFlash card. The “USBMS_Process.c” contains common routines that are used for all the card mass storage processors. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
512 bytes plus 16 extra bytes. Block is the memory erase unit and a block equals 16 pages (8K bytes) or 32 pages (16K bytes). In MS and SM, the block address to access data is called the Physical MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 30
After that, the block of physical address 4 will be marked as an empty block. The block of physical address 7 will become the cluster 3 with logical block addresses from 96 to 127. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
“LogToPhyTbl” is updated if necessary. The PBA is then retrieved from the “LogToPhyTbl”. The data is written to the PBA. For CF and SD, the data is written to the LBA directly. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
SCSI command read packet. The data of the corresponding LBA will be sent to host once the UF32 received the SCSI read command. The logical to physical block address translation is needed for SM and MS only. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 33
Decode LBA to PBA Get data from Card LBA Send out data to host via IQUEU Finish reading all LBAs ? RETURN Figure 7-5. SCSI Command Read Packet MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 34
Memory Cards Mass Storage Drivers MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
The mini-kernel project creates mini-kernel library file for the Card Reader project use. If this project is modified, the new library file can be copied for the Card Reader project use by running the “copyfile.bat” batch file. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 36
Testing and Customization MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 37
For example, 234 (decimal) = 0010 0011 0100 (BCD) bit — A binary digit. A bit has a value of either logic 0 or logic 1. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 38
The outputs of the control unit drive the execution unit, which contains the arithmetic logic unit (ALU), CPU registers, and bus interface. COP — See “computer operating properly module (COP).” MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 39
(ECT) — The HC12 Enhanced Capture Timer module has the features of the HC12 Standard Timer module enhanced by additional features in order to enlarge the field of applications. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 40
— The time lag between instruction completion and data movement. least significant bit (LSB) — The rightmost digit of a binary number. logic 1 — A voltage level approximately equal to the input power voltage (V MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 41
— A binary code that instructs the CPU to perform an operation. open-drain — An output that has no pullup transistor. An external pullup device can be connected to the power supply to provide the logic 1 output voltage. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 42
RAM address is in the stack pointer. pullup — A transistor in the output of a logic gate that connects the output to the logic 1 voltage of the power supply. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 43
— A portion of RAM reserved for storage of CPU register contents and subroutine return addresses. stack pointer (SP) — A 16-bit register in the CPU containing the address of the next available storage location on the stack. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 44
— Connection of circuit outputs so that if any output is high, the connection point is high. word — A set of two bytes (16 bits). write — The transfer of a byte of data from the CPU to a memory location. MC9S12UF32 Card Reader Reference Design User Manual, Rev. 0.1 Freescale Semiconductor...
Page 46
Freescale Semiconductor assume any liability arising out of the application or use of any Japan: product or circuit, and specifically disclaims any and all liability, including without Freescale Semiconductor Japan Ltd.
Need help?
Do you have a question about the MC9S12 and is the answer not in the manual?
Questions and answers