A state determination method, electronic device and storage medium
By acquiring the rising edge and falling edge data of multiple clock cycles in the electronic device and making a comprehensive judgment, the problem of inaccurate peripheral device connection status detection in the prior art is solved and the detection accuracy is improved.
Patent Information
- Application Number
- CN202110948309.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-18
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-08-18
AI Technical Summary
When an electronic device is connected to a peripheral device, it is difficult to accurately determine whether the two peripheral devices are in a normal connection state with the existing technology, resulting in a low detection accuracy.
By determining multiple clock cycles, the data set of the rising and falling edges of the clock is obtained, and a comprehensive judgment is made based on these data to determine the configuration status of the peripheral device.
The accuracy of detecting whether two peripheral devices are in a normal connection state is improved and misjudgment is avoided.
Smart Images

Figure CN113760618B
Abstract
Description
Technical Field
[0001] The present application relates to the field of information technology, and in particular to a state determination method, an electronic device, and a storage medium. Background Art
[0002] When an electronic device is connected to at least two peripheral devices, the electronic device usually needs to detect the status of the peripheral devices. In order to save costs, when the functions of the at least two peripheral devices are the same or similar, the electrical data of the at least two peripheral devices are usually detected through the same interface circuit based on the rising edge and falling edge of the same clock cycle. In practical applications, as long as the electronic device receives valid data at the rising edge and falling edge of the clock cycle, it can be determined that the at least two peripheral devices are in a normal connection state.
[0003] However, if two peripheral devices send the same signal to the electronic device at adjacent clock edges, the electronic device will maintain the signal of the previous clock edge by default, and it is impossible to determine whether the electronic device has received the signal of the next clock edge, resulting in misjudgment and low accuracy of the detection method. Summary of the invention
[0004] The present application provides a state determination method, an electronic device, and a storage medium, which can better detect whether two peripheral devices are in a normal connection state and improve the detection accuracy.
[0005] The technical solution of this application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides a state determination method, the method comprising:
[0007] Determine a first time period, the first time period including a plurality of clock cycles;
[0008] Acquire a first data set and a second data set; wherein the first data set includes data acquired from the first device at rising edges of multiple clock cycles in a first time period; and the second data set includes data acquired from the second device at falling edges of multiple clock cycles in the first time period;
[0009] Perform judgment based on the data in the first data set in the first time period and the data in the second data set to obtain a judgment result;
[0010] Based on the determination result, the configuration status of the first device and the second device is determined.
[0011] In a second aspect, an embodiment of the present application provides an electronic device, which includes a first determination module, an acquisition module, a judgment module, and a second determination module; wherein:
[0012] A first determining module, configured to determine a first time period, where the first time period includes a plurality of clock cycles;
[0013] An acquisition module, configured to acquire a first data set and a second data set; wherein the first data set includes data acquired from the first device at rising edges of multiple clock cycles in a first time period; and the second data set includes data acquired from the second device at falling edges of multiple clock cycles in the first time period;
[0014] A judgment module, used to make a judgment based on the data in the first data set in the first time period and the data in the second data set to obtain a judgment result;
[0015] The second determining module is used to determine the configuration status of the first device and the second device based on the determination result.
[0016] In a third aspect, an embodiment of the present application provides a computer storage medium, which stores a computer program. When the computer program is executed by a processor, it can implement the state determination method described in the first aspect.
[0017] The embodiment of the present application provides a state determination method, an electronic device, and a storage medium, which determine a first time period, the first time period includes multiple clock cycles; obtain a first data set and a second data set; wherein the first data set includes data obtained from a first device at the rising edge of multiple clock cycles in the first time period; the second data set includes data obtained from a second device at the falling edge of multiple clock cycles in the first time period; based on the data in the first data set in the first time period and the data in the second data set, a judgment result is obtained; based on the judgment result, the configuration state of the first device and the second device is determined. In this way, since the first data set includes the timing data obtained from the first device at the rising edge of the clock, and the second data set includes the timing data obtained from the second device at the falling edge of the clock, a more comprehensive judgment result can be determined based on the first data set and the second data set, thereby better detecting whether the two peripheral devices are in a normal connection state and improving the detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A schematic diagram of a sampling circuit of a microphone provided for related technology;
[0019] Figure 2 A sampling timing diagram of a microphone provided for related technology;
[0020] Figure 3 A flow chart of a state detection method provided in an embodiment of the present application;
[0021] Figure 4 A schematic diagram of another state detection process provided in an embodiment of the present application;
[0022] Figure 5 A schematic diagram of a signal waveform provided in an embodiment of the present application;
[0023] Figure 6 Another signal waveform diagram provided in an embodiment of the present application;
[0024] Figure 7 A schematic diagram of another signal waveform provided in an embodiment of the present application;
[0025] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0026] Fig. 9 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0027] Fig.10 A schematic diagram of the structure of a state detection system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0029] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0030] It should be understood that, in order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that, in the embodiments of the present application, many technical details are provided in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented.
[0031] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are described first. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations:
[0032] Codec: A codec or software that supports video and audio compression and decompression
[0033] AP (Application Processor): Application Processor
[0034] PDM (Pulse Density Modulation) interface: a digital audio interface
[0035] MIC (microphone): microphone
[0036] It is understandable that when an electronic device is connected to at least two peripheral devices, the electronic device usually needs to detect the status of the peripheral devices. In order to save costs, when the functions of the at least two peripheral devices are the same or similar, the electrical data of the at least two peripheral devices are usually detected through the same interface circuit based on the rising edge and falling edge of the same clock cycle. In practical applications, as long as the electronic device receives valid data at the rising edge and falling edge of the clock cycle, it can be determined that the at least two peripheral devices are in a normal connection state.
[0037] For example, in order to receive sound information in the environment in a more three-dimensional way, many tablet computers or mobile phones currently support multi-channel microphone recording, such as a microphone on the left, right, top or back of the whole device. Two digital microphones (assuming they are defined as left microphone and right microphone respectively) can be connected to the hardware path of a PDM interface, and the sampling edge of the data signal (hereinafter referred to as DATA signal) is distinguished by the data selection signal (hereinafter referred to as SELECT signal or L / R signal), and the signal of the left microphone or the right microphone is sampled and received at the rising edge and falling edge of the clock signal (hereinafter referred to as CLK signal).
[0038] See also Figure 1 , which shows a schematic diagram of a sampling circuit of a microphone provided by the related art. Microphone 1 (MIC1) and microphone 2 (MIC2) receive sound signals from different directions respectively and transmit them to the receiving end (such as Codec or AP). Figure 1 As shown, MIC1 and MIC2 both have a selection (SEL) pin, a clock (CLOCK) pin, and a data (DATA) pin. The CLOCK pins of MIC1 and MIC2 are connected to the CLOCK signal to determine the sampling time point. The SEL pin of MIC1 is connected to a low level (GND), while the SEL pin of MIC2 is connected to a high level (V dd ).
[0039] See also Figure 2 , which shows a sampling timing diagram of a microphone provided by the related art. Figure 2As shown in the figure, at the rising edge of the CLOCK signal, the DATA signal receives the data transmitted by MIC1; at the falling edge of CLOCK, the DATA signal receives the data transmitted by MIC2. In other words, the SELECT pin of MIC1 is connected to GND, which is sampled at the falling edge of the CLK signal (i.e., the CLOCK signal) and latched at the rising edge of the CLK signal; conversely, the SELECT pin of MIC2 is connected to VDD, which is sampled at the rising edge of the CLK signal (i.e., the CLOCK signal) and latched at the falling edge of the CLK signal.
[0040] Based on the aforementioned working principle, after the electronic equipment is assembled into a complete machine, the factory generally needs to perform assembly testing to confirm whether the two microphones are in a normal connection state (or installed in place). Figure 2 If both microphones are not in place, the receiver receives an all-0 signal, so it can be easily checked; if one of the two microphones is not in place, the microphone in place can send a DATA signal on a certain clock edge, but because the receiver only samples and receives the signal, it will not actively change (pull up and pull down) the signal; therefore, on another clock edge, the DATA signal will still retain the signal of the previous clock edge. This will cause the receiver to mistakenly believe that there are signals on both edges of the clock, and therefore mistakenly believe that both microphones are in place, resulting in a reduced accuracy of the detection method.
[0041] Based on this, the embodiment of the present application provides a state determination method, the basic idea of which is: determine a first time period, the first time period includes multiple clock cycles; obtain a first data set and a second data set; wherein the first data set includes data obtained from the first device at the rising edge of multiple clock cycles in the first time period; the second data set includes data obtained from the second device at the falling edge of multiple clock cycles in the first time period; make a judgment based on the data in the first data set in the first time period and the data in the second data set to obtain a judgment result; determine the configuration state of the first device and the second device based on the judgment result. In this way, since the first data set includes the timing data obtained from the first device at the rising edge of the clock, and the second data set includes the timing data obtained from the second device at the falling edge of the clock, a more comprehensive judgment result can be determined based on the first data set and the second data set, thereby better detecting whether the two peripheral devices are in a normal connection state and improving the detection accuracy.
[0042] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0043] In one embodiment of the present application, see Figure 3, which shows a flow chart of a state determination method provided by an embodiment of the present application. Figure 3 As shown, the method may include:
[0044] S101: Determine a first time period, where the first time period includes a plurality of clock cycles.
[0045] It should be noted that the state determination method provided in the embodiment of the present application can be applied to any electronic device involving at least two peripheral devices (i.e., the first device and the second device). Here, the peripheral device can be a microphone, a game controller, etc.; the electronic device can be a personal computer (PC, Personal Computer), a laptop computer, a personal digital assistant (PDA, Personal Digital Assistant), a portable multimedia player (PMP, Portable Multimedia Player), a handheld game console (PSP, Play Station Portable), a smart phone (SmartPhone), a television, and a stereo.
[0046] S102: Acquire a first data set and a second data set; wherein the first data set includes data acquired from a first device at rising edges of multiple clock cycles in a first time period; and the second data set includes data acquired from a second device at falling edges of multiple clock cycles in the first time period.
[0047] It should be noted that, in order to save costs, when the functions of at least two peripheral devices are the same or similar, the electrical data of at least two peripheral devices are usually detected through the same interface circuit based on the rising edge and falling edge of the same clock cycle. In the related art, as long as the electronic device receives valid data at the rising edge and falling edge of the clock cycle, it can determine that at least two peripheral devices are in a normal connection state, which is likely to cause misjudgment.
[0048] Therefore, in an embodiment of the present application, in a continuous time period having multiple clock cycles, different data (for example, controlling two microphones to input different audio) is transmitted through the first device and the second device, and data is obtained from the first device at the rising edge of each clock cycle to form a first data set; data is obtained from the second device at the falling edge of each clock cycle to form a second data set.
[0049] Taking the first device and the second device as microphones as an example, the first device and the second device may each include a data acquisition device. In some embodiments, the method may further include:
[0050] The data in the first data set is obtained by collecting a preset sound signal at the rising edges of a plurality of clock cycles in the first time period through the data collection device in the first device;
[0051] The data in the second data set is obtained by collecting the preset sound signal at the falling edges of multiple clock cycles in the first time period through the data collection device in the second device.
[0052] In this way, after acquiring the first data set and the second data set, the two data sets can be used to determine the configuration status of the first device / the second device.
[0053] S103: Perform judgment based on the data in the first data set in the first time period and the data in the second data set to obtain a judgment result.
[0054] It should be noted that the first data set and the second data set each include a plurality of data having a certain time sequence relationship. For example, the nth data in the first data set and the nth data in the second data set are from the same clock cycle.
[0055] Therefore, in some embodiments, the performing judgment based on the data in the first data set and the data in the second data set in the first time period to obtain the judgment result may include:
[0056] According to the first data set and the second data set, judging the data acquired from the first device and the data acquired from the second device in the same clock cycle to obtain the first judgment result; and / or,
[0057] The data acquired from the first device and the data acquired from the second device in adjacent clock cycles are judged according to the first data set and the second data set to obtain the second judgment result.
[0058] It should be noted that the judgment result includes a first judgment result and / or a second judgment result. The first judgment result refers to the comparison result of the data obtained from the first device and the data obtained from the second device in the same clock cycle, and the second judgment result refers to the comparison result of the data obtained from the first device and the data obtained from the second device in adjacent clock cycles.
[0059] In this way, not only the comparison results of data obtained from two devices in the same cycle are considered, but also the comparison results of data obtained from two devices in different cycles are considered, which can fully reflect the connection status of the two peripheral devices, thereby avoiding misjudgment and improving detection accuracy.
[0060] S104: Determine the configuration status of the first device and the second device based on the determination result.
[0061] It should be noted that, according to the first judgment result and the second judgment result, the configuration status of the first device and the second device can be judged respectively.
[0062] Here, if neither the first data set nor the second data set obtains valid data (i.e., the data in the first data set and the second data set are all 0), it means that both the first device and the second device are in an abnormal state, which can be quickly determined without judging the first data set and the second data set.
[0063] In addition, the configuration status of the first device and the second device may further include: the first device is normal / the second device is abnormal; the first device is normal / the second device is normal; the first device is abnormal / the second device is normal, and the like.
[0064] In a specific embodiment, determining the configuration status of the first device and the second device based on the judgment result may include:
[0065] When the first judgment result indicates that the nth data in the first data set is equal to the nth data in the second data set, and the nth data in the first data set is not equal to 0, it is determined that the first device is in a normal configuration state and the second device is in an abnormal configuration state;
[0066] Wherein, n is a positive integer, and n is less than or equal to N, and N is the number of clock cycles in the first time period.
[0067] It should be noted that since the first data set is acquired at the rising edge of the clock cycle and the second data set is acquired at the falling edge of the clock cycle, and in the clock cycle, the rising edge is earlier than the falling edge, if the second device is in an abnormal state, the DATA signal will continue the signal acquired from the first device in the same clock cycle.
[0068] Therefore, if the nth data in the first data set is not equal to 0, it means that there is valid data in the first data set, that is, the electronic device can normally obtain data from the first device, so that the first device is in a normal configuration state;
[0069] If the nth data in the first data set is equal to the nth data in the second data set, since the first device and the second device transmitted different data in the first time period, it means that the electronic device cannot normally obtain data from the second device, and the data in the second data set is only because the level state of the DATA signal continues the signal previously obtained from the first device.
[0070] In this way, according to the first judgment result, it can be determined whether the electronic device is in the state of the first device being normal / the second device being abnormal.
[0071] In addition, in some embodiments, determining the configuration status of the first device and the second device based on the judgment result may include:
[0072] When the first judgment result indicates that the nth data in the first data set is not equal to the nth data in the second data set, and the nth data in the first data set and the nth data in the second data set are both not equal to 0, determine the configuration status of the first device and the second device according to the second judgment result.
[0073] It should be noted that if the first judgment result indicates that the nth data in the first data set is not equal to the nth data in the second data set, and the nth data in the first data set and the nth data in the second data set are both not equal to 0, it is necessary to further consider the second judgment result to determine the configuration status of the first device and the second device.
[0074] In another specific embodiment, determining the configuration status of the first device and the second device according to the second judgment result may include:
[0075] When the second judgment result indicates that the (n+1)th data in the first data set and the nth data in the second data set are not equal, it is determined that both the first device and the second device are in a normal configuration state.
[0076] It should be noted that since the first data set is acquired at the rising edge of the clock cycle and the second data set is acquired at the falling edge of the clock cycle, and in the clock cycle, the rising edge is earlier than the falling edge, therefore, if the first device is in an abnormal state, the DATA signal will continue the signal acquired from the second device in the previous clock cycle.
[0077] Therefore, if the nth data in the first data set and the nth data in the second data set are not completely equal, the n+1th data in the first data set and the nth data in the second data set are not completely equal, and the data in the first data set and the second data set are not all zero, this indicates that the electronic device can obtain valid data from the first device and the second device respectively, that is, the first device and the second device are both in a normal configuration state.
[0078] In this way, according to the first judgment result and the second judgment result, it can be determined whether the electronic device is in the first device normal / second device normal state.
[0079] In yet another specific embodiment, determining the configuration status of the first device and the second device according to the second judgment result may include:
[0080] When the second judgment result indicates that the (n+1)th data in the first data set is equal to the nth data in the second data set, it is determined that the first device is in an abnormal configuration state and the second device is in a normal configuration state.
[0081] In this way, if the nth data in the first data set and the nth data in the second data set are not completely equal, but the n+1th data in the first data set and the nth data in the second data set are completely equal, and the data in the second data set are not all 0, it means that the electronic device can only obtain data from the second device but not from the first device, and the data in the first data set is only because the level state of the DATA signal continues the signal previously obtained from the second device.
[0082] In this way, based on the first judgment result and the second judgment result, it can be determined whether the electronic device is in a state where the first device is abnormal / the second device is normal.
[0083] Furthermore, in some embodiments, the method may also include:
[0084] Based on the configuration states of the first device and the second device, determining a target device in a normal configuration state from the first device and the second device;
[0085] A data collection direction of the target device is determined based on the first data set or the second data set.
[0086] It should be noted that, through the above-mentioned determination method, the configuration status of each of the first device and the second device can be determined, and the target device in the normal configuration state can also be determined. In addition, generally speaking, the first device and the second device have different data collection directions, such as two microphones are generally divided into a left microphone and a right microphone. Therefore, according to the first data set and the second data set, the data collection direction of the target device can be determined.
[0087] The embodiment of the present application provides a state detection method, by determining a first time period, the first time period includes multiple clock cycles; obtaining a first data set and a second data set; wherein the first data set includes data obtained from the first device at the rising edge of multiple clock cycles in the first time period; the second data set includes data obtained from the second device at the falling edge of multiple clock cycles in the first time period; based on the data in the first data set in the first time period and the data in the second data set, a judgment result is obtained; based on the judgment result, the configuration state of the first device and the second device is determined. In this way, since the first data set includes the timing data obtained from the first device at the rising edge of the clock, and the second data set includes the timing data obtained from the second device at the falling edge of the clock, a more comprehensive judgment result can be determined based on the first data set and the second data set, thereby better detecting whether the two peripheral devices are in a normal connection state, and improving the detection accuracy.
[0088] In another embodiment of the present application, the state detection method is specifically described by taking the first device and the second device as microphones as an example. Figure 4 , which shows a flow chart of another state detection method provided by an embodiment of the present application. Figure 4 As shown, the method may include:
[0089] S201: Play audio data with different left and right channel signals, sample the data at the first microphone at the rising edge of the CLK signal, and obtain T n R series; sample the data at the second microphone at the falling edge of the CLK signal to obtain T n F series.
[0090] It should be noted that when the configuration status of the two microphones is detected, the left and right speakers of the electronic device are first controlled to play the stereo sound source, and the left and right channel signals of the sound source are as different as possible. Then, the data of the microphone at the rising and falling edges of CLK are sampled respectively by software control method, and stored as two series respectively: T n R series and T n F series.
[0091] Here, see Figure 1 The first microphone is MIC1, which is the microphone with the Select pin connected to the GND signal; the second microphone is MIC2, which is the microphone with the Select pin connected to the V dd Signal microphone.
[0092] S202: Determine whether there are T n R=T n F=0, n is a positive integer.
[0093] For step S202, if the judgment result is yes, then execute step S203; if the judgment result is no, then execute step S204.
[0094] S203: Determine that both the first microphone and the second microphone are not in place.
[0095] It should be noted that if T n R=T n F=0, indicating that both the first microphone and the second microphone are in abnormal configuration state, that is, both the first microphone and the second microphone are not in place.
[0096] S204: Determine whether there are T n R=T n F, and T n R.T n F is not always zero.
[0097] For step S204, if the judgment result is yes, then execute step S205; if the judgment result is no, then execute step S206.
[0098] S205: The first microphone is in place, and the second microphone is not in place.
[0099] It should be noted that, when the first microphone is in place and the second microphone is not in place, see Figure 5 , which shows a signal waveform schematic diagram provided by an embodiment of the present application. Figure 5 In the example, CLK is the clock signal, and DATA is the data signal obtained after sampling. T1R represents the rising edge of the CLK signal in the first cycle, and T1F represents the falling edge of the CLK signal in the first cycle, and the same can be said for the subsequent ones.
[0100] like Figure 5 As shown, since the first microphone is in place, the DATA signal is output stably at the rising edge of the CLK signal (T1R / T2R / T3R / T4R, etc.); and the second microphone is not in place, so at the falling edge of CLK, the signal on DATA still continues the amplitude at the rising edge. Therefore, the signal sampled at the falling edge of the CLK signal (T1F / T2F / T3F / T4F, etc.) is the same as the signal sampled at the rising edge of the CLK signal (T1R / T2R / T3R / T4R). If the data sampled at the rising and falling edges are sorted into two series TR and TF respectively, they can be expressed by mathematical formulas: T1R = T1F; T2R = T2F; T3R = T3F; T4F = T4R..., that is, T n R=T n F.
[0101] So, if T n R=T n F, and T n R.T n F is not all 0, which means that the first microphone is in a normal configuration state and the second microphone is in an abnormal configuration state.
[0102] S206: Determine whether T n+1 R=T n F, and T n R.T n F is not always zero.
[0103] For step S206, if the judgment result is yes, then execute step S207; if the judgment result is no, then execute step S208.
[0104] S207: Determine that the first microphone is not in place and the second microphone is in place.
[0105] It should be noted that, in the case where the first microphone is not in place but the second microphone is in place, refer to FIG. 6 , which shows another signal waveform schematic diagram provided in an embodiment of the present application.
[0106] like Figure 6 As shown, since the second microphone is in place, the DATA signal has a stable output at the falling edge of the CLK signal (T1F / T2F / T3F / T4F, etc.); and the first microphone is not in place, so at the second rising edge of the CLK signal, the signal on DATA still continues the amplitude of the previous falling edge, so the signal sampled at the rising edge of the CLK signal (T2R / T3R / T4R / T5R, etc.) is the same as the signal sampled at the previous falling edge (T1F / T2F / T3F / T4F, etc.). If the data sampled at the rising and falling edges are sorted into two series TR and TF respectively, they can be expressed by mathematical formulas: T2R = T1F; T3R = T2F; T4R = T3F; T5F = T4R..., that is, T (n+1) R=T n F
[0107] So, if T n+1 R=T n F, and T n R.T n F is not all 0, which means that the first microphone is in an abnormal configuration state and the second microphone is in a normal configuration state.
[0108] S208: Determine that both the first microphone and the second microphone are in place.
[0109] It should be noted that, when both the first microphone and the second microphone are in place, see Figure 7 , which shows another signal waveform schematic diagram provided by an embodiment of the present application. When both microphones are in place, because different signals of the left and right channels of stereo are deliberately played on the speaker, the data sampled on the rising and falling edges of the microphone DATA signal represent the data collected by the left and right microphones respectively, so the data collected on the rising and falling edges in the same cycle cannot be completely the same.
[0110] like Figure 7 As shown, for n = 1, 2, 3, 4 ..., T n R and T n There is no necessary connection between F; T (n+1) R and T n There is no necessary connection between F. Therefore, after excluding abnormal situations such as "both microphones are not in place", "only the first microphone is in place", and "only the second microphone is in place", the only thing left is that both microphones are in place.
[0111] So, if T n R and T n F is not exactly the same, T (n+1) R and T n F is not exactly the same, and T n R and T n If F is not completely 0, it means that both microphones are in place.
[0112] In summary, in the related art, when only one microphone is in place, no matter what the sound signal in the environment is, the data sampled on the rising edge and the falling edge in the same cycle of the DATA signal are all provided by the microphone in place, and therefore will be the same. Therefore, the embodiment of the present application uses a software method to detect whether the two microphones connected to the same hardware PDM interface signal are both in place. In other words, taking the detection of the microphone as an example, the electronic device does not need to add additional hardware, but can use the speakers built into the tablet or mobile phone, as well as a set of software algorithm solutions, to identify whether the microphones are in place.
[0113] For example, take the example of detecting whether the two microphones of the electronic device are configured normally, see Figure 1 and Figure 4 The detection process provided in the embodiment of the present application is as follows:
[0114] First, the whole machine plays stereo sound sources, and the sound signals of the left and right speakers are clearly distinguished.
[0115] Then, the preset detection software reads the data of the rising edge and falling edge of the microphone clock for a certain time length (such as 10 seconds), and arranges the data of the rising edge into a list TR = [T1R, T2R, T3R, T4R ... T n R], the falling edge data is arranged into another list TF = [T1F, T2F, T3F, T4F...T n F].
[0116] Finally, the two data lists are judged as follows:
[0117] (1) For n = 1, 2, 3, 4, ..., are there T n R=T n F=0? If yes, then both microphones are not in place; if no, proceed to the next step
[0118] (2) For n = 1, 2, 3, 4, ..., do all of them have T n R=T n F, but not all 0? If yes, then only the microphone with Select = GND is installed; the other microphone with Select = VDD is not installed; if no, proceed to the next step.
[0119] (3) Is there T for n = 1, 2, 3, 4, etc.? (n+1) R=T n F? If yes, then only the microphone with SELECT=VDD is installed; the other microphone with SELECT=GND is not installed.
[0120] If the above three judgment results are all negative, then both microphones are installed in place.
[0121] An embodiment of the present application provides a state detection method, and the specific implementation method of the aforementioned embodiment is elaborated in detail through this embodiment. It can be seen that since the first data set includes the timing data obtained from the first device at the rising edge of the clock, and the second data set includes the timing data obtained from the second device at the falling edge of the clock, a more comprehensive judgment result can be determined based on the first data set and the second data set, thereby better detecting whether the two peripheral devices are in a normal connection state, thereby improving the detection accuracy.
[0122] In yet another embodiment of the present application, see Figure 8 , which shows a schematic diagram of the composition structure of an electronic device 30 provided in an embodiment of the present application. Figure 8 As shown, the electronic device 30 includes a first determination module 301, an acquisition module 302, a judgment module 303 and a second determination module 304; wherein,
[0123] A first determining module 301 is configured to determine a first time period, where the first time period includes a plurality of clock cycles;
[0124] The acquisition module 302 is configured to acquire a first data set and a second data set; wherein the first data set includes data acquired from the first device at the rising edges of multiple clock cycles in the first time period; and the second data set includes data acquired from the second device at the falling edges of multiple clock cycles in the first time period;
[0125] A judgment module 303 is configured to make a judgment based on the data in the first data set in the first time period and the data in the second data set to obtain a judgment result;
[0126] The second determining module 304 is configured to determine the configuration status of the first device and the second device based on the determination result.
[0127] In some embodiments, the judgment result includes a first judgment result and / or a second judgment result; accordingly, the judgment module 303 is specifically configured to judge the data obtained from the first device and the data obtained from the second device in the same clock cycle based on the first data set and the second data set to obtain a first judgment result; and / or, based on the first data set and the second data set, to judge the data obtained from the first device and the data obtained from the second device in adjacent clock cycles to obtain a second judgment result.
[0128] In some embodiments, the second determination module 304 is further configured to determine that the first device is in a normal configuration state and the second device is in an abnormal configuration state when the first judgment result indicates that the nth data in the first data set is equal to the nth data in the second data set, and the nth data in the first data set is not equal to 0; wherein n is a positive integer, and n is less than or equal to N, and N is the number of clock cycles in the first time period.
[0129] In some embodiments, the second determination module 304 is further configured to determine the configuration status of the first device and the second device according to the second judgment result when the first judgment result indicates that the nth data in the first data set is not equal to the nth data in the second data set, and the nth data in the first data set and the nth data in the second data set are both not equal to 0.
[0130] In some embodiments, the second determination module 304 is further configured to determine that the first device and the second device are both in a normal configuration state when the second judgment result indicates that the n+1th data in the first data set and the nth data in the second data set are not equal.
[0131] In some embodiments, the second determination module 304 is further configured to determine that the first device is in an abnormal configuration state and the second device is in a normal configuration state when the second judgment result indicates that the n+1th data in the first data set is equal to the nth data in the second data set.
[0132] In some embodiments, the second determination module 304 is further configured to determine a target device in a normal configuration state from the first device and the second device based on the configuration status of the first device and the second device; and determine a data collection direction of the target device based on the first data set or the second data set.
[0133] In some embodiments, both the first device and the second device include a data acquisition device; accordingly, the acquisition module 302 is further configured to acquire the preset sound signal at the rising edges of multiple clock cycles in the first time period through the data acquisition device in the first device to obtain the data in the first data set;
[0134] The data collection device in the second device collects the preset sound signal at the falling edges of multiple clock cycles in the first time period to obtain the data in the second data set.
[0135] It is understandable that in this embodiment, a "unit" may be a part of a circuit, a part of a processor, a part of a program or software, etc., and may also be a module or non-modular. Moreover, each component in this embodiment may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional module.
[0136] If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or the part that contributes to the prior art or the whole or 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, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in this embodiment. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.
[0137] Therefore, this embodiment provides a computer storage medium, which stores a computer program. When the computer program is executed by multiple processors, the steps of the method in any one of the above embodiments are implemented.
[0138] Based on the above-mentioned composition of an electronic device 30 and a computer storage medium, see Fig. 9 , which shows a hardware structure diagram of an electronic device 30 provided in an embodiment of the present application. Fig. 9 As shown, the electronic device 30 may include: a communication interface 401, a memory 402 and a processor 403; each component is coupled together via a bus device 404. It is understood that the bus device 404 is used to realize the connection and communication between these components. In addition to the data bus, the bus device 404 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Fig. 9 Various buses are labeled as bus devices 404. Among them, the communication interface 401 is used to receive and send signals during the process of sending and receiving information between other external network elements;
[0139] Memory 402, used to store computer programs that can be run on processor 403;
[0140] The processor 403 is configured to execute, when running the computer program:
[0141] Determine a first time period, the first time period including a plurality of clock cycles;
[0142] Acquire a first data set and a second data set; wherein the first data set includes data acquired from the first device at rising edges of multiple clock cycles in a first time period; and the second data set includes data acquired from the second device at falling edges of multiple clock cycles in the first time period;
[0143] Perform judgment based on the data in the first data set in the first time period and the data in the second data set to obtain a judgment result;
[0144] Based on the determination result, the configuration status of the first device and the second device is determined.
[0145] It can be understood that the memory 402 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DRRAM). The memory 402 of the apparatus and method described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0146] The processor 403 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 403. The above processor 403 may be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor are combined and executed. The software module can be located in a mature storage medium in the field 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 402, and the processor 403 reads the information in the memory 402 and completes the steps of the above method in combination with its hardware.
[0147] It is understood that the embodiments described in the present application can be implemented by hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application or a combination thereof.
[0148] For software implementation, the technology described in this application can be implemented by a module (e.g., a procedure, a function, etc.) that performs the functions described in this application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0149] Optionally, as another embodiment, the processor 403 is further configured to execute the steps of the method described in any one of the aforementioned embodiments when running the computer program.
[0150] Based on the above-mentioned schematic diagram of the composition of the electronic device 30, see Fig.10 , which shows a schematic diagram of the composition structure of a state detection system 40 provided in an embodiment of the present application. Fig.10 As shown, the state detection system at least includes the electronic device 30 described in any one of the aforementioned embodiments.
[0151] For the status detection system 40, the status detection system 40 includes an electronic device 30. Since the first data set includes timing data obtained from the first device at the rising edge of the clock, and the second data set includes timing data obtained from the second device at the falling edge of the clock, a more comprehensive judgment result can be determined based on the first data set and the second data set, thereby better detecting whether the two peripheral devices are in a normal connection state, thereby improving the detection accuracy.
[0152] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.
[0153] It should be noted that, in this application, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0154] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0155] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0156] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0157] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0158] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A state determination method, characterized in that: The method comprises: determining a first time period, the first time period comprising a plurality of clock cycles; Acquire a first data set and a second data set; wherein the first data set includes data acquired from the first device at rising edges of multiple clock cycles in the first time period; and the second data set includes data acquired from the second device at falling edges of multiple clock cycles in the first time period; According to the first data set and the second data set, judging the data acquired from the first device and the data acquired from the second device in the same clock cycle to obtain a first judgment result; and / or, According to the first data set and the second data set, judging the data acquired from the first device and the data acquired from the second device in adjacent clock cycles to obtain a second judgment result; Based on the first judgment result and / or the second judgment result, the configuration status of the first device and the second device is determined.
2. The method according to claim 1, characterized in that When the judgment result includes a first judgment result, determining the configuration status of the first device and the second device based on the first judgment result and / or the second judgment result includes: When the first judgment result indicates that the nth data in the first data set is equal to the nth data in the second data set, and the nth data in the first data set is not equal to 0, determining that the first device is in a normal configuration state and the second device is in an abnormal configuration state; Wherein, n is a positive integer, and n is less than or equal to N, and N is the number of clock cycles in the first time period.
3. The method according to claim 1, characterized in that When the judgment result includes a first judgment result and a second judgment result, determining the configuration status of the first device and the second device based on the first judgment result and / or the second judgment result includes: When the first judgment result indicates that the nth data in the first data set is not equal to the nth data in the second data set, and the nth data in the first data set and the nth data in the second data set are both not equal to 0, determine the configuration status of the first device and the second device according to the second judgment result.
4. The method according to claim 3, characterized in that The determining, according to the second judgment result, the configuration status of the first device and the second device includes: When the second judgment result indicates that the (n+1)th data in the first data set and the nth data in the second data set are not equal, it is determined that both the first device and the second device are in a normal configuration state.
5. The method according to claim 3, characterized in that: The determining, according to the second judgment result, the configuration status of the first device and the second device includes: When the second judgment result indicates that the (n+1)th data in the first data set is equal to the nth data in the second data set, it is determined that the first device is in an abnormal configuration state and the second device is in a normal configuration state.
6. The method according to claim 1, characterized in that The method further comprises: Based on the configuration states of the first device and the second device, determining a target device in a normal configuration state from the first device and the second device; A data collection direction of the target device is determined based on the first data set or the second data set.
7. The method according to any one of claims 1 to 6, characterized in that: The first device and the second device both include a data acquisition device; the method further includes: The data in the first data set is obtained by collecting a preset sound signal at the rising edges of a plurality of clock cycles in the first time period through the data collection device in the first device; The data in the second data set is obtained by collecting the preset sound signal at the falling edges of multiple clock cycles in the first time period through the data collection device in the second device.
8. An electronic device, characterized in that: The electronic device includes a first determination module, an acquisition module, a judgment module and a second determination module; wherein, The first determining module is used to determine a first time period, where the first time period includes a plurality of clock cycles; The acquisition module is used to acquire a first data set and a second data set; wherein the first data set includes data acquired from the first device at rising edges of multiple clock cycles in the first time period; and the second data set includes data acquired from the second device at falling edges of multiple clock cycles in the first time period; The judgment module is used to judge the data obtained from the first device and the data obtained from the second device in the same clock cycle according to the first data set and the second data set to obtain a first judgment result; and / or, to judge the data obtained from the first device and the data obtained from the second device in adjacent clock cycles according to the first data set and the second data set to obtain a second judgment result; The second determination module is configured to determine a configuration state of the first device and the second device based on the first determination result and / or the second determination result.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the state determination method according to any one of claims 1 to 7 can be implemented.
