CN104699418B - The method and apparatus of abnormal restoring is carried out to safe digital card - Google Patents

The method and apparatus of abnormal restoring is carried out to safe digital card Download PDF

Info

Publication number
CN104699418B
CN104699418B CN201410130217.4A CN201410130217A CN104699418B CN 104699418 B CN104699418 B CN 104699418B CN 201410130217 A CN201410130217 A CN 201410130217A CN 104699418 B CN104699418 B CN 104699418B
Authority
CN
China
Prior art keywords
read
combined information
packet
write
sent
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.)
Active
Application number
CN201410130217.4A
Other languages
Chinese (zh)
Other versions
CN104699418A (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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201410130217.4A priority Critical patent/CN104699418B/en
Publication of CN104699418A publication Critical patent/CN104699418A/en
Application granted granted Critical
Publication of CN104699418B publication Critical patent/CN104699418B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses the method and apparatus that abnormal restoring is carried out to safe digital card SD, wherein, this method includes:It is abnormal to determine that safe digital card SD occurs;Continue to send combined information to SD, the combined information includes clock signal and idle state command;It is determined that the time for sending combined information is more than setting time, SD driving initialization procedures are performed;Test is written and read to SD, if receiving the response message from SD, it is determined that be successfully recovered.The present invention program is not limited by equipment self structure, SD can not be re-powered and realize abnormal restoring.

Description

The method and apparatus of abnormal restoring is carried out to safe digital card
Technical field
The present invention relates to the information processing technology, more particularly to the method and apparatus of abnormal restoring is carried out to safe digital card.
Background technology
Safe digital card(SD, Secure Digital Memory Card)It is a kind of based on semiconductor fast-flash memory device Memory device of new generation, it is divided into SD, miniSD etc. according to the difference of encapsulation, profile is variant, but has no essential distinction.
After SD is connected into main frame, main frame can be written and read operation, and data or write-in data are read from SD.In read-write operation In, in fact it could happen that the situation of operation exception, specifically:Main frame(Host)After sending read write command to SD, wait for a period of time, SD Still main frame is not responded, now, SD DATA0 pins measured, its always low level;It is low according to SD agreements Level indicating SD is in busy(busy)State, also mention in SD agreements, after sending the read write command on a certain packet, It can be completed in 500 milliseconds;Thus would know that, if DATA0 pins are still in busy within a period of time after 500 milliseconds State, then it can determine that SD is in abnormality.
SD abnormal restoring is illustrated below.
It is attached between the processor and SD of main frame by multiple I/O interfaces, including the electricity of control SD restartings Source I/O interface.In this kind equipment, SD power supplys and processor power supply are each independent, and are not attached to lead to.When there are SD exceptions, main frame Control SD to be re-powered by power supply I/O interface, so, SD abnormal restoring is realized by the restarting to SD.
In practical application, because I/O interface is more in short supply, the processor of many equipment does not possess enough I/O interfaces and used In the again upper electricity of abnormal restoring.In this case, SD power supplys and processor power supply be not by the way of being independently arranged, and adopts With the mode directly connected;For this kind of situation, when SD is in abnormality, the uncontrollable SD of processor is restarted, it is impossible to extensive Multiple abnormal, according to the mode all restarted to main frame and SD, its speed is slow, and will also influence other industry of main frame Business, its exploitativeness are poor.
To sum up, many equipment are limited by its own structure, do not support that electricity is restarted on independent to SD under abnormality, Lead to not complete abnormal restoring.
The content of the invention
The invention provides a kind of method that abnormal restoring is carried out to safe digital card, this method is not by equipment self structure Limitation, SD can not be re-powered and realize abnormal restoring.
The invention provides a kind of equipment that abnormal restoring is carried out to safe digital card, the equipment is not limited by self structure System, can not be re-powered to SD and realize abnormal restoring.
A kind of method that abnormal restoring is carried out to safe digital card, this method include:
It is abnormal to determine that safe digital card SD occurs;
Continue to send combined information to SD, the combined information includes clock signal and idle state command;
It is determined that the time for sending combined information is more than setting time, SD driving initialization procedures are performed;
Test is written and read to SD, if receiving the response message from SD, it is determined that be successfully recovered.
A kind of equipment that abnormal restoring is carried out to safe digital card, the equipment includes abnormal determining module, combined information is sent out Give and initialization module and test determining module;
The abnormal determining module, it is abnormal to determine that SD occurs, to combined information transmission and initialization module transmission group Close information and send instruction;
The combined information is sent and initialization module, receives combined information and sends instruction, continues to send combination letter to SD Breath, the combined information include clock signal and idle state command;It is determined that the time for sending combined information is more than setting time, SD driving initialization procedures are performed, test instruction is sent to the test determining module;
The test determining module, receive from combined information transmission and the test of initialization module instruction, to SD Test is written and read, if receiving the response message from SD, it is determined that be successfully recovered.
From such scheme as can be seen that in the present invention, after determining that exception occurs in SD, continue to send combined information to SD;Really Surely the time for sending combined information is more than setting time, performs SD driving initialization procedures;Test is written and read to SD, if receiving To the response message from SD, it is determined that be successfully recovered.The present invention program is not re-powered to SD and realizes abnormal restoring, So, no longer limited by equipment self structure, can be applied to any main frame.
Brief description of the drawings
Fig. 1 is the method indicative flowchart that the present invention carries out abnormal restoring to safe digital card;
Fig. 2 is the method flow diagram example that the present invention carries out abnormal restoring to safe digital card;
Fig. 3 is the device structure schematic diagram that the present invention carries out abnormal restoring to safe digital card.
Embodiment
For the object, technical solutions and advantages of the present invention are more clearly understood, with reference to embodiment and accompanying drawing, to this Invention is further described.
The existing scheme that abnormal restoring is carried out to SD, it is only applicable to the power supply IO that processor provides control SD restartings The host device of interface, the program are limited by structure.For the defect, the characteristics of combining SD agreements of the invention, using lasting Combined information is sent in a manner of exciting SD to initialize to SD, realizes SD abnormal restoring.Referring to Fig. 1, to be of the invention to safety Digital card carries out the method indicative flowchart of abnormal restoring, and it comprises the following steps:
Step 101, it is abnormal to determine that SD occurs.
It is abnormal to determine that SD occurs, existing scheme can be used to realize, it is, sending the read write command on a certain packet Afterwards, if DATA0 pins are still in busy states within a period of time after 500 milliseconds, it is determined that SD is in abnormality.
Determination abnormal SD is not limited only to currently existing scheme, for example, can also realize in the following way:
Before exception occurs in the determination SD, this method also includes:Packet read-write operation is carried out to SD, to the number of read-write Verified according to bag, if there is mistake, repeat the read-write operation of error data bag to SD, it is determined that the packet of read-write is still Error, judge whether number of repetition is more than and repeat threshold value, if it is greater, then it is abnormal to determine that SD occurs, and to the packet of error It is marked;If it is not greater, then being added up to number of repetition, return execution is described to repeat error data bag to SD The step of read-write operation.The threshold value that repeats can be set according to actual conditions, to be likely to occur abnormal empirical value.
Step 102, continue to send combined information to SD, the combined information includes clock signal and idle state command.
Clock signal(CLK, Clock), time interval signal when being the work of the digital circuits such as processor or bus, is one Kind square-wave signal, makes all operations of digital computer all carry out in order.Also, SD agreements have an idle condition(CMD0)Life Order, i.e. GO_IDLE_STATE orders;By this order, SD card can enter the free time(IDLE)State, and the order is in any shape It can be initiated under state.
But inventor has found in actual application environment, when SD occurs abnormal, single sends CMD0 orders to it, SD can not be made to enter IDLE state.And need to provide clock to SD while order.Based on case above, the invention provides It is a kind of to send the mode of multigroup combined information to SD to activate SD, make it into idle condition.If SD can be made from abnormality Into idle condition, then can continue to be written and read it operation, without by way of power supply restarting being recovered.
To SD send combined information implementation have it is a variety of, specifically such as:
SD CMD pins are drawn high, at least 74 clock signals are sent to SD;
Idle state command is sent to SD.
Tranmitting data register signal needs to draw high SD CMD pins;And when sending idle state command, CMD pins are not made special Other places are managed, and can enter the transmission of line command naturally.
Step 103, it is determined that the time for sending combined information is more than setting time, SD driving initialization procedures are performed.
Inventor has found in actual applications, normally, initiates compound command to SD singles, SD can not be made to enter IDLE State, therefore, the mode repeatedly sent is employed in the present invention, the setting time can be arranged as required to, for example, 2 seconds In.
Step 104, test is written and read to SD, if receiving the response message from SD, it is determined that be successfully recovered.
When being written and read operation to SD, SD response message can be received, can determine that by the reception condition of response message Whether it is successfully recovered.The packet for being written and read test can be the packet to malfunction before or be exclusively used in testing Packet.
Further, test is written and read to SD, if being not received by the response message from SD, can return to execution step 102。
Using the present invention program, after determining that exception occurs in safe digital card SD, continue to send combined information to SD, described group Closing information includes clock signal and idle state command;It is determined that the time for sending combined information is more than setting time, performs SD and drive Dynamic initialization procedure;Test is written and read to SD, if receiving the response message from SD, it is determined that be successfully recovered.The present invention Scheme is not re-powered to SD and realizes abnormal restoring, so, is no longer limited by equipment self structure, can be applied to appoint What main frame.
Below by Fig. 2 flow, the method that abnormal restoring is carried out to the present invention illustrates, from SD read-write operation bag Digital independent, data write-in, data erasing etc. are included, example is specifically used as using digital independent here.
It is the method flow diagram example that SD abnormal restorings are carried out in data read process, it includes following step referring to Fig. 2 Suddenly:
Step 201, packet read operation is carried out to SD.
Step 202, in packet reading process, the packet of reading is verified, if there is mistake, performs step Rapid 203.
Step 203, repeat the read operation of error data bag to SD, determine that packet is read and still fail, perform Step 204, otherwise, the reading from SD progress packets is continued.Step 204, judge whether number of repetition is more than and repeat threshold value, such as Fruit is more than, then performs step 205;If it is not greater, then perform step 206.
The initial value of number of repetition is 0, often re-reads a packet, then is number of repetition superposition 1.In this example, Assuming that number of repetition is 3.
Step 205, it is abnormal to determine that SD occurs, and the packet of error is marked, performs step 207.
Packet is marked, when can be easy to subsequently be successfully recovered, continues to read and write since the packet of mark Operation.
Step 206, number of repetition is added up, packet, which returns, performs step 203.Step 207, continue to send to SD Combined information, the combined information include clock signal and idle state command.
Clock signal(CLK, Clock), time interval signal when being the work of the digital circuits such as processor or bus, is one Kind square-wave signal, makes all operations of digital computer all carry out in order.And the operation of the microcontroller in SD card is to be based on The CLK that main frame provides, as long as there is CLK to exist, the microcontroller in SD card will not stop work works, also be possible to processing idle condition (CMD0)Order.
In the present invention, when SD occurs abnormal, idle state command, i.e. GO_IDLE_STATE orders are sent to SD;Pass through This order, SD card can enter the free time(IDLE)State.When sending idle state command, also clock information is provided simultaneously for it Number.Here, by repeatedly sending combined information, to excite SD to enter idle condition;SD is set to enter idle condition from abnormality, And then enter back into transfer(transfer)State, it can continue to be written and read it operation afterwards.
Step 208, whether the time for judging to send combined information is more than setting time, if it is, step 209 is performed, Otherwise continue to send combined information, until reaching setting time.
Step 209, SD driving initialization procedures are performed.
Specifically, main frame performs the SD card abnormality processing function in SD drivings(mmc_blk_reset), the function is performed, The SD modules in main frame can be initialized, and initialization command can be sent to SD simultaneously, to notify SD to be initialized.
In this example, host operating system is specially linux system.
Step 210, test data bag is sent to SD, judges whether to receive the response message from SD, if it is, really Surely it is successfully recovered, performs step 211;Otherwise, return and perform step 207.
Test data bag is sent to SD, if receiving the response message from SD, shows that SD is normal, determines extensive Multiple success.
Step 211, continue to read the packet after marking from SD.
CMD pins are placed in at least 74 CLK and CMD0 orders sent under high level state as a combined sequence. Single sends the combined sequence, and abnormality SD generally cannot be introduced into IDLE state.The present invention is used and repeatedly cycled through The combined sequence, and the mode continued for some time, realize and operated without hardware power, and SD is entered IDLE by unknown state State.System for that in system operation, hardware power control can not be carried out by program, SD is added to by the method It is the abnormality processing initial period of driving, reliable and stable.
Referring to Fig. 3, the device structure schematic diagram for the present invention to SD progress abnormal restorings, the equipment includes exception and determines mould Block, combined information are sent and initialization module and test determining module;The abnormal determining module, combined information are sent and initial Change module and test determining module, the structure that specially processor includes in host device.
The abnormal determining module, it is abnormal to determine that SD occurs, to combined information transmission and initialization module transmission group Close information and send instruction;
The combined information is sent and initialization module, receives combined information and sends instruction, continues to send combination letter to SD Breath, the combined information include clock signal and idle state command;It is determined that the time for sending combined information is more than setting time, SD driving initialization procedures are performed, test instruction is sent to the test determining module;
The test determining module, receive from combined information transmission and the test of initialization module instruction, to SD Test is written and read, if receiving the response message from SD, it is determined that be successfully recovered.
It is preferred that the equipment also includes functional check module, packet read-write operation is carried out to SD, to the packet of read-write Verified, if there is mistake, repeat the read-write operation of error data bag to SD, it is determined that the packet of read-write still goes out Mistake, judge whether number of repetition is more than and repeat threshold value, if it is greater, then it is abnormal to notify that the abnormal determining module SD occurs, and The packet of error is marked;If it is not greater, then being added up to number of repetition, return execution is described to be repeated to SD The read-write operation of row error data bag.
It is preferred that the test determining module sends to the functional check module and read after determining to be successfully recovered Write recovery instruction;
The functional check module, receive the read-write from the test determining module and recover instruction, if packet is read Write operation is read operation, then continues to read the packet of mark from SD;If packet read-write operation is write operation, from mark Data start continue to SD carry out data write-in.
It is preferred that the combined information is sent and initialization module includes combined information sending submodule and initialization submodule Block,
The combined information sending submodule, receive combined information and send instruction, continue to send combined information to SD, it is determined that The time for sending combined information is more than setting time, and reset indication is sent to the initialization submodule;
The initialization submodule, the reset indication from the combined information sending submodule is received, initialize main frame Interior SD modules, and initialization command is sent to notify SD to be initialized to SD;Test is sent to the test determining module Instruction.
The combined information sending submodule draws high SD CMD pins when sending combined information to SD, to SD send to Few 74 clock signals, and send idle state command.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention God any modification, equivalent substitution and improvements done etc., should be included within the scope of protection of the invention with principle.

Claims (10)

  1. A kind of 1. method that abnormal restoring is carried out to safe digital card, it is characterised in that this method includes:
    It is abnormal to determine that safe digital card SD occurs;
    Continue to send combined information to SD, the combined information includes clock signal and idle state command;
    It is determined that the time for sending combined information is more than setting time, SD driving initialization procedures are performed;
    Test is written and read to SD, if receiving the response message from SD, it is determined that be successfully recovered.
  2. 2. the method as described in claim 1, it is characterised in that before exception occurs in the determination SD, this method also includes:
    Packet read-write operation is carried out to SD, the packet of read-write is verified, if there is mistake, repeats to malfunction to SD The read-write operation of packet, it is determined that the packet of read-write still malfunctions, judge whether number of repetition is more than and repeat threshold value, if greatly In, it is determined that there is exception in SD, and the packet of error is marked;If it is not greater, then number of repetition is added up, Return perform it is described repeat read-write operation from error data bag to SD the step of.
  3. 3. method as claimed in claim 2, it is characterised in that after the determination is successfully recovered, this method also includes:
    If packet read-write operation is read operation, continue to read the packet of mark from SD;
    If packet read-write operation is write operation, continue to carry out data write-in to SD since the data of mark.
  4. 4. the method as described in claim 1,2 or 3, it is characterised in that the execution SD drivings initialization procedure includes:
    Initialize the SD modules in main frame;
    Initialization command is sent to SD, SD is initialized.
  5. 5. method as claimed in claim 4, it is characterised in that described to include to SD transmission combined informations:
    SD CMD pins are drawn high, at least 74 clock signals are sent to SD;
    Idle state command is sent to SD.
  6. 6. a kind of equipment that abnormal restoring is carried out to safe digital card, it is characterised in that the equipment includes abnormal determining module, group Close information transmission and initialization module and test determining module;
    The abnormal determining module, it is abnormal to determine that SD occurs, sent to the combined information and initialization module sends combination letter Breath sends instruction;
    The combined information is sent and initialization module, receives combined information and sends instruction, continues to send combined information, institute to SD Stating combined information includes clock signal and idle state command;It is determined that the time for sending combined information is more than setting time, perform SD drives initialization procedure, and test instruction is sent to the test determining module;
    The test determining module, receive from combined information transmission and the test of initialization module instruction, carried out to SD Readwrite tests, if receiving the response message from SD, it is determined that be successfully recovered.
  7. 7. equipment as claimed in claim 6, it is characterised in that the equipment also includes functional check module, and data are carried out to SD Bag read-write operation, the packet of read-write is verified, if there is mistake, the read-write for repeating error data bag to SD is grasped Make, it is determined that the packet of read-write still malfunctions, judge whether number of repetition is more than and repeat threshold value, if it is greater, then described in notice There is exception in abnormal determining module SD, and the packet of error is marked;If it is not greater, then number of repetition is tired out Add, return and perform the read-write operation for repeating error data bag to SD.
  8. 8. equipment as claimed in claim 7, it is characterised in that it is described test determining module after determining to be successfully recovered, Read-write, which is sent, to the functional check module recovers instruction;
    The functional check module, receive the read-write from the test determining module and recover instruction, if packet read-write behaviour As read operation, then continue to read the packet of mark from SD;If packet read-write operation is write operation, from the number of mark According to continuation is started data write-in is carried out to SD.
  9. 9. the equipment as described in claim 6,7 or 8, it is characterised in that the combined information is sent and initialization module includes Combined information sending submodule and initialization submodule,
    The combined information sending submodule, receive combined information and send instruction, continue to send combined information to SD, it is determined that sending The time of combined information is more than setting time, and reset indication is sent to the initialization submodule;
    The initialization submodule, the reset indication from the combined information sending submodule is received, initialized in main frame SD modules, and initialization command is sent to notify SD to be initialized to SD;Test instruction is sent to the test determining module.
  10. 10. equipment as claimed in claim 9, it is characterised in that the combined information sending submodule is sending combination to SD During information, SD CMD pins are drawn high, at least 74 clock signals, and send idle state command are sent to SD.
CN201410130217.4A 2014-04-02 2014-04-02 The method and apparatus of abnormal restoring is carried out to safe digital card Active CN104699418B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410130217.4A CN104699418B (en) 2014-04-02 2014-04-02 The method and apparatus of abnormal restoring is carried out to safe digital card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410130217.4A CN104699418B (en) 2014-04-02 2014-04-02 The method and apparatus of abnormal restoring is carried out to safe digital card

Publications (2)

Publication Number Publication Date
CN104699418A CN104699418A (en) 2015-06-10
CN104699418B true CN104699418B (en) 2018-02-16

Family

ID=53346601

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410130217.4A Active CN104699418B (en) 2014-04-02 2014-04-02 The method and apparatus of abnormal restoring is carried out to safe digital card

Country Status (1)

Country Link
CN (1) CN104699418B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109635016A (en) * 2018-10-16 2019-04-16 深圳壹账通智能科技有限公司 Data transfer device, device, equipment and computer readable storage medium
TWI776653B (en) * 2021-08-24 2022-09-01 緯穎科技服務股份有限公司 Control system and control method for controlling storage device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1766912A (en) * 2005-09-13 2006-05-03 北京中星微电子有限公司 Process for initializing memory card
CN102103885A (en) * 2009-12-21 2011-06-22 上海华虹集成电路有限责任公司 Method for clearing busy state of secure digital memory card (SD card) and busy state clearing circuit
CN102142093A (en) * 2011-03-24 2011-08-03 青岛海信移动通信技术股份有限公司 Operation method and device for memory card

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100511162C (en) * 2006-09-29 2009-07-08 华为技术有限公司 Method, device and a single-board for isolating bus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1766912A (en) * 2005-09-13 2006-05-03 北京中星微电子有限公司 Process for initializing memory card
CN102103885A (en) * 2009-12-21 2011-06-22 上海华虹集成电路有限责任公司 Method for clearing busy state of secure digital memory card (SD card) and busy state clearing circuit
CN102142093A (en) * 2011-03-24 2011-08-03 青岛海信移动通信技术股份有限公司 Operation method and device for memory card

Also Published As

Publication number Publication date
CN104699418A (en) 2015-06-10

Similar Documents

Publication Publication Date Title
CN101377749B (en) Method, programmable logic device, system and apparatus for checking memory data
US10606677B2 (en) Method of retrieving debugging data in UEFI and computer system thereof
US20140068350A1 (en) Self-checking system and method using same
CN105653345A (en) Method and device supporting data nonvolatile random access
CN105718346A (en) Computer mainboard PCIe slot function test method based on UEFI
US20180095806A1 (en) Technologies for fast boot with adaptive memory pre-training
WO2010001468A1 (en) Test equipment, program, and recording medium
CN104699418B (en) The method and apparatus of abnormal restoring is carried out to safe digital card
US7721159B2 (en) Passing debug information
CN116149559A (en) Queue processing method, device, server, electronic equipment and storage medium
US20060184864A1 (en) Error detection
CN102147739B (en) Multi-mainboard server system and network-driving method thereof
CN110825547B (en) PCIE card exception recovery device and method based on SMBUS
CN112000535A (en) SAS Expander card-based hard disk abnormity identification method and processing method
US10691569B2 (en) System and method for testing a data storage device
US8516311B2 (en) System and method for testing peripheral component interconnect express switch
CN104750537A (en) Test case execution method and device
CN114446381B (en) eMMC fault analysis method, device, readable storage medium and electronic equipment
JP5286814B2 (en) Semiconductor device, portable electronic device, self-diagnosis method, self-diagnosis program
TWI383294B (en) System to identify components of a data communications architecture
CN108037942B (en) Adaptive data recovery and update method and device for embedded equipment
US7568121B2 (en) Recovery from failure in data storage systems
CN114613418B (en) System and method for NVMe-MI function test of solid state disk
US11836059B1 (en) System and method for testing non-volatile memory express storage devices
CN102411527A (en) Detecting method for image-processing chip, developing plate and detecting system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant