Memory card detection method and system and electronic equipment

By determining the timeout threshold based on the memory card attribute parameters and formulating detection strategies, the problem of low timeout detection efficiency of SD memory card in the existing technology is solved, and accurate and efficient detection of memory cards is achieved, and troubleshooting efficiency and equipment stability are improved.

CN119473736APending Publication Date: 2025-02-18SHENZHEN CITY TECHWIN SEMICONDUCTOR COMPANY LIMITED
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411470679.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-02-18

Smart Images

  • Figure CN119473736A_ABST
    Figure CN119473736A_ABST
Patent Text Reader

Abstract

The invention provides a memory card detection method and system and electronic equipment, and relates to the field of memory card detection.The method comprises the steps that firstly, a timeout threshold value corresponding to a memory card is determined based on attribute parameters of the memory card, and a timer is initialized; then determining a data read-write strategy of the memory card according to the overtime threshold, and determining an overtime detection strategy of the memory card by using the data read-write strategy; then starting a timer, controlling the memory card to execute read-write operation, and determining a timeout event of the memory card according to a timeout detection strategy; and finally, after a detection result corresponding to the memory card is generated based on the timeout event, closing the timer, and controlling the memory card to stop read-write operation. According to the method, the overtime threshold can be set according to needs, and the overtime detection strategy corresponding to the memory card is obtained by combining the overtime threshold to execute the overtime detection process on the memory card; according to the method, precise and efficient timeout detection can be carried out on the memory card, a detailed detection result can be obtained based on the timeout event, and the timeout reason of the memory card can be analyzed conveniently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of analog memory card detection, and in particular to a memory card detection method, system and electronic equipment. Background Art

[0002] As a widely used storage medium, the read and write performance of SD memory card (Secure Digital Card) directly affects the security of data and the stability of the device. In actual applications, read and write timeouts often occur due to many factors such as the quality of the SD memory card itself, the compatibility of the target host device, and improper operation.

[0003] For timeout detection of SD memory cards, traditional processing methods often use a retry mechanism or manual intervention to solve the problem. However, such methods are not only inefficient, but also may not effectively locate the problem of the SD memory card. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a memory card detection method, system and electronic device, which can set the timeout threshold according to needs, and obtain the corresponding timeout detection strategy of the memory card in combination with the timeout threshold, and finally use the timeout detection strategy to perform a timeout detection process on the memory card; the method can perform accurate and efficient timeout detection on the memory card, and can obtain detailed detection results based on the timeout event, which is convenient for technicians to analyze the cause of the timeout of the memory card, thereby solving the above-mentioned problems existing in the prior art.

[0005] In a first aspect, an embodiment of the present invention provides a memory card detection method, the method comprising:

[0006] Determine a timeout threshold corresponding to the memory card based on the attribute parameters of the memory card, and initialize a timer;

[0007] Determine a data read and write strategy for the memory card according to the timeout threshold, and determine a timeout detection strategy for the memory card using the data read and write strategy;

[0008] Start the timer, control the memory card to perform read and write operations, and determine the timeout event of the memory card according to the timeout detection strategy;

[0009] After generating a detection result corresponding to the memory card based on the timeout event, the timer is turned off and the memory card is controlled to stop the reading and writing operations.

[0010] In one implementation, determining a timeout threshold corresponding to the memory card based on the attribute parameters of the memory card includes:

[0011] Determine a static timeout threshold corresponding to the memory card according to the specification parameters and protocol parameters of the memory card in the attribute parameters;

[0012] Determine a dynamic timeout threshold corresponding to the memory card according to the frequency parameter of the memory card in the attribute parameter;

[0013] A timeout threshold is determined based on the static timeout threshold and the dynamic timeout threshold.

[0014] In one implementation, determining a static timeout threshold corresponding to the memory card according to specification parameters and protocol parameters of the memory card in the attribute parameters includes:

[0015] Get the specification parameters and protocol parameters of the memory card in the attribute parameters;

[0016] Determine whether the memory card is a standard capacity memory card according to the specification parameters;

[0017] If yes, determine the read / write access duration threshold corresponding to the memory card according to the protocol parameters, and obtain the preset read / write duration extreme value;

[0018] The minimum value between the read / write access duration threshold and the read / write duration extreme value is obtained, and the static timeout threshold is determined using the minimum value.

[0019] In one implementation, after obtaining the specification parameters and protocol parameters of the memory card in the attribute parameters, the method further includes:

[0020] Determine whether the memory card is a high-capacity memory card or an extended-capacity memory card based on the specification parameters;

[0021] If so, obtain the preset read and write duration extreme value, and use the read and write duration extreme value to determine the static timeout threshold.

[0022] In one implementation, determining a dynamic timeout threshold corresponding to the memory card according to a frequency parameter of the memory card in the attribute parameter includes:

[0023] Obtain frequency parameters, type parameters and scene parameters corresponding to the memory card in the attribute parameters;

[0024] Determine a clock frequency value, a fixed coefficient, and a parameter adjustment value corresponding to the memory card based on the frequency parameter, the type parameter, and the scene parameter;

[0025] The dynamic timeout threshold corresponding to the memory card is calculated using the clock frequency value, the fixed coefficient, and the parameter adjustment value; wherein the dynamic timeout threshold is calculated using the following formula:

[0026] Dynamic timeout threshold = (fixed coefficient / clock frequency value) * parameter adjustment value.

[0027] In one implementation, determining a data read and write strategy of a memory card according to a timeout threshold includes:

[0028] Obtain the data read and write event corresponding to the timeout threshold, and obtain the data bus sequence corresponding to the memory card;

[0029] The data read and write strategy of the memory card is determined based on the position of the data read and write event in the data bus sequence.

[0030] In one implementation, determining a timeout detection strategy of a memory card using a data read / write strategy includes:

[0031] Determine a command response result of the memory card using a data read / write strategy, and determine a first timeout detection strategy based on a first response time corresponding to the command response result;

[0032] Determine a data response result of the memory card using the data read / write strategy, and determine a second timeout detection strategy based on a second response time corresponding to the data response result;

[0033] Determine the data transmission time of adjacent data packets in the memory card by using the data read and write strategy, and determine a third timeout detection strategy based on the data transmission time;

[0034] Determine the state recovery time when the memory card completes data transmission by using the data read and write strategy, and determine the fourth timeout detection strategy based on the state recovery time;

[0035] A timeout detection strategy of the memory card is determined according to the first timeout detection strategy, the second timeout detection strategy, the third timeout detection strategy, and the fourth timeout detection strategy.

[0036] In one implementation, determining a timeout event of a memory card according to a timeout detection strategy includes:

[0037] Determine a first timeout threshold corresponding to the first timeout detection strategy based on the timeout threshold, obtain a first response time corresponding to the memory card using the first timeout detection strategy, and determine a first timeout event of the memory card according to the numerical values ​​of the first response time and the first timeout threshold;

[0038] Determine a second timeout threshold corresponding to the second timeout detection strategy based on the timeout threshold, obtain a second response time corresponding to the memory card using the second timeout detection strategy, and determine a second timeout event of the memory card according to the numerical values ​​of the second response time and the second timeout threshold;

[0039] Determine a third timeout threshold corresponding to the third timeout detection strategy based on the timeout threshold, obtain the data transmission time corresponding to the memory card using the third timeout detection strategy, and determine a third timeout event of the memory card according to the value of the data transmission time and the third timeout threshold;

[0040] Determine a fourth timeout threshold corresponding to a fourth timeout detection strategy based on the timeout threshold, obtain a state recovery time corresponding to the memory card using the fourth timeout detection strategy, and determine a fourth timeout event of the memory card according to a value between the state recovery time and the fourth timeout threshold;

[0041] A timeout event of the memory card is determined according to the first timeout event, the second timeout event, the third timeout event, and the fourth timeout event.

[0042] In a second aspect, an embodiment of the present invention provides a memory card detection system, the system comprising:

[0043] A timeout threshold calculation module, used to determine a timeout threshold corresponding to the memory card based on the attribute parameters of the memory card and initialize a timer;

[0044] A timeout detection strategy determination module, used to determine a data read and write strategy of the storage card according to a timeout threshold, and to determine a timeout detection strategy of the storage card using the data read and write strategy;

[0045] A timeout detection module is used to start a timer, control the memory card to perform read and write operations, and determine a timeout event of the memory card according to a timeout detection strategy;

[0046] The timeout processing module is used to turn off the timer and control the memory card to stop reading and writing operations after generating a detection result corresponding to the memory card based on the timeout event.

[0047] In a third aspect, an embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the steps of the memory card detection method provided in the first aspect.

[0048] In a fourth aspect, an embodiment of the present invention further provides a storage medium storing computer executable instructions. When the computer executable instructions are called and executed by a processor, the computer executable instructions prompt the processor to implement the steps of the memory card detection method provided in the first aspect.

[0049] A memory card detection method, system and electronic device provided by the embodiment of the present invention, in the process of timeout detection of the memory card, firstly determine the timeout threshold corresponding to the memory card based on the attribute parameters of the memory card, and initialize the timer; then determine the data read and write strategy of the memory card according to the timeout threshold, and determine the timeout detection strategy of the memory card using the data read and write strategy; then start the timer, control the memory card to perform read and write operations, and determine the timeout event of the memory card according to the timeout detection strategy; finally, after generating the detection result corresponding to the memory card based on the timeout event, turn off the timer, and control the memory card to stop the read and write operation. The method can set the timeout threshold by itself according to the needs, and obtain the corresponding timeout detection strategy of the memory card in combination with the timeout threshold, and finally use the timeout detection strategy to perform the timeout detection process on the memory card; the method can perform accurate and efficient timeout detection on the memory card, and can obtain detailed detection results based on the timeout event, which is convenient for technicians to analyze the cause of the timeout of the memory card.

[0050] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0051] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0053] Figure 1 A flowchart of a memory card detection method provided by an embodiment of the present invention;

[0054] Figure 2 A flow chart of determining a timeout threshold corresponding to a memory card based on attribute parameters of the memory card in a memory card detection method provided by an embodiment of the present invention;

[0055] Figure 3 A flowchart of step S201 in a memory card detection method provided by an embodiment of the present invention;

[0056] Figure 4 A flowchart of step S201 in another memory card detection method provided by an embodiment of the present invention;

[0057] Figure 5 A flowchart of step S202 in a memory card detection method provided by an embodiment of the present invention;

[0058] Figure 6 A flow chart of determining a data read and write strategy of a memory card according to a timeout threshold in a memory card detection method provided by an embodiment of the present invention;

[0059] Figure 7 A flow chart of determining a timeout detection strategy of a memory card by using a data read and write strategy in a memory card detection method provided by an embodiment of the present invention;

[0060] Figure 8 A flow chart of determining a timeout event of a memory card according to a timeout detection strategy in a memory card detection method provided by an embodiment of the present invention;

[0061] Fig. 9 A bus sequence data flow chart corresponding to a memory card detection method provided by an embodiment of the present invention;

[0062] Fig.10 A flowchart of another memory card detection method provided by an embodiment of the present invention;

[0063] Fig.11 A schematic diagram of the structure of a memory card detection system provided by an embodiment of the present invention;

[0064] Fig.12 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.

[0065] icon:

[0066] 1110-timeout threshold calculation module; 1120-timeout detection strategy determination module; 1130-timeout detection module; 1140-timeout processing module;

[0067] 101 - processor; 102 - memory; 103 - bus; 104 - communication interface. DETAILED DESCRIPTION

[0068] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described in combination with the embodiments below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0069] As a commonly used portable storage device, the read and write performance of SD memory cards directly affects the security of data and the operating efficiency of the device. However, in actual applications, due to the influence of various factors (such as SD memory card quality, interface compatibility, system load, etc.), the read and write operations of SD memory cards may time out, which in turn affects the normal transmission of data and the stable operation of the device. Traditional processing methods often lack an effective timeout detection mechanism, or the post-detection processing measures are not timely and effective. In the absence of an efficient timeout detection method, system fault troubleshooting may involve multiple aspects, making it difficult to quickly locate the problem.

[0070] Based on this, the present invention provides a memory card detection method, system and electronic device. The method can set the timeout threshold according to needs, and obtain the corresponding timeout detection strategy of the memory card in combination with the timeout threshold, and finally use the timeout detection strategy to perform a timeout detection process on the memory card; the method can perform accurate and efficient timeout detection on the memory card, and can obtain detailed detection results based on the timeout event, which is convenient for technicians to analyze the cause of the timeout of the memory card, thereby solving the above-mentioned problems existing in the prior art.

[0071] To facilitate understanding of this embodiment, a memory card detection method disclosed in an embodiment of the present invention is first described in detail. Figure 1 As shown, the method comprises the following steps:

[0072] Step S101, determining a timeout threshold corresponding to the memory card based on the attribute parameters of the memory card, and initializing a timer;

[0073] Step S102, determining a data read / write strategy of the memory card according to the timeout threshold, and determining a timeout detection strategy of the memory card using the data read / write strategy;

[0074] Step S103, starting the timer, controlling the memory card to perform read and write operations, and determining a timeout event of the memory card according to a timeout detection strategy;

[0075] Step S104, after generating a detection result corresponding to the memory card based on the timeout event, the timer is turned off, and the memory card is controlled to stop the reading and writing operations.

[0076] Taking SD memory cards as an example, such memory cards involve various attribute parameters such as capacity, speed, and protocol. Different attribute parameters correspond to specific types of memory cards, thereby determining the timeout threshold of the memory card. Generally speaking, the timeout threshold is determined based on the performance parameters and typical operation time of the memory card. If the time spent by the memory card during data transmission is greater than the timeout threshold, it indicates that the read and write performance of the memory card is poor; conversely, if the time spent by the memory card during data transmission is not greater than the timeout threshold, it indicates that the read and write performance of the memory card is good.

[0077] After the time threshold is determined, the data read and write strategy of the corresponding memory card is obtained according to the timeout threshold. The data read and write strategy involves the data reading process and the data writing process, which is mainly determined based on the type of memory card. Different types of memory cards have different requirements for the read and write process, and the corresponding timeout detection requirements are also different. There is a specific correlation between the two. Therefore, the timeout detection strategy of the memory card can be determined by the data read and write strategy.

[0078] Start the initialized timer and start recording the duration of the read and write operations. Specifically, the data read and write strategy can be used to control the storage card to perform read and write operations, record the duration involved in the read and write process, and determine the timeout event of the storage card according to the timeout detection strategy. After the timeout event is determined, the detection result corresponding to the storage card can be generated based on the timeout event. The detection result can be recorded in the form of relevant logs. After the recording is completed, the timer can be turned off to complete the detection process of the storage card.

[0079] In one implementation, a timeout threshold corresponding to the memory card is determined based on the attribute parameters of the memory card, such as Figure 2 As shown, including:

[0080] Step S201, determining a static timeout threshold corresponding to the memory card according to the specification parameters and protocol parameters of the memory card in the attribute parameters;

[0081] Step S202, determining a dynamic timeout threshold corresponding to the memory card according to the frequency parameter of the memory card in the attribute parameter;

[0082] Step S203: determining a timeout threshold based on the static timeout threshold and the dynamic timeout threshold.

[0083] Specifically, the timeout threshold is divided into two categories: static timeout threshold and dynamic timeout threshold. Since the memory card involves many specifications and corresponds to a specific protocol, the static timeout threshold can be determined by combining the specification parameters and protocol parameters of the memory card in the attribute parameters with the data access time, data block delay time and other data involved in the data reading and writing process.

[0084] Similarly, the dynamic timeout threshold of the memory card can be calculated by combining the working frequency parameter of the memory card in the attribute parameter with the specific frequency value.

[0085] In one implementation, step S201 of determining a static timeout threshold corresponding to the memory card according to the specification parameters and protocol parameters of the memory card in the attribute parameters is as follows: Figure 3 As shown, including:

[0086] Step S301, obtaining specification parameters and protocol parameters of the memory card in the attribute parameters;

[0087] Step S302, determining whether the memory card is a standard capacity memory card according to the specification parameters;

[0088] Step S303: if yes, determine the read / write access duration threshold corresponding to the memory card according to the protocol parameters, and obtain the preset read / write duration extreme value;

[0089] Step S304, obtaining the minimum value between the read / write access duration threshold and the read / write duration extreme value, and using the minimum value to determine the static timeout threshold.

[0090] Memory cards involve many specifications and correspond to specific protocols. For example, SD memory cards have standard capacity SD memory cards, namely SDSC (Secure Digital Standard Capacity); high capacity SD memory cards, namely SDHC (Secure Digital High Capacity); and extended capacity SD cards, namely SDXC (Secure Digital eXtended Capacity). Different types of memory cards correspond to specific attribute parameters, so the specification parameters and protocol parameters of the memory card can be used according to the attribute parameters.

[0091] After determining that the memory card is a standard capacity memory card SDSC through the specification parameters, determine the read and write access time threshold corresponding to the memory card according to the protocol parameters, and obtain the preset read and write time extreme value. The read and write access time threshold includes the read access time threshold and the write access time threshold. The read and write time extreme value includes the read time extreme value and the write time extreme value. For the read operation, the read access time threshold is 100 times the typical read access time, and the read time extreme value is 100ms. The read access time is given by the CSD register parameters TAAC and NSAC of the memory card. These two parameters define the typical delay between the end bit of the read command and the start bit of the data block. For the write operation, the write access time threshold is 90 times the typical programming time, and the write time extreme value is 250ms. The R2W_FACTOR field in the memory card CSD register is used to calculate the typical block programming time obtained by multiplying the read access time by this factor, which applies to all write commands.

[0092] The static timeout threshold is determined using the minimum value between the read and write access time threshold and the read and write time extreme value. Specifically, the minimum value between the read access time threshold and the read time extreme value is selected as the read timeout threshold; the minimum value between the write access time threshold and the write time extreme value is selected as the write timeout threshold, thereby determining the read timeout threshold and the write timeout threshold as the static timeout threshold.

[0093] In one implementation, step S201 of determining a static timeout threshold corresponding to the memory card according to the specification parameters and protocol parameters of the memory card in the attribute parameters is as follows: Figure 4 As shown, including:

[0094] Step S401, obtaining specification parameters and protocol parameters of the memory card in the attribute parameters;

[0095] Step S402, determining whether the memory card is a high-capacity memory card or an extended-capacity memory card according to the specification parameters;

[0096] Step S403: if yes, obtain the preset read / write duration extreme value, and use the read / write duration extreme value to determine the static timeout threshold.

[0097] After determining through the specification parameters that the memory card is a high-capacity memory card SDHC or an extended-capacity memory card SDXC, the static timeout threshold is determined directly using the read and write time extremes. The static timeout threshold also includes a read timeout threshold and a write timeout threshold. Both the timeout threshold and the write timeout threshold are determined by the preset read and write time extremes. When performing single and multiple read operations on the above memory cards, 100ms is used as the read time extreme; when performing write operations on the above memory cards, the maximum busy length of all write operations can be defined as 250ms, and 250ms is used as the write time extreme. In the case of SDXC cards, the write time extreme can also be set to 500ms.

[0098] In one implementation, step S202 of determining a dynamic timeout threshold corresponding to the memory card according to the frequency parameter of the memory card in the attribute parameter is as follows: Figure 5 As shown, including:

[0099] Step S501, obtaining frequency parameters, type parameters and scene parameters corresponding to the memory card in the attribute parameters;

[0100] Step S502, determining a clock frequency value, a fixed coefficient and a parameter adjustment value corresponding to the memory card based on the frequency parameter, the type parameter and the scene parameter;

[0101] Step S503: Calculate the dynamic timeout threshold corresponding to the memory card using the clock frequency value, the fixed coefficient and the parameter adjustment value.

[0102] The setting of the dynamic timeout threshold can be realized in combination with the working frequency such as the clk clock frequency. The clock frequency value, fixed coefficient and parameter adjustment value corresponding to the memory card are determined through the frequency parameter, type parameter and scenario parameter corresponding to the memory card in the attribute parameters, and then a reasonable dynamic timeout threshold is dynamically calculated and set. The dynamic timeout threshold is calculated by the following formula:

[0103] Dynamic timeout threshold = (fixed coefficient / clock frequency value) * parameter adjustment value.

[0104] The fixed coefficient and parameter adjustment value are determined according to the specific type of memory card and the working environment. The parameter adjustment value must be a number between 0 and 1. When the parameter adjustment value is set to 1, the dynamic timeout time = static timeout time = (fixed coefficient / clock frequency value) * 1, thereby calculating the value of the fixed coefficient. For determining the parameter adjustment value according to the working environment, for application scenarios that require high real-time or high-performance memory cards, a smaller parameter adjustment value can be set to shorten the timeout time; for application scenarios that do not require high real-time or performance, a larger parameter adjustment value can be set to increase the fault tolerance of the system.

[0105] In one implementation, the data read and write strategy of the memory card is determined according to the timeout threshold, such as Figure 6 As shown, including:

[0106] Step S601, obtaining a data read / write event corresponding to a timeout threshold, and obtaining a data bus sequence corresponding to the memory card;

[0107] Step S602: determining a data read / write strategy of the memory card based on the position of the data read / write event in the data bus sequence.

[0108] The acquisition process of data read and write strategy is determined based on the data bus sequence. The memory card contains specific events in the complete data bus sequence, such as: command response event for the memory card, command response event in the data transmission start process, response event of adjacent data packets in the data transmission process, memory card status recovery event, etc. These events are executed sequentially in the data read and write process, so the corresponding data read and write strategy can be determined through these data read and write events.

[0109] In one implementation, the timeout detection strategy of the memory card is determined using the data read and write strategy, such as Figure 7 As shown, including:

[0110] Step S701, determining a command response result of the memory card using a data read / write strategy, and determining a first timeout detection strategy based on a first response time corresponding to the command response result;

[0111] Step S702, determining a data response result of the memory card using the data read / write strategy, and determining a second timeout detection strategy based on a second response time corresponding to the data response result;

[0112] Step S703, determining the data transmission time of adjacent data packets in the memory card by using the data read and write strategy, and determining a third timeout detection strategy based on the data transmission time;

[0113] Step S704, using the data read and write strategy to determine the state recovery time when the memory card completes data transmission, and determining a fourth timeout detection strategy based on the state recovery time;

[0114] Step S705: determining a timeout detection strategy of the memory card according to the first timeout detection strategy, the second timeout detection strategy, the third timeout detection strategy, and the fourth timeout detection strategy.

[0115] The corresponding timeout detection strategy can be determined based on the events corresponding to the above-mentioned data read and write strategies. For example, based on the data read and write strategy corresponding to the command response event of the storage card, the command response result can be determined as the starting command response after the storage card executes the work, and the first timeout detection strategy can be determined by the first response time corresponding to the response.

[0116] Similarly, based on the data read and write strategy corresponding to the command response event during the data transmission initiation process, the time interval for sending the first data packet during the data transmission initiation process can be determined, and after determining the second response time, the second timeout detection strategy can be determined.

[0117] Based on the data read and write strategies corresponding to the response events of the adjacent data packets during the data transmission process, the time interval during the transmission of the adjacent data packets can be determined, and after it is determined as the data transmission time, the third timeout detection strategy can be determined.

[0118] The time interval for the memory card bus to restore the busy state to the ready state can be determined based on the memory card state recovery event, thereby determining the state recovery time, and determining the fourth timeout detection strategy based on the state recovery time.

[0119] In one implementation, a timeout event of the memory card is determined according to a timeout detection strategy, such as Figure 8 As shown, including:

[0120] Step S801, determining a first timeout threshold corresponding to a first timeout detection strategy based on the timeout threshold, obtaining a first response time corresponding to the memory card using the first timeout detection strategy, and determining a first timeout event of the memory card according to the numerical values ​​of the first response time and the first timeout threshold;

[0121] Step S802, determining a second timeout threshold corresponding to the second timeout detection strategy based on the timeout threshold, obtaining a second response time corresponding to the memory card using the second timeout detection strategy, and determining a second timeout event of the memory card according to the numerical values ​​of the second response time and the second timeout threshold;

[0122] Step S803, determining a third timeout threshold corresponding to the third timeout detection strategy based on the timeout threshold, obtaining the data transmission time corresponding to the memory card using the third timeout detection strategy, and determining a third timeout event of the memory card according to the value of the data transmission time and the third timeout threshold;

[0123] Step S804, determining a fourth timeout threshold corresponding to a fourth timeout detection strategy based on the timeout threshold, obtaining a state recovery time corresponding to the memory card using the fourth timeout detection strategy, and determining a fourth timeout event of the memory card according to a value between the state recovery time and the fourth timeout threshold;

[0124] Step S805: determining a timeout event of the memory card according to the first timeout event, the second timeout event, the third timeout event, and the fourth timeout event.

[0125] Specifically, if no response is received from the SD card within the set timeout period t1, it is determined as timeout event 1;

[0126] If the time interval from each command response to the start of sending the first data packet exceeds the set timeout time t2, it is determined as timeout event 2;

[0127] If the time interval between the transmitted data packets exceeds the set timeout time t3, it is determined as timeout event 3;

[0128] If the time interval for the SD bus busy state to return to the ready state after the data transmission is completed exceeds the set timeout time t4, it is determined as timeout event 4;

[0129] The following SD bus sequence can be used to assist in the explanation. Timeout event 1, timeout event 2, timeout event 3, and timeout event 4 are marked as t1, t2, t3, and t4 respectively. Taking the SD write command CMD25 as an example, the specific Fig. 9 shown.

[0130] In actual scenarios, the method can be implemented by a specific test device. When executing the method, the memory card can be first placed in the test device, and the test device is started to execute the process of the memory card detection method. For details, refer to Fig.10 A flowchart of another memory card detection method is shown.

[0131] First, start the test device, execute the SD memory card initialization process, configure the timeout detection threshold, that is, determine the timeout threshold corresponding to the memory card based on the attribute parameters of the memory card, and initialize the timer; then determine the data read and write strategy of the memory card according to the timeout threshold, and use the data read and write strategy to determine the timeout detection strategy of the memory card.

[0132] Then start the internal timer to prepare for the timeout detection timing of the read and write operations, and then execute the read and write operation process of the test device to detect and record the timeout detection items in real time. By starting the timer, control the memory card to perform read and write operations, and determine the timeout event of the memory card according to the timeout detection strategy. The test result is determined by judging whether the timeout is triggered. If the timeout is not triggered, execute until the test is completed, upload the global test record to the user interaction module for further analysis by the user; if the timeout is triggered, the test is interrupted after the timeout detection is triggered, and the timeout scene is recorded and uploaded to the user interaction module for further analysis by the user. The user interaction module provides a user interface or interface for displaying the results and processing status of the timeout detection, and for the user to manually intervene or adjust the settings as needed.

[0133] This method can set the timeout threshold according to the memory card protocol specification, detect whether the memory card complies with the protocol specification, effectively detect the compatibility and stability of the memory card, and help developers repair problems of memory cards with low compatibility and poor stability.

[0134] To facilitate troubleshooting, the timeout detection mechanism usually records relevant log information, including timeout time, operation type, error code, etc. By viewing these log information, technicians can quickly locate the fault point related to the memory card and perform targeted repair work. The efficiency of troubleshooting is improved and the repair time is shortened.

[0135] It can be seen from the memory card detection method in the above embodiment that the method can set the timeout threshold by itself as needed, and obtain the corresponding timeout detection strategy of the memory card in combination with the timeout threshold, and finally use the timeout detection strategy to perform a timeout detection process on the memory card; the method can perform accurate and efficient timeout detection on the memory card, and can obtain detailed detection results based on the timeout event, which is convenient for technicians to analyze the cause of the timeout of the memory card.

[0136] Corresponding to the above-mentioned memory card detection method embodiment, the embodiment of the present invention further provides a memory card detection system, such as Fig.11 As shown, the system includes:

[0137] A timeout threshold calculation module 1110, configured to determine a timeout threshold corresponding to the memory card based on the attribute parameters of the memory card and initialize a timer;

[0138] A timeout detection strategy determination module 1120, configured to determine a data read / write strategy of the memory card according to a timeout threshold, and determine a timeout detection strategy of the memory card using the data read / write strategy;

[0139] A timeout detection module 1130 is used to start a timer, control the memory card to perform read and write operations, and determine a timeout event of the memory card according to a timeout detection strategy;

[0140] The timeout processing module 1140 is used to turn off the timer and control the memory card to stop the reading and writing operations after generating the detection result corresponding to the memory card based on the timeout event.

[0141] From the memory card detection system mentioned in the above embodiment, it can be seen that the system can set the timeout threshold by itself as needed, and obtain the corresponding timeout detection strategy of the memory card in combination with the timeout threshold, and finally use the timeout detection strategy to perform a timeout detection process on the memory card; the system can perform accurate and efficient timeout detection on the memory card, and can obtain detailed detection results based on the timeout event, which is convenient for technicians to analyze the cause of the timeout of the memory card.

[0142] The memory card detection system provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned memory card detection method embodiment. For the sake of brief description, for matters not mentioned in the method embodiment, reference may be made to the corresponding contents in the aforementioned memory card detection method embodiment.

[0143] This embodiment also provides an electronic device. The structural diagram of the electronic device is as follows: Fig.12 As shown, the device includes a processor 101 and a memory 102; wherein the memory 102 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor to implement the steps of the above-mentioned memory card detection method.

[0144] Fig.12 The electronic device shown further includes a bus 103 and a communication interface 104 , and the processor 101 , the communication interface 104 and the memory 102 are connected via the bus 103 .

[0145] The memory 102 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The bus 103 may be an ISA bus, a PCI bus, or an EISA bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.12 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0146] The communication interface 104 is used to connect to at least one user terminal and other network units through a network interface, and send the encapsulated IPv4 message or IPv4 message to the user terminal through the network interface.

[0147] The processor 101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 101. The above processor 101 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 102, and the processor 101 reads the information in the memory 102 and completes the steps of the method of the above embodiment in combination with its hardware.

[0148] An embodiment of the present invention further provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the memory card detection method in the above embodiment are executed.

[0149] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0150] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0151] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0152] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention can essentially or in other words, the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, electronic device, or network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0153] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A memory card detection method, characterized in that: The method comprises: Determine a timeout threshold corresponding to the memory card based on the attribute parameters of the memory card, and initialize a timer; Determining a data read / write strategy of the memory card according to the timeout threshold, and determining a timeout detection strategy of the memory card using the data read / write strategy; Starting the timer, controlling the memory card to perform read and write operations, and determining a timeout event of the memory card according to the timeout detection strategy; After generating a detection result corresponding to the memory card based on the timeout event, the timer is turned off, and the memory card is controlled to stop reading and writing operations.

2. The memory card detection method according to claim 1, characterized in that: Determining a timeout threshold corresponding to the memory card based on the attribute parameters of the memory card includes: Determining a static timeout threshold corresponding to the memory card according to specification parameters and protocol parameters of the memory card in the attribute parameters; Determine a dynamic timeout threshold corresponding to the memory card according to the frequency parameter of the memory card in the attribute parameter; The timeout threshold is determined based on the static timeout threshold and the dynamic timeout threshold.

3. The memory card detection method according to claim 2, characterized in that: Determining a static timeout threshold corresponding to the memory card according to the specification parameters and protocol parameters of the memory card in the attribute parameters includes: Acquire the specification parameters and the protocol parameters of the memory card in the attribute parameters; Determining whether the memory card is a standard capacity memory card according to the specification parameters; If yes, determine the read / write access duration threshold corresponding to the memory card according to the protocol parameters, and obtain a preset read / write duration extreme value; The minimum value between the read / write access duration threshold and the read / write duration extreme value is obtained, and the static timeout threshold is determined using the minimum value.

4. The memory card detection method according to claim 3, characterized in that: After obtaining the specification parameters and the protocol parameters of the memory card in the attribute parameters, the method further includes: Determine whether the memory card is a high-capacity memory card or an extended-capacity memory card according to the specification parameters; If so, a preset read / write duration extreme value is obtained, and the static timeout threshold is determined using the read / write duration extreme value.

5. The memory card detection method according to claim 2, characterized in that: Determining a dynamic timeout threshold corresponding to the memory card according to the frequency parameter of the memory card in the attribute parameter includes: Obtaining the frequency parameter, type parameter and scene parameter corresponding to the memory card in the attribute parameters; Determine a clock frequency value, a fixed coefficient, and a parameter adjustment value corresponding to the memory card based on the frequency parameter, the type parameter, and the scene parameter; The dynamic timeout threshold corresponding to the memory card is calculated using the clock frequency value, the fixed coefficient and the parameter adjustment value; wherein the dynamic timeout threshold is calculated using the following formula: Dynamic timeout threshold = (fixed coefficient / clock frequency value) * parameter adjustment value.

6. The memory card detection method according to claim 1, characterized in that: Determining the data reading and writing strategy of the memory card according to the timeout threshold includes: Acquire a data read / write event corresponding to the timeout threshold, and acquire a data bus sequence corresponding to the memory card; A data read / write strategy of the memory card is determined based on the position of the data read / write event in the data bus sequence.

7. The memory card detection method according to claim 6, characterized in that: Determining a timeout detection strategy of the memory card using the data read and write strategy includes: Determine a command response result of the memory card by using the data read / write strategy, and determine a first timeout detection strategy based on a first response time corresponding to the command response result; Determine a data response result of the memory card by using the data read / write strategy, and determine a second timeout detection strategy based on a second response time corresponding to the data response result; Determine the data transmission time of adjacent data packets in the memory card by using the data read and write strategy, and determine a third timeout detection strategy based on the data transmission time; Determine a state recovery time when the memory card completes data transmission by using the data read and write strategy, and determine a fourth timeout detection strategy based on the state recovery time; The timeout detection strategy of the memory card is determined according to the first timeout detection strategy, the second timeout detection strategy, the third timeout detection strategy, and the fourth timeout detection strategy.

8. The memory card detection method according to claim 7, characterized in that: Determining a timeout event of the memory card according to the timeout detection strategy includes: determining a first timeout threshold corresponding to the first timeout detection strategy based on the timeout threshold, acquiring the first response time corresponding to the memory card using the first timeout detection strategy, and determining a first timeout event of the memory card according to the numerical values ​​of the first response time and the first timeout threshold; determining a second timeout threshold corresponding to the second timeout detection strategy based on the timeout threshold, acquiring the second response time corresponding to the memory card using the second timeout detection strategy, and determining a second timeout event of the memory card according to the numerical values ​​of the second response time and the second timeout threshold; Determining a third timeout threshold corresponding to the third timeout detection strategy based on the timeout threshold, acquiring the data transmission time corresponding to the memory card using the third timeout detection strategy, and determining a third timeout event of the memory card according to the value of the data transmission time and the third timeout threshold; Determining a fourth timeout threshold corresponding to the fourth timeout detection strategy based on the timeout threshold, acquiring the state recovery time corresponding to the memory card using the fourth timeout detection strategy, and determining a fourth timeout event of the memory card according to the numerical values ​​of the state recovery time and the fourth timeout threshold; The timeout event of the memory card is determined according to the first timeout event, the second timeout event, the third timeout event, and the fourth timeout event.

9. A memory card detection system, characterized in that: The system comprises: A timeout threshold calculation module, used to determine a timeout threshold corresponding to the memory card based on the attribute parameters of the memory card, and initialize a timer; A timeout detection strategy determination module, used to determine the data read and write strategy of the memory card according to the timeout threshold, and determine the timeout detection strategy of the memory card using the data read and write strategy; A timeout detection module, used to start the timer, control the memory card to perform read and write operations, and determine a timeout event of the memory card according to the timeout detection strategy; A timeout processing module is used to turn off the timer and control the memory card to stop reading and writing operations after generating a detection result corresponding to the memory card based on the timeout event.

10. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the steps of the memory card detection method according to any one of claims 1 to 8.