CN100585627C - SD card control circuit and reading/writing method thereof based on the FLASH bus - Google Patents

SD card control circuit and reading/writing method thereof based on the FLASH bus Download PDF

Info

Publication number
CN100585627C
CN100585627C CN200810013706A CN200810013706A CN100585627C CN 100585627 C CN100585627 C CN 100585627C CN 200810013706 A CN200810013706 A CN 200810013706A CN 200810013706 A CN200810013706 A CN 200810013706A CN 100585627 C CN100585627 C CN 100585627C
Authority
CN
China
Prior art keywords
card
data
write
bus
flash
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN200810013706A
Other languages
Chinese (zh)
Other versions
CN101216898A (en
Inventor
陶圣华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Taixin Electronics Co Ltd
Original Assignee
JINAN TAIXIN ELECTRONIC CO Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by JINAN TAIXIN ELECTRONIC CO Ltd filed Critical JINAN TAIXIN ELECTRONIC CO Ltd
Priority to CN200810013706A priority Critical patent/CN100585627C/en
Publication of CN101216898A publication Critical patent/CN101216898A/en
Application granted granted Critical
Publication of CN100585627C publication Critical patent/CN100585627C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Bus Control (AREA)

Abstract

The invention discloses a kind of SD card control circuit and reading/writing method thereof based on the FLASH bus.It is higher that it has solved present SD card control circuit cost, and problems such as poor compatibility have simple in structurely, and cost is lower, compatible advantage such as good.Its structure is: it comprises processor, and processor is connected with storer, and processor is connected with NOR FLASH circuit with SD card read-write control circuit by the FLASH bus simultaneously, the CSO of processor, End is respectively the chip selection signal end of NOR FLASH and the chip selection signal end of SD card read-write control circuit, and is attached thereto.

Description

SD card control circuit and reading/writing method thereof based on the FLASH bus
Technical field
The present invention relates to a kind of SD card control circuit, relate in particular to a kind of SD card control circuit and reading/writing method thereof based on the FLASH bus.
Background technology
SD card (Secure Digital Memory Card) is a kind of memory device of new generation of based semiconductor fast-flash memory device.The SD card is developed in August, 1999 jointly by PANASONIC, Toshiba and U.S. SanDisk company.Size is just as the SD memory card of a stamp, and weight has only 2 grams, but the SD card has high memory capacity, rapid data transmission rate, great mobile dirigibility and well security.
The SD jig is equipped with serial and random access capability, can be by the serial interface access of optimal speed, and data transmission is reliable.Therefore this name of Secure Digital just has the meaning of " safe digital ".The SD cartoon is crossed the 9Pin interface and is connected with corresponding read-write equipment, and is not fragile owing to adopt the nand flash memory medium, reads and writes data, formats all more convenient, extensively adopted by plurality of devices such as MP3, digital camera, game machines.
The main way of realization of extension storage circuit of present stage SD card is divided into following three kinds:
A) use independently SD card control chip
This form, be to use independently SD card controller of special-purpose SD card control chip conduct, the read-write of independently bearing the SD card waits all controls, and is connected realization processor reading and storage operation SD card data with processor by the parallel or universal serial bus of system.
Owing to used the special integrated circuit of SD card, this implementation by hardware generation and control read-write sequence can have higher access speed, and is suitable for the realization of program, is applicable to for the higher occasion of the rate request of data access.But, must cause the rising of cost of products and the increase of PCB area because this kind implementation has increased independently control chip.For requiring the implementation method of strict this form of scheme just to seem that some is unable to do what one wishes to cost and the control of PCB area.
The scheme that this design form adopted simultaneously also has certain problem aspect compatible.For using same producer isonomic SD card control chip, the design of IC chip pin compatibility can also guarantee the versatility of PCB, but product still can be subjected to the influence of factors such as the source of goods and Product Renewal.And in case need other SD card control IC of change, then schematic diagram, PCB will do design again, the duplication of labour that this must cause design to produce, the increase of the indirect cost of products that causes.
B) the integrated SD card controller of primary processor
The integrated SD card controller of primary processor comes across the special chip of certain series products more.Here the pairing product of chip mainly is to use the field of portable internal memories such as SD card.SD is stuck in a large amount of uses on this series products, makes the integrated SD card controller of processor become requisite means, selects for use the processor of integrated SD card controller also to become the measure that this series products is controlled cost.
Though with respect to the SD card controller expansion scheme of separating, the expansion scheme of this class SD card has had certain cost advantage, and integrated SD controller also becomes an attractable point with respect to the like product of this function not.But because integrated SD card controller in the chip, its cost and price must have a certain upgrade.Simultaneously because integrated SD card controller, make the difficulty of chip design increase and the stability of chip also can be affected.
C) use the GPIO mouth to control the SD card
This scheme to be used in scheme cheaply.Program uses general programmable I/O mouth to simulate the SD bus of SD card or read-write control that spi bus is realized the SD card.This class scheme is owing to used the lower IO mouth of speed, and practical value is not high, only is to use in some low-speed applications.Along with the improving constantly and improving of flash technology, the capacity of SD card constantly increases, and the SD card scheme of this low speed can become more and more impracticable, and is eliminated gradually.
Above way of realization or do not preponderate on cost perhaps is restricted on speed, perhaps shortcoming to some extent on compatibility.
Summary of the invention
It is higher in order to solve present SD card control circuit cost that purpose of the present invention is exactly, and problems such as poor compatibility provide a kind of and have simple in structurely, and cost is lower, the SD card control circuit and the reading/writing method thereof based on the FLASH bus of compatible at a high speed advantage such as good.
For achieving the above object, the present invention adopts following technical scheme:
A kind of SD card control circuit based on the FLASH bus, it comprises processor, processor is connected with storer, processor is connected with SD card read-write control circuit, NOR FLASH circuit by the FLASH bus simultaneously, the CS0 of processor, SD_CS end is respectively the chip selection signal end of NOR FLASH and the chip selection signal end of SD card read-write control circuit, and is connected with the chip selection signal end of NOR FLASH and the chip selection signal end of SD card read-write control circuit;
Described SD card read-write control circuit comprises SD card connector CON2, eight bidirectional bus transceiver U1 and two inputs, four AND circuit U2;
Wherein the DATA0-DATA4 of FLASH bus end is connected to the A mouth of U1, and the data line SD_DATA0-SD_DATA3 in the SD bus of SD card, order wire SD_CMD are connected to the B mouth of U1; The enable signal OE that reads on the FLASH bus holds the direction base pin selection DIR that is connected to U1; The sheet that SD card read-write control circuit enable signal SD_CS end is connected to U1 selects pin OE; Write enable signal WE, read enable signal OE through the SD_CLK signal in the AND circuit U2 generation SD bus, the SCLK/CLK end of the SD_CLK signal termination SD card connector CON2 of U2.
SD_DATA0-SD_DATA3 in the DATA0-DATA3 of described FLASH bus and the SD bus is corresponding respectively, and the DATA4 of FLASH bus is corresponding with SD_CMD line in the SD bus.
A kind of reading/writing method of the SD card control circuit based on the FLASH bus, its method be,
1) processor is waited for the mutex amount of expression FLASH bus free time, when the mutex amount is idle, put low SD_CS signal, make SD card read-write control circuit be in strobe state, expression SD card read-write control circuit takies the FLASH bus, carries out exchanges data between processor and the SD card read-write control circuit;
2) the SD cartoon is crossed data line SD_DATA0-SD_DATA3, order wire SD_CMD and host exchanging data;
3) after the exchange of SD card and host data finishes, put high SD_CS signal, make SD card read-write control circuit be in non-strobe state, discharge the mutex amount, abdicate the FLASH bus, use for other equipment.
Described step 2) in, SD card and host exchanging data comprise:
Main frame to SD card write order and SD card to main frame respond command response and main frame to SD card write data and main frame from SD card reading of data;
After the SD card powers on, be in the card status recognition, wait for the clock period more than 74, main frame sends a series of orders to the SD card then, and SD enters data transmission state after being stuck in these orders of correct response;
At data transmission state, main frame sends to the SD card and reads or the write data order, and after obtaining correct command response, main frame writes data from SD card reading of data or to the SD card.
Described main frame to the method for SD card write order is, main frame is write the data of command sequence in the SD card by the round-robin mode, and each cycle master is write the data of a command byte in the SD card;
(1), being provided with, write command byte counter i is 0;
(2), i byte of command sequence write in the SD card;
(3), be the order transmission and finish, otherwise the value of write command byte counter i adds 1, returns step (2) if all command bytes of command sequence have all been write the SD card to have suffered; After order sends and finishes, judge whether to obtain the correct order of SD card and respond; If obtain correct response, execution in step (4) then; If do not obtain correct response, then wait for correct order response always, overtime up to awaiting a response, execution in step (4);
(4), put high SD_CS signal, make the SD card control circuit be in non-strobe state, discharge the mutex amount, withdraw from.
The method that described step (2) is write i byte of command sequence in the SD card is,
A, the value that counter w is set are 8;
The value of b, judgement w: if counter w equals 0, execution in step 4); If counter w is greater than 0, the expression command byte is not also write in the SD card fully, judges the value of the w position of command byte; If the w position is 0, then main frame is write data 0xEF on the FLASH data bus, and then by writing in the SD card 0 with the corresponding SD_CMD line of FLASH bus DATA4; If the w position is 1, then main frame is write data 0xFF on the FLASH data bus, and then by writing in the SD card 1 with the corresponding SD_CMD line of FLASH bus DATA4;
C, the value of counter w is subtracted 1, execution in step b;
D, command byte are write in the SD card fully, return.
When described main frame write data, host computer using round-robin mode was write the data of specified length in the SD card, and each cycle master is write the data of a byte in the SD card, and the method that a byte is write the SD card is:
At first, main frame is stored in high 4 of data byte data among the variable tmp1, and low 4 of data byte are stored among the variable tmp2;
Secondly, main frame is write the value of tmp1, tmp2 on the DATA0-DATA3 of FLASH data bus successively, and then by corresponding SD data line card SD_DATA0-SD_DATA3 data is write in the SD card; So far, the value of byte data data just is written to the SD card and has suffered.
Described main frame is during from SD card read data, and main frame reads the data of specified length by the round-robin mode from the SD card, and each cycle master reads the data of a byte from the SD card, and main frame from the method that the SD card reads a byte data is:
At first, main frame reads the deposit data of a byte to variable tmp1 from the FLASH data bus;
Secondly, main frame reads the deposit data of a byte to variable tmp2 from the FLASH data line again;
Once more, with tmp1 and 0x0F with, the result who obtains moved to left to compose after 4 gives variable data, with tmp2 and 0x0F with, with the result and the data addition that obtain, the result that addition is obtained composes to data again, the data of the data byte that to be main frame read from the SD card.
The logic of the present invention by read-write cooperates and the reasonable control of FLASH bus realized simulation to the SD read-write mode of SD card.Utilize simultaneously the FLASH bus high-speed, be easy to the transmission speed that programme controlled characteristics effectively raise the SD card.Sort circuit has extremely strong versatility, because all advantages of FLASH storer are supported it by the Embedded processor of the overwhelming majority.The FLASH bus has become the standard configuration of flush bonding processor, so should can in the scheme of any FLASH of having bus, use based on the SD card read-write control circuit of FLASH bus, and needn't be subject to whether integrated SD card controller of master chip, also needn't increase corresponding SD card control chip, only, just can realize SD card access facility at a high speed by a single AND circuit and a slice 74HC245 bidirectional bus driver and a spot of resistance capacitance.
The invention has the beneficial effects as follows: realized under situation cheaply SD card read-write control circuit by way of hardware and software combination, and realized high speed read-write control the SD card.This circuit has very strong versatility and compatibility.Go for the processor of any use NOR FLASH bus (hereinafter to be referred as the FLASH bus), make it just can realize the high speed read-write and the control of SD card by simple modification.With respect to the extended mode of traditional SD card apparatus, it not only has with low cost, highly versatile, and the transmission speed advantages of higher, and have the reliability height, be easy to advantages such as program realization.
Description of drawings
Fig. 1 is a structured flowchart of the present invention;
Fig. 2 is SD card read-write control circuit figure;
Fig. 3 is a SD card command sequence transmission block diagram;
Fig. 4 writes the operational block diagram of single byte to the SD card for main frame;
Fig. 5 is for reading the operational block diagram of single byte from the SD card;
Fig. 6 is for writing the operational block diagram of single byte to the SD card.
Wherein, 1. storer, 2. processor, 3.NOR FLASH circuit, 4.FLASH bus, 5.SD card read-write control circuit.
Embodiment
The invention will be further described with enforcement below in conjunction with accompanying drawing.
Among Fig. 1, the present invention includes processor 2, processor 2 is connected with storer 1, processor 2 is connected with NOR FLASH circuit 3 with SD card read-write control circuit by FLASH bus 4 simultaneously, the CS0 of processor 2, SD_CS is respectively the chip selection signal end of NOR FLASH and the chip selection signal end of SD card read-write control circuit 5, and is connected with SD card read-write control circuit 5 with the chip selection signal end of NOR FLASH.
Among Fig. 2, SD card read-write control circuit comprises SD card connector CON2, eight bidirectional bus transceiver U1 and two inputs, four AND circuit U2, wherein the DATA0-DATA4 of FLASH bus is connected to the A mouth of U1, and the data line SD_DATA0-SD_DATA3 in the SD bus of SD card, order wire SD_CMD are connected to the B mouth of U1; Reading on the FLASH bus enables the direction base pin selection DIR that OE signal (low level is effective) is connected to U1; The sheet that SD card circuit enable signal SD_CS is connected to U1 selects pin OE (low level is effective); Write enable signal WE (low level is effective), read enable signal OE (low level is effective) through producing SD_CLK signal in the SD bus, and be connected with the SCLK/CLK end of SD card connector CON2 with door U2.
When described U1 circuit need stick into line operate to SD in system, it is low that the SD card selects signal SD_CS to put, and enables U1; When inoperation SD card, then the chip selection signal SD_CS of SD card puts height, and the A of U1, B mouth are in high-impedance state, can not impact SD card and FLASH bus
If write operation then the OE signal put height and the WE signal is put low, the transmission direction of data is set to A mouth → B mouth because the DIR pin of U1 is put high cause, be FLASH bus → SD bus, data on the FLASH bus or order can be sent on the SD bus;
If read operation, then the OE signal is put low and the WE signal is put height, and it is low that the DIR pin of U1 is put, and the transmission direction of data is set to B mouth → A mouth, i.e. SD bus → FLASH bus, and data on the SD bus or response then can be sent on the FLASH bus.
SD_DATA0-3 in DATA0-3 in the described FLASH bus and the SD bus is corresponding respectively, and the DATA4 of FLASH bus is corresponding with SD_CMD line in the SD bus.
U2 plays the CLK signal effect that produces the SD bus in circuit.Because reading and writing operation OE signal or WE signal to data on the FLASH bus are all remained valid for the rising edge data, and also be to keep during at the CLK rising edge data effective in data on the SD bus (SD_DATA0-3) or order (SD_CMD), therefore, only need with OE and WE signal with, just can guarantee the CLK sequential of the complete compatible to SD pattern of CLK when the read operation of data and write operation, it is effective to remain the rising edge data.
When the SD card control circuit is in strobe state, if read SD card operation (containing the response of reading of data and reading order), then processor is put low OE signal (effectively low) when reading of data begins, put high WE signal, because the OE signal is low, so the direction of U1 is to the A mouth from the B mouth, be that direction is: from SD card data bus SD_DATA3-0 (or order wire CMD) to FLASH data bus DATA3-0 (or data line DATA4), 4 valid data exporting on the SD card data bus (or the response of 1 order of the bit on the order wire), be sent to the FLASH bus by U1 by the SD bus, and read by primary processor, it is paramount from low saltus step to read end back OE, so far the OE signal forms a CLK waveform (it is high that WE is always) through U2, and SD prepares the output of next 4 bit data (or the response of 1 order of the bit).Thereby finish the read operation of SD card 4 bit data (or the response of 1 order of the bit); In like manner, if write SD card operation (contain and write data and write command), then processor is put low WE signal (effectively low) when writing data and begin, put high OE signal, because the OE signal is high, so the direction of U1 is to the B mouth from the A mouth, be that direction is: from FLASH data bus DATA3-0 (or data line DATA4) to SD card data bus SD_DATA3-0 (or order wire CMD), 4 valid data (or 1 order of the bit) of exporting on the FLASH bus, be sent to the SD bus by U1 by the FLASH bus, when writing data, under the situation that data are remained valid, the WE signal is paramount from low saltus step, and so far the WE signal forms a CLK waveform (it is high that OE is always) through U2,4 bit data (or 1 order of the bit) are write the SD card, thereby finish the write operation of SD card 4 bit data (or 1 order of the bit).
When the SD card control circuit is in non-strobe state, data bus DATA3-0 and SD card bus SD_DATA3-0 are in non-connected state, for the SD card, the SD bus is because the cause of pull-up resistor is in high level, when reading the content of SD card address, the OE signal of processor is put low respectively when reading beginning and reading end and is put height, the OE signal is through producing a SD_CLK signal on the SD bus (it is high that WE is always) with door U2, this CLK signal can be used as the time-delay clock of SD card read-write, thereby finishes some necessary clock delay operation.
Based on Fig. 1, hardware connection mode shown in Figure 2, software control method of the present invention is:
A) processor is waited for the mutex amount of expression FLASH bus free time, when semaphore is idle, put low SD_CS signal, make the SD card control circuit be in strobe state, expression SD card control circuit takies the FLASH bus, can carry out exchanges data between processor and the SD card control circuit;
B) the SD cartoon is crossed data line SD_DATA0-SD_DATA3, order wire SD_CMD and host exchanging data;
C) after the exchange of SD card and host data finishes, put high SD_CS signal, make the SD card control circuit be in non-strobe state,
Discharge the mutex amount, abdicate the FLASH bus, use for other equipment.
Illustrate that SD card and the host exchanging data described in 1. step b) comprises: main frame to SD card write order and SD card to main frame respond command response and main frame to SD card write data and main frame from SD card reading of data;
After the SD card powers on, be in the card status recognition, wait for the clock period more than 74, main frame sends a series of orders to the SD card then, and SD enters data transmission state after being stuck in these orders of correct response;
At data transmission state, main frame sends to the SD card and reads or the write data order, and after obtaining correct command response, main frame reads or writes data to the SD card from the SD card.
Illustrate 2. according to 1 described main frame being described to SD card write order, its method is: main frame is write the command sequence data in the SD card, as shown in Figure 3 by the round-robin mode:
1), wait-semaphore, when semaphore is idle, put low SD_CS signal, gating SD card control circuit;
2), being provided with, write command byte counter i is 0;
3), i byte of command sequence write in the SD card;
4), be the order transmission and finish, otherwise the value of write command byte counter i adds 1, returns step 3) if all command bytes of command sequence have all been write the SD card to have suffered.After order sends and finishes, judge whether to obtain the correct order of SD card and respond; If obtain correct response, then execution in step 5); If do not obtain correct response, then wait for correct order response always, overtime up to awaiting a response, execution in step 5);
5), put high SD_CS signal, make the SD card control circuit be in non-strobe state, discharge the mutex amount, withdraw from.
Illustrate that 3. write the command sequence data in the SD card by the round-robin mode according to explanation 2 described main frames, its method is: each cycle master is write command byte data in the SD card, as shown in Figure 4:
1), the value that counter w is set is 8;
2), judge the value of w:, execution in step 4) if counter w equals 0; If counter w is greater than 0, the expression command byte is not also write in the SD card fully, judges the value of the w position of command byte.If the w position is 0, then main frame is write data 0xEF on the FLASH data bus, and then by writing in the SD card 0 with the corresponding SD_CMD line of FLASH bus DATA4; If the w position is 1, then main frame is write data 0xFF on the FLASH data bus, and then by writing in the SD card 1 with the corresponding SD_CMD line of FLASH bus DATA4;
3), the value with counter w subtracts 1, execution in step 2);
4), command byte write in the SD card fully, return.
Illustrate 4. according to illustrating that 1 described main frame is from SD card read data, its method is: main frame reads the data of specified length from the SD card by the round-robin mode, each cycle master reads the data of a byte from the SD card, and main frame reads the method for a byte data from the SD card, as shown in Figure 5:
1), main frame reads the deposit data of a byte to variable tmp1 from the FLASH data bus;
2), main frame reads the deposit data of a byte to variable tmp2 from the FLASH data bus again;
3), with tmp1 and 0x0F with, the result who obtains moved to left to compose after 4 gives variable data, with tmp2 and 0x0F with, with result and the data addition that obtains, the result that addition is obtained composes to data again, the data of the data byte that to be main frame read from the SD card.
Illustrate 5. according to illustrating that 1 described main frame writes data into the SD card, its method is: host computer using round-robin mode is write the data of specified length in the SD card, each cycle master is write the data of a byte in the SD card, and a byte is write the method for SD card, as shown in Figure 6:
1), main frame is stored in high 4 of data byte data among the variable tmp1, low 4 of data byte are stored among the variable tmp2;
2), main frame is write the value of tmp1, tmp2 successively on the DATA0-3 of FLASH data bus, and then by corresponding SD data line card SD_DATA0-3 data is write in the SD card; So far, the value of byte data data just is written to the SD card and has suffered.

Claims (8)

1, a kind of SD card control circuit based on the FLASH bus, it is characterized in that: it comprises processor, processor is connected with storer, processor is connected with SD card read-write control circuit, NOR FLASH circuit by the FLASH bus simultaneously, the CSO of processor, SD_CS end is respectively the chip selection signal end of NOR FLASH and the chip selection signal end of SD card read-write control circuit, and is connected with the chip selection signal end of NORFLASH and the chip selection signal end of SD card read-write control circuit;
Described SD card read-write control circuit comprises SD card connector CON2, eight bidirectional bus transceiver U1 and two inputs, four AND circuit U2;
Wherein the DATA0-DATA4 of FLASH bus end is connected to the A mouth of U1, and the data line SD_DATA0-SD_DATA3 in the SD bus of SD card, order wire SD_CMD are connected to the B mouth of U1; The enable signal OE that reads on the FLASH bus holds the direction base pin selection DIR that is connected to U1; The sheet that SD card read-write control circuit enable signal SD_CS end is connected to U1 selects pin OE; Write enable signal WE, read enable signal OE through the SD_CLK signal in the AND circuit U2 generation SD bus, the SCLK/CLK end of the SD_CLK signal termination SD card connector CON2 of U2.
2, the SD card control circuit based on the FLASH bus according to claim 1, it is characterized in that: the SD_DATA0-SD_DATA3 in the DATA0-DATA3 of described FLASH bus and the SD bus is corresponding respectively, and the DATA4 of FLASH bus is corresponding with SD_CMD line in the SD bus.
3, the reading/writing method of the described SD card control circuit based on the FLASH bus of a kind of claim 1 is characterized in that: its method is,
1) processor is waited for the mutex amount of expression FLASH bus free time, when the mutex amount is idle, put low SD_CS signal, make SD card read-write control circuit be in strobe state, expression SD card read-write control circuit takies the FLASH bus, carries out exchanges data between processor and the SD card read-write control circuit;
2) the SD cartoon is crossed data line SD_DATA0-SD_DATA3, order wire SD_CMD and host exchanging data;
3) after the exchange of SD card and host data finishes, put high SD_CS signal, make SD card read-write control circuit be in non-strobe state, discharge the mutex amount, abdicate the FLASH bus, use for other equipment.
4, the reading/writing method of the SD card control circuit based on the FLASH bus according to claim 3, it is characterized in that: described step 2), SD card and host exchanging data comprise:
Main frame to SD card write order and SD card to main frame respond command response and main frame to SD card write data and main frame from SD card reading of data;
After the SD card powers on, be in the card status recognition, wait for the clock period more than 74, main frame sends a series of orders to the SD card then, and SD enters data transmission state after being stuck in these orders of correct response;
At data transmission state, main frame sends to the SD card and reads or the write data order, and after obtaining correct command response, main frame writes data from SD card reading of data or to the SD card.
5, the reading/writing method of the SD card control circuit based on the FLASH bus according to claim 4, it is characterized in that: described main frame to the method for SD card write order is, main frame is write the data of command sequence in the SD card by the round-robin mode, and each cycle master is write the data of a command byte in the SD card;
(1), being provided with, write command byte counter i is 0;
(2), i byte of command sequence write in the SD card;
(3), be the order transmission and finish, otherwise the value of write command byte counter i adds 1, returns step (2) if all command bytes of command sequence have all been write the SD card to have suffered; After order sends and finishes, judge whether to obtain the correct order of SD card and respond; If obtain correct response, execution in step (4) then; If do not obtain correct response, then wait for correct order response always, overtime up to awaiting a response, execution in step (4);
(4), put high SD_CS signal, make SD card read-write control circuit be in non-strobe state, discharge the mutex amount, withdraw from.
6, the reading/writing method of the SD card control circuit based on the FLASH bus according to claim 5 is characterized in that: the method that described step (2) is write i byte of command sequence in the SD card is,
A, the value that counter w is set are 8;
The value of b, judgement w: if counter w equals 0, execution in step d; If counter w is greater than 0, the expression command byte is not also write in the SD card fully, judges the value of the w position of command byte; If the w position is 0, then main frame is write data OxEF on the FLASH data bus, and then by writing in the SD card 0 with the corresponding SD_CMD line of FLASH bus DATA4; If the w position is 1, then main frame is write data OxFF on the FLASH data bus, and then by writing in the SD card 1 with the corresponding SD_CMD line of FLASH bus DATA4;
C, the value of counter w is subtracted 1, execution in step b;
D, command byte are write in the SD card fully, return.
7, the reading/writing method of the SD card control circuit based on the FLASH bus according to claim 4, it is characterized in that: when described main frame writes data, host computer using round-robin mode is write the data of specified length in the SD card, each cycle master is write the data of a byte in the SD card, and the method that a byte is write the SD card is:
At first, main frame is stored in high 4 of data byte data among the variable tmp1, and low 4 of data byte are stored among the variable tmp2;
Secondly, main frame is write the value of tmp1, tmp2 on the DATA0-DATA3 of FLASH data bus successively, and then by corresponding SD data line card SD_DATA0-SD_DATA3 data is write in the SD card; So far, the value of byte data data just is written to the SD card and has suffered.
8, the reading/writing method of the SD card control circuit based on the FLASH bus according to claim 4, it is characterized in that: described main frame is during from SD card read data, main frame reads the data of specified length from the SD card by the round-robin mode, each cycle master reads the data of a byte from the SD card, and main frame from the method that the SD card reads a byte data is:
At first, main frame reads the deposit data of a byte to variable tmp1 from the FLASH data bus;
Secondly, main frame reads the deposit data of a byte to variable tmp2 from the FLASH data line again;
Once more, with tmp1 and OxOF with, the result who obtains moved to left to compose after 4 gives variable data, with tmp2 and OxOF with, with the result and the data addition that obtain, the result that addition is obtained composes to data again, the data of the data byte that to be main frame read from the SD card.
CN200810013706A 2008-01-03 2008-01-03 SD card control circuit and reading/writing method thereof based on the FLASH bus Expired - Fee Related CN100585627C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200810013706A CN100585627C (en) 2008-01-03 2008-01-03 SD card control circuit and reading/writing method thereof based on the FLASH bus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200810013706A CN100585627C (en) 2008-01-03 2008-01-03 SD card control circuit and reading/writing method thereof based on the FLASH bus

Publications (2)

Publication Number Publication Date
CN101216898A CN101216898A (en) 2008-07-09
CN100585627C true CN100585627C (en) 2010-01-27

Family

ID=39623329

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200810013706A Expired - Fee Related CN100585627C (en) 2008-01-03 2008-01-03 SD card control circuit and reading/writing method thereof based on the FLASH bus

Country Status (1)

Country Link
CN (1) CN100585627C (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101521956B (en) * 2008-12-19 2014-02-12 康佳集团股份有限公司 Method for reading and writing T card through GPIO port, system and mobile phone
CN105117179A (en) * 2015-09-22 2015-12-02 天津瑞发科半导体技术有限公司 Method for data interaction of host and storage device and storage controller
CN106022406B (en) * 2016-05-18 2019-04-16 深圳市微网力合信息技术有限公司 Read and write the method and device of SD card

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2480914Y (en) * 2001-06-21 2002-03-06 深圳市融通天识科技有限公司 Fingerprint identifier with IC card read/write device
CN2513166Y (en) * 2001-12-26 2002-09-25 上海海鸥照相机有限公司 Direct storage access device for small data access device
CN1818893A (en) * 2006-03-14 2006-08-16 杭州华为三康技术有限公司 LPC bus interface sequential conversion and converter of peripheral apparatus
CN201142081Y (en) * 2008-01-03 2008-10-29 济南市泰信电子有限责任公司 High efficiency low cost SD card control circuit based on FLASH bus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2480914Y (en) * 2001-06-21 2002-03-06 深圳市融通天识科技有限公司 Fingerprint identifier with IC card read/write device
CN2513166Y (en) * 2001-12-26 2002-09-25 上海海鸥照相机有限公司 Direct storage access device for small data access device
CN1818893A (en) * 2006-03-14 2006-08-16 杭州华为三康技术有限公司 LPC bus interface sequential conversion and converter of peripheral apparatus
CN201142081Y (en) * 2008-01-03 2008-10-29 济南市泰信电子有限责任公司 High efficiency low cost SD card control circuit based on FLASH bus

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
一种SD卡控制器的硬件实现. 左源,刘新宁,师超.电子器件,第30卷第2期. 2007
一种SD卡控制器的硬件实现. 左源,刘新宁,师超.电子器件,第30卷第2期. 2007 *

Also Published As

Publication number Publication date
CN101216898A (en) 2008-07-09

Similar Documents

Publication Publication Date Title
CN101382927B (en) High speed serial peripheral interface circuit integrated in chip
US7802061B2 (en) Command-based control of NAND flash memory
CN201886122U (en) PXI (PCI extension for instrumentation) bus-based digital testing module
CN102012885A (en) System and method for realizing communication by adopting dynamic I2C bus
CN201514738U (en) LED display screen
CN206557758U (en) A kind of NAND FLASH storage chip array control unit expansible based on FPGA
CN1127026C (en) Method and apparatus for adapting an asynchronous bus to a synchronous circuit
CN109189203A (en) Server power saving apparatus and its power-saving method
CN101436171A (en) Modular communication control system
CN102999453A (en) Universal nonvolatile memory control device for system on chip
CN100585627C (en) SD card control circuit and reading/writing method thereof based on the FLASH bus
CN106802870A (en) A kind of efficient embedded system chip Nor Flash controllers and control method
CN103019988B (en) Computer, embedded controller and method thereof
CN202584143U (en) A read-only card reader with multiple interfaces
CN201142081Y (en) High efficiency low cost SD card control circuit based on FLASH bus
CN112269754A (en) LPC bus EMC extension device based on FPGA
CN206331414U (en) A kind of solid state hard disc
WO2008025238A1 (en) Storage device with large capacity and method based on flash memory
CN102567270A (en) USB (universal serial bus)-to-I2C (inter-integrated circuit) adapter
CN209199608U (en) Read and write the switching strobe unit of more optical module EEPROM
CN100394359C (en) Interface for intelligent card simulative debugging system
CN101436119A (en) System and method for media card communication
CN2567638Y (en) Multifunction read-write apparatus of computer
CN208077160U (en) SD card driver based on SPI mode
CN1315054C (en) A smart card simulating card

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C56 Change in the name or address of the patentee

Owner name: SHANDONG TAIXIN ELECTRONIC CO., LTD.

Free format text: FORMER NAME: JINAN TAIXIN ELECTRONIC CO., LTD.

CP03 Change of name, title or address

Address after: Xinluo Avenue high tech Zone of Ji'nan City, Shandong province 250101 silver bearing No. 2008 building 1-501-1

Patentee after: Shandong Taixin Electronics Co., Ltd.

Address before: Lixia District, Shandong city of Ji'nan Province Cultural Road 250012 No. 13 Haichen building 6 floor

Patentee before: Jinan Taixin Electronic Co., Ltd.

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100127

Termination date: 20170103

CF01 Termination of patent right due to non-payment of annual fee