Gain control method, gain control unit and storage medium

By using RSSI values ​​and control marks in wireless communication systems, combined with I/Q signals, fine precision control of gain adjustment is achieved, which solves the problems of slow response speed and low accuracy of the automatic gain control unit, and improves the system's signal processing capability .

CN119254167APending Publication Date: 2025-01-03GUANG ZHOU XRADIO TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411333053.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

The automatic gain control unit in the existing wireless communication system has a slow response speed during the AGC loop startup stage and the gain adjustment accuracy is not high, which cannot meet the rapid response when signal power changes.

Method used

By determining the RSSI value and gain data based on the I/Q signal output from the analog-to-digital converter, gain adjustment is realized, the control mark takes effect in the preamble part of the data frame, and fine precision adjustment is performed in combination with the RSSI value to improve response speed and accuracy.

Benefits of technology

The gain adjustment response speed and accuracy are improved, ensuring that the receiver can quickly adapt when the signal power changes, avoiding saturation or noise flooding problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254167A_ABST
    Figure CN119254167A_ABST
Patent Text Reader

Abstract

The invention provides a gain control method, a gain control unit and a storage medium, and relates to the technical field of communication. The gain control method comprises the following steps: determining an RSSI value based on an I / Q signal output by an analog-to-digital converter; determining first gain data and a control identifier according to the I / Q signal; wherein the first gain data is used for indicating the gain amount of gain control when the analog-to-digital converter is in a saturated state; the control identifier is used for starting gain control when the lead code of the data frame is identified, and the gain adjustment amplitude corresponding to the control identifier is smaller than the gain adjustment amplitude corresponding to the first gain data; and according to the first gain data and second gain data determined based on the control identifier and the RSSI value, a target gain adjustment amount is determined, and the target gain adjustment amount is used for adjusting the analog gain of the analog front-end circuit. According to the embodiment of the invention, the gain adjustment response speed is higher, and the gain adjustment precision is higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a gain control method, a gain control unit and a storage medium. Background Art

[0002] In a wireless communication system, the signal sent by the transmitter will be affected by factors such as climate, obstructions, interference, and signal fading during the propagation process, causing the signal strength received by the receiver to vary greatly. After receiving the signal, the receiver will adjust the received signal to obtain the baseband signal. When the received signal power is too large, the receiver may be saturated or blocked. When the received signal power is too small, the valid data frame may be submerged in the noise, and the receiver cannot work properly. Therefore, an automatic gain control unit is required in the receiver to adjust the signal strength to ensure the stability of the receiver output signal amplitude. In the related art, the gain control of the automatic gain control unit has the problem of slow response speed in the startup phase of the AGC loop and low gain adjustment accuracy. Based on this, how to make the gain control unit achieve fast gain adjustment response speed and high gain adjustment accuracy is a technical problem that needs to be solved urgently. Summary of the invention

[0003] The present application aims to solve at least one of the technical problems existing in the prior art. To this end, the present application proposes a gain control method, a gain control unit and a storage medium, which can solve the problems of slow gain adjustment response speed and low gain adjustment accuracy of the gain control unit in the related art.

[0004] In a first aspect, an embodiment of the present application provides a gain control method of a gain control unit, wherein an input end of the gain control unit is used to be connected to an output end of a digital-to-analog converter, and an input end of the digital-to-analog converter is connected to an analog front-end circuit; the gain control method comprises:

[0005] Determine the RSSI value based on the I / Q signal output by the analog-to-digital converter;

[0006] Determine first gain data and a control identifier according to the I / Q signal; wherein the first gain data is used to indicate a gain amount for gain control when the analog-to-digital converter is in a saturated state; the control identifier is used to start gain control when a valid preamble code of a data frame is identified, and the gain adjustment amplitude corresponding to the control identifier is less than the gain adjustment amplitude corresponding to the first gain data;

[0007] A target gain adjustment amount is determined according to the first gain data and second gain data determined based on the control identifier and the RSSI value, wherein the target gain adjustment amount is used to adjust the analog gain of the analog front-end circuit.

[0008] In a second aspect, an embodiment of the present application provides a gain control unit, the gain control unit comprising:

[0009] A received signal strength indication RSSI module, wherein the input end of the RSSI module is connected to the output end of the digital-to-analog converter; the RSSI module is used to determine the RSSI value based on the I / Q signal output by the analog-to-digital converter; the input end of the digital-to-analog converter is connected to the analog front-end circuit;

[0010] A gain detection module, wherein the input end of the gain detection module is connected to the output end of the digital-to-analog converter; the gain detection module is used to determine first gain data and a control identifier according to the I / Q signal; wherein the first gain data is used to indicate the gain amount for gain control when the analog-to-digital converter is in a saturated state; the control identifier is used to start gain control when a valid preamble of a data frame is identified, and the gain adjustment amplitude corresponding to the control identifier is less than the gain adjustment amplitude corresponding to the first gain data;

[0011] A gain adjustment module, the gain adjustment module is used to determine a target gain adjustment amount according to the first gain data and second gain data determined based on the control identifier and the RSSI value, wherein the target gain adjustment amount is used to adjust the analog gain of the analog front-end circuit.

[0012] In a third aspect, an embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute a gain control method as described in the first aspect above.

[0013] According to the gain control unit of the embodiment of the present application, at least the following beneficial effects are achieved: through the first gain data and the control identifier, the gain adjustment can be performed when the digital-to-analog converter is in a saturated state and when a valid preamble of the data frame is identified, so that the gain control is only effective in the preamble part of the data frame. And by adjusting a larger gain adjustment amplitude when the digital-to-analog converter is in a saturated state, a coarse-precision gain adjustment can be achieved, and by adjusting a smaller gain adjustment amplitude when the preamble of the data frame is identified, a fine-precision gain adjustment can be achieved; thereby, the response speed of the gain adjustment can be improved. And the fine-precision gain adjustment is adjusted based on the second gain data determined by the RSSI value, so the gain adjustment accuracy is higher. Therefore, compared with the related art, the gain adjustment response speed of the embodiment of the present application is faster and the gain adjustment accuracy is higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 A schematic diagram of a module of a gain control unit provided in this application;

[0015] Figure 2A schematic diagram of a module of an embodiment of a gain control unit application provided by the present application;

[0016] Figure 3 A schematic flow chart of a gain control method of a gain control unit provided in the present application;

[0017] Figure 4 A schematic diagram of second gain data detection of an embodiment of a gain control method of a gain control unit provided by the present application;

[0018] Figure 5 A schematic diagram of detecting first gain data of an embodiment of a gain control method of a gain control unit provided by the present application;

[0019] Figure 6 A schematic diagram of RSS I detection of an embodiment of a gain control method of a gain control unit provided by the present application;

[0020] Figure 7 A schematic diagram of the hardware structure of an audio device provided in this application. DETAILED DESCRIPTION

[0021] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.

[0022] In the description of the present application, it should be understood that descriptions involving orientation, such as up, down, front, back, left, right, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.

[0023] In the description of this application, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed", etc. are understood to exclude the number itself, and "above", "below", "within", etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0024] In the description of this application, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in this application based on the specific content of the technical solution.

[0025] In order to make the description of the following embodiments clear and concise, a brief introduction to the related technology is first given:

[0026] Automatic gain control, also known as automatic gain control, is referred to as AGC.

[0027] Analog-to-Digital Converter, also known as ADC, can be used to convert analog signals into digital signals.

[0028] Received Signal Strength Indication, also known as RSSI, can be used to determine the quality of the link and whether to increase the broadcast transmission strength.

[0029] FPGA, which stands for Field-Programmable Gate Array, means field programmable gate array in Chinese.

[0030] ASIC, which stands for Application Specific Integrated Circuit, means special integrated circuit in Chinese.

[0031] The LUT table (Look-Up Table) is essentially a RAM that stores pre-calculated data values. When a signal is input, the LUT table quickly obtains the result by looking up the pre-stored data values, thereby speeding up the calculation process.

[0032] Medium frequency, also known as Medium Frequency, abbreviated as MF.

[0033] Radio Frequency, also known as Radio Frequency, is referred to as RF.

[0034] In a wireless communication system, the signal sent by the transmitter will be affected by factors such as climate, obstructions, interference, and signal fading during the propagation process, causing the signal strength received by the receiver to vary greatly. After receiving the signal, the receiver will adjust the received signal to obtain a baseband signal. When the received signal power is too large, the receiver may be saturated or blocked. When the received signal power is too small, the valid data frame may be submerged in the noise, and the receiver cannot work normally. Therefore, an automatic gain control unit is required in the receiver to adjust the signal strength to ensure the stability of the receiver output signal amplitude. The automatic gain control unit in the prior art usually includes a power detection module, a logarithmic operation module, a loop filter module, and an antilogarithmic operation module. The power detection module, the logarithmic operation module, the loop filter module, and the antilogarithmic operation module output a control signal for gain control. However, the gain control of the automatic gain control unit based on the above modules has the problem of slow response speed in the startup phase of the AGC loop and low gain adjustment accuracy. For devices such as Bluetooth devices, it is impossible to meet the rapid response when the signal power changes. Based on this, how to make the gain control unit achieve fast gain adjustment response speed and high gain accuracy is a technical problem to be solved urgently. Based on this, embodiments of the present application provide a control method of a gain control unit, a gain control unit, and a storage medium.

[0035] In the present application, a control method of a gain control unit, a gain control unit and a storage medium are provided, which are described in detail one by one in the following embodiments.

[0036] Reference Figure 1 According to a gain control unit provided in an embodiment of the present application, the gain control unit includes:

[0037] A received signal strength indication RSSI module, wherein the input end of the RSSI module is connected to the output end of the digital-to-analog converter; the RSSI module is used to determine the RSSI value based on the I / Q signal output by the analog-to-digital converter; the input end of the digital-to-analog converter is connected to the analog front-end circuit;

[0038] A gain detection module, wherein the input end of the gain detection module is connected to the output end of the digital-to-analog converter; the gain detection module is used to determine the first gain data and the control identifier according to the I / Q signal; wherein the first gain data is used to indicate the gain amount for gain control when the analog-to-digital converter is in a saturated state; the control identifier is used to start the gain control when a valid preamble of the data frame is identified, and the gain adjustment amplitude corresponding to the control identifier is less than the gain adjustment amplitude corresponding to the first gain data;

[0039] The gain adjustment module is used to determine a target gain adjustment amount according to the first gain data and the second gain data determined based on the control identifier and the RSSI value, wherein the target gain adjustment amount is used to adjust the analog gain of the analog front-end circuit.

[0040] It is understandable that the gain control unit can be implemented based on Fpga or ASIC, and the present application does not limit the specific implementation form of the RSSI module, the gain detection module, and the gain adjustment module.

[0041] The analog front-end circuit is used to convert the RF signal received by the antenna into an intermediate frequency signal. The ADC is used to process the intermediate frequency signal output by the analog front-end circuit to obtain an I / Q signal.

[0042] The embodiment of the present application does not limit the content of the first gain data and the second gain data. In some embodiments, the target gain adjustment amount is determined based on a table lookup method, and the first gain data and the second gain data both contain a gain index, and the target gain adjustment amount is determined based on the gain index. In other embodiments, the first gain data and the second gain data may also include specific gain adjustment values, and the embodiment of the present application may selectively set this according to actual needs.

[0043] It is understandable that the gain adjustment module is used to determine whether to determine the target gain adjustment amount based on the first gain data or the second gain data according to a preset gain adjustment condition. The gain adjustment condition is used to ensure the adjustment priority of the first gain data and the second gain data when adjusting the gain of the same data frame, thereby reducing the probability of repeated adjustment.

[0044] For example, Figure 2 The block diagram of some modules of a network device with a gain control unit shown in the figure, wherein the gain control unit includes an RSSI module, a gain detection module and a gain adjustment module. The gain detection module includes a saturation detection module, a gain coarse adjustment detection module, a filter preprocessing module and a gain fine adjustment detection module. The RSSI module and the gain detection module are both connected to the output end of the ADC, and the input end of the ADC is connected to the output end of the analog front-end circuit.

[0045] The gain adjustment module can be implemented through a LUT table. In other embodiments, the execution steps of the gain adjustment module can also be implemented through program logic. This embodiment of the present application will not go into details.

[0046] Among them, taking the gain adjustment module implemented by LUT table as an example, Figure 2As shown, the RF input is processed by the gain control, mixing, filtering and other processing of the analog front-end circuit to obtain an intermediate frequency signal, and the intermediate frequency signal is input into the ADC to obtain the I / Q two-way digital signal, and the I / Q two-way digital signal is sent to the RSSI calculation module, the saturation detection module and the filter preprocessing module in the gain control unit to obtain the RSSI value, the saturation indication sat_ind and the preprocessed I1 / Q1 digital signal (i.e., I1+i*Q1) respectively. Then the sat_ind signal is sent to the gain coarse adjustment detection module to generate the gain large step back indication step signal (i.e., the first gain data), the signals I1 and Q1 are sent to the gain fine adjustment detection module to generate the gain small step back convert signal (i.e., the control mark), the RSSI value, the step signal and the convert signal are sent to the LUT table, and the LUT table determines which gain data to select for adjustment based on the step signal and the convert signal. If the first gain data is selected, the adjustment amount is determined based on the step signal; if the control mark is selected, the gain gear index is determined based on the RSSI value and the convert signal and determined by looking up the table.

[0047] It is understandable that the calculation and convergence of RSSI requires a certain amount of time; during the calculation and convergence process of RSSI, no RSSI value is output or the RSSI value is an invalid value, and gain adjustment cannot be performed based on the second gain data.

[0048] In some embodiments, the second gain data can be determined based on the numerical validity of the control identifier. For example, if it is valid, the valid second gain data can be generated based on the valid RSSI. If it is invalid, the valid second gain data cannot be generated based on the RSSI. In other embodiments, the control identifier is generated only when the preamble is valid, so that the second gain data can be generated only when the control identifier is generated.

[0049] In some embodiments, the filter pre-processing module may be a low-pass filter to filter out interference information.

[0050] Reference Figure 3 As shown, the embodiment of the present application also provides a control method for a gain control unit, wherein the input end of the gain control unit is used to be connected to the output end of the digital-to-analog converter, and the input end of the digital-to-analog converter is connected to the analog front-end circuit; the gain control method includes:

[0051] Step S100, determining an RSSI value based on an I / Q signal output by the analog-to-digital converter;

[0052] Step S200, determining first gain data and a control identifier according to the I / Q signal; wherein the first gain data is used to indicate the gain amount for gain control when the analog-to-digital converter is in a saturated state; the control identifier is used to start gain control when a valid preamble of a data frame is identified, and the gain adjustment amplitude corresponding to the control identifier is less than the gain adjustment amplitude corresponding to the first gain data;

[0053] Step S300: determining a target gain adjustment amount according to the first gain data and the second gain data determined based on the control identifier and the RSSI value, wherein the target gain adjustment amount is used to adjust the analog gain of the analog front-end circuit.

[0054] Therefore, through the first gain data and the control identifier, the gain adjustment can be performed when the digital-to-analog converter is in a saturated state and when a valid preamble of the data frame is identified, so that the gain control is only effective in the preamble part of the data frame. And by adjusting a larger gain adjustment amplitude when the digital-to-analog converter is in a saturated state, a coarse-precision gain adjustment can be achieved, and by adjusting a smaller gain adjustment amplitude when the preamble of the data frame is identified, a fine-precision gain adjustment can be achieved; thereby, the response speed of the gain adjustment can be improved. And the fine-precision gain adjustment is adjusted based on the second gain data determined by the RSSI value, so the gain adjustment accuracy is higher. Therefore, compared with the related art, the gain adjustment response speed of the embodiment of the present application is faster and the gain adjustment accuracy is higher.

[0055] It is understandable that the first gain data and the second gain data can both be set as index identifiers, or can be set as gain data, such as the first gain data is set as a step value; the second gain data is set as a specific gain value. Taking the index identifier as an example, a gain index mapping table is established as shown in Table 1 below:

[0056] index Gain range Stepping 0 48 10 1 47 11 2 46 12 3 46 13 4 45 14 5 45 15 6 45 16 7 44 17 8 44 18 9 43 19 ... ... ... 77 22 50

[0057] Table 1

[0058] Among them, as shown in Table 1, the first column represents the index, the second column represents the gain value of the fine precision adjustment, and the third column identifies the step of the coarse precision adjustment. When the first gain data is 0, it means that the step is adjusted in steps of 10; when the first gain data is 9, it means that the step is adjusted in steps of 19. When the second gain data is 6, it means that the gain is adjusted to 45. In this regard, the embodiment of the present application will not go into too much detail. It is understandable that the above Table 1 can be obtained by actual measurement or by simulation. In this regard, the embodiment of the present application does not impose too many constraints on how to establish the mapping relationship in Table 1.

[0059] It is understandable that starting gain control means calculating the second gain data based on the RSSI value to perform gain control based on the second gain data. When the analog-to-digital converter is in a saturated state and no valid preamble is identified, the target gain adjustment amount is determined according to the first gain data.

[0060] It is understandable that the embodiment of the present application does not limit the method of identifying whether the preamble code of the data frame is valid based on the I / Q signal in step S200.

[0061] In some embodiments, the first gain data is generated only when the analog-to-digital converter is in a saturated state. In other embodiments, valid first gain data is generated when the analog-to-digital converter is in a saturated state, and invalid first gain data is generated when the analog-to-digital converter is in a non-saturated state, thereby making it possible to identify whether the digital-to-analog converter is in a saturated state based on the validity of the first gain data.

[0062] In some embodiments, the control identifier is generated only when a valid preamble of the data frame is identified. In other embodiments, whether a valid preamble of the data frame is identified is determined based on the validity of the control identifier.

[0063] It is understood that the control identification is determined by the following steps:

[0064] Filtering the I / Q signal to obtain a first filtered signal;

[0065] Performing preamble code period detection on the first filtered signal to obtain a period identifier, and performing power increment change trend detection on the first filtered signal to obtain a power increment identifier;

[0066] When the period flag indicates that a preset period signal condition is satisfied and the power increment flag satisfies a preset power increment condition, a control flag is generated.

[0067] It is understandable that filtering the I / Q signal can suppress adjacent channel interference and noise. In some embodiments, a low-pass filter can be used to filter the I / Q signal, wherein different low-pass filter coefficients are set for different BT frame structures, so that different coefficients are used for filtering when performing signal detection on different BT frames. The BT frame structure can be subdivided into BR, EDR, BLE_1M, BLE_2M, BLE_S2, BLE_S8, etc.

[0068] It is understandable that the preamble field of the BT frame has periodicity. Therefore, through the periodic identifier, it can be determined whether the preamble field of the current data frame is valid, that is, whether the data frame is valid.

[0069] It is understandable that the power increment flag is used to determine whether new energy has arrived based on the ratio of the current signal energy to the energy before the preset time length, that is, whether it is periodically changing. Therefore, it can be determined based on the periodic flag and the power increment flag whether the preamble field of the currently restored data frame is periodically changing.

[0070] It is understandable that performing preamble period detection on the first filtered signal to obtain a period identifier includes:

[0071] Acquire a plurality of first sampling signals obtained by downsampling the first filtered signal;

[0072] Delaying each first sampling signal by a preset first time length to obtain a second sampling signal corresponding to the first sampling signal one by one; wherein the first time length is determined based on the period of the preamble code of the received data frame;

[0073] Conjugate multiplying the first sampling signal and the corresponding second sampling signal to obtain a plurality of detection signals;

[0074] The sum of the signal powers of a preset number of detection signals is taken as the first signal total power;

[0075] The plurality of detection signals are filtered through a filter, and the second filtered signal obtained by the filtering process is squared to obtain the total power of the second signal; the order of the filter is set to a preset number;

[0076] A period identifier is obtained according to the first signal total power and the second signal total power.

[0077] It is understandable that the first filtered signal may be sampled by decimation of 8 or decimation of 16, thereby obtaining a plurality of first sampling signals.

[0078] It is understandable that the first duration may be n times the period of the preamble of the data frame, where n is a positive integer greater than 1. The preset number is related to the length of the preamble, and is usually less than or equal to the length of the preamble.

[0079] Exemplarily, assuming that the number of first sampling signals is K, the K first sampling signals and the K second sampling signals are conjugate multiplied to obtain K detection signals, and the signal powers of D detection signals selected from the K detection signals are added to obtain the total power of the first signal, that is, the "sum of powers" (wherein the D detection signals can be selected randomly or sequentially, and the embodiments of the present application are not limited); the K detection signals are filtered through a D-order all-one filter to obtain a second filtered signal, and the second filtered signal is modulo squared to obtain the second signal power, that is, the "sum of powers" (wherein D is the filter coefficient and 1 is the filter coefficient). At this time, the period identifier can be obtained by referring to the following formula (1). Formula (1) is as follows:

[0080]

[0081] Among them, flag1 is the periodicity flag, TH1 is the periodicity detection threshold, when the ratio of the second signal total power to the first signal total power is greater than the periodicity detection threshold, the periodicity flag is set to a valid value 1, otherwise the periodicity flag is set to an invalid value 0.

[0082] It is understandable that performing power increment change trend detection on the first filtered signal to obtain a power increment identifier includes:

[0083] Acquire a plurality of first sampling signals obtained by downsampling the first filtered signal;

[0084] Performing an approximate modulo operation on the plurality of first sampling signals to obtain a total power of a third signal;

[0085] Smoothing the third signal total power and delaying the third signal total power to obtain a fourth signal total power;

[0086] A power increment identifier is obtained according to the fourth signal total power and the smoothed third signal total power.

[0087] It is understandable that the power of the signal can be approximately obtained by calculating the mean square value (RMS) of the signal. Therefore, by performing an approximate modulus calculation on the first sampling signal, the total power of the third signal can be obtained.

[0088] It is understandable that smoothing processing can be achieved by using an α filter; delay processing is to delay the signal power to a second time length, and the second time length can be set to be consistent with the first time length or inconsistent with it. The second time length can also be set to be related to the period of the preamble code, such as it can be set to m times the period of the preamble code, where m is a positive integer greater than 1.

[0089] Exemplarily, assuming that there are D first sampling signals, the D first sampling signals are approximately modulo-calculated to obtain the third signal total power Energy corresponding to the first filtered signal. The third signal total power is smoothed and delayed for a second time period to obtain the fourth signal power Energy_E; the power increment identifier can be obtained by referring to formula (2), where formula (2) is as follows:

[0090]

[0091] Among them, flag2 represents the power increment flag; TH2 is the energy up-jump detection threshold. Therefore, when the ratio of the total power of the third signal to the power of the fourth signal is greater than the energy up-jump detection threshold, the power increment flag is set to the valid flag 1, otherwise it is set to the invalid flag 0.

[0092] Therefore, when both the power increment flag and the cycle flag are valid, a control flag may be generated to start gain control.

[0093] It can be understood that the RSSI value is determined based on the I / Q signal output by the analog-to-digital converter, including:

[0094] Performing a single-sample point modulo operation on the I / Q signal output by the analog-to-digital converter to obtain a modulo value;

[0095] Starting from satisfying the preset signal stability condition, the module value within the preset response time is integrated to obtain the signal power corresponding to each module value;

[0096] Within the response time, the RSSI value is obtained according to the actual gain adjustment value, the preset control amount and the signal power.

[0097] In some embodiments, filtering is performed before performing a single-sample modulo operation to improve the ability to resist adjacent channel interference. In other embodiments, to further improve the ability to resist adjacent channel interference, different filters are set based on the frame structure type of each data frame, such as using one filter for BLE2M frames and another filter for non-BLE2M frames. The type of filter setting can be determined based on actual measurements of filtering of different frame structures.

[0098] It is understandable that the single-sample modulo operation is used to extract a sample signal based on the I signal and the Q signal of the I / Q signal. In some embodiments, the single-sample modulo operation can be performed on the I / Q signal based on formula (3), and formula (3) is as follows:

[0099] tmp=max(abs(I),abs(Q))+0.5*min(abs(I),abs(Q)) Formula (3)

[0100] Wherein, tmp represents the modulus value; I represents the I signal, Q represents the Q signal, and 0.5 is the modulus coefficient, which can be selectively set according to actual conditions. Then the modulus value of the I signal and Q signal output by the ADC can be determined by formula (3), or the modulus value of the I signal and Q signal obtained after filtering the I signal and Q signal output by the ADC can be determined by formula (3).

[0101] It is understandable that the signal stability condition can be set to the current moment as the time point after the analog gain adjustment is completed, where the analog gain is the gain that actually takes effect when the analog circuit in the analog front-end circuit performs analog signal conversion. The response time reflects the time from when the intermediate frequency module starts gain adjustment to when the gain adjustment of the analog front-end circuit is completed. The response time can be determined based on actual measurement or simulation test of the intermediate frequency module. The intermediate frequency module is used to process the intermediate frequency signal. Assuming that the response time is Δt, when the gain adjustment starts at time t, the power calculation will not be started within the time of t+Δt from time t, and the power calculation will be started after t+Δt, specifically, the module values ​​corresponding to the I signal and the Q signal are integrated respectively.

[0102] It can be understood that the integral operation can be understood as solving the signal power of each module value within the response time. Assuming that the analog gain changes at time t, the module values ​​calculated within Δt after the time t+Δt are tmp1, tmp2, tmp3, ..., tmpn respectively; by performing integral calculations on tmp1, tmp2, tmp3, ..., tmpn respectively, the signal powers p1, p2, p3, ..., pn can be obtained.

[0103] In some embodiments, the RSSI value may be calculated based on the average value of the signal power within the response time, where the average value of the signal power is power=(p1+p2+p3+...+pn) / n.

[0104] It is understandable that the actual gain adjustment value is the gain that actually takes effect when the analog front-end circuit performs gain control. If the analog front-end circuit uses an analog circuit and a digital circuit to perform gain control, the actual gain adjustment value is the sum of the analog gain of the analog circuit and the digital gain of the digital circuit. If the analog front-end circuit only performs gain control in the analog circuit, the actual gain adjustment value is the analog gain of the analog circuit. At this time, the RSSI value can be calculated by formula (4), which is as follows:

[0105] RSSI=20log 10 (power)+offset-AnalogGain formula (4)

[0106] Among them, RSSI is the RSSI value, power represents the mean value of the signal power within the response time, offset is the control amount, and AnalogGain represents the actual gain adjustment value. Among them, offset can be determined according to actual measurement to adjust the deviation. Therefore, the RSSI value within the response time can be obtained by performing a logarithmic operation on the mean value of the smoothed signal power and taking the difference between the value obtained by the logarithmic operation and the actual gain adjustment value, and then performing a sum operation based on the difference and the control amount.

[0107] It is understandable that whether the signal stability condition is met can be controlled by starting a timer. When the timer ends, it means that the signal stability condition is met, and a valid RSSI value can be output, and an invalid RSSI value can be output at other times.

[0108] It can be understood that the first gain data is determined by the following steps:

[0109] Get the preset saturation detection threshold;

[0110] Determine the maximum value and the minimum value of the signal according to the absolute value of the I signal and the absolute value of the Q signal;

[0111] Determine the saturation index according to the maximum value and the minimum value of the signal;

[0112] According to the saturation index and the saturation threshold, a saturation indication is obtained;

[0113] When the saturation indication indicates that the analog-to-digital converter is in a saturation state, first gain data is determined.

[0114] The embodiment of the present application does not limit the saturation detection threshold, and those skilled in the art can selectively set it according to actual needs.

[0115] In some embodiments, the saturation indication may be determined by referring to formula (5), which is as follows:

[0116]

[0117] Among them, satind is the saturation indication, SimpleSatTH is the saturation detection threshold, I is the I signal, and Q is the Q signal.

[0118] It is understandable that the first gain data can be determined based on the maximum allowed number of gain backoffs. In some embodiments, the RX channel gain is not allowed to change during demodulation, so that gain adjustment is only allowed to occur in the frame leading part, based on which the maximum allowed number of backoffs is limited to three.

[0119] In some embodiments, for each type of data frame, the initial gain value can be set to the maximum gain. When the saturation indication is determined to be valid for the first time, the initial gain value is used as the first gain data, so that the target gain adjustment amount can be determined by looking up the LUT table. When the saturation indication is determined to be valid for the second time, the adjustment will be made based on the previous first gain data, the second first gain data will be determined, and the target gain adjustment amount can be determined by looking up the LUT table. When the number of consecutive adjustments based on the first gain data reaches three times, the gain adjustment will no longer be made based on the first gain data; in other embodiments, the step of each adjustment of the coarse gain adjustment can be adjusted, so that the ADC can be changed from a saturated state to a non-saturated state within the maximum allowed number of gain backoffs.

[0120] It can be understood that determining the target gain adjustment amount according to the first gain data and the second gain data determined based on the control identifier and the RSSI value includes:

[0121] When a preset first trigger condition is met, determining a target gain adjustment amount according to the first gain data;

[0122] When a preset second trigger condition is met, determining second gain data based on the control identifier and the RSSI value and determining a target gain adjustment amount according to the second gain data;

[0123] The first trigger condition includes at least one of the following:

[0124] It is only determined that the analog-to-digital converter is in saturation;

[0125] The first gain data and the control identifier are both valid, and there is no gain adjustment record of the target gain adjustment amount determined based on the control identifier in the historical gain adjustment record of the analog front-end circuit for the same data frame;

[0126] The second trigger condition includes at least one of the following:

[0127] Only the preamble of the data frame is identified;

[0128] The first gain data and the control identifier are both valid, and a gain adjustment record of a target gain adjustment amount determined based on the control identifier exists in the historical gain adjustment record of the analog front-end circuit for the same data frame.

[0129] Only determining that the analog-to-digital converter is in a saturation state may be based on whether the first gain data is generated or on the validity of the value of the first gain data.

[0130] Only the preamble of the data frame can be identified based on whether the control flag is generated or the validity of the value of the control flag.

[0131] It is understandable that a fine gain adjustment flag may be set, so that it may be determined based on the flag whether there is a gain adjustment record of the target gain adjustment amount determined based on the control identifier.

[0132] Exemplarily, assuming that the control identifier is a convert signal generated after the preamble of the data frame is identified, and the first gain data is a step signal generated when the analog-to-digital converter is in a saturated state, when the convert signal and the step signal are detected to exist at the same time in the same cycle, and the convert signal has not been triggered for the same data frame, it means that the first trigger condition is met, and the gain control is selected based on the step signal. When the convert signal and the step signal are detected to exist at the same time in the same cycle, and the convert signal has been triggered for the same data frame, it means that the second trigger condition is met, and the gain adjustment is selected based on the second gain data. When only the convert signal is detected in the same cycle, it means that the second trigger condition is met, and the gain adjustment is selected based on the second gain data. When only the convert signal is detected in the same cycle, it means that the second trigger condition is met, and when only the step signal is detected in the same cycle, the first trigger condition is met.

[0133] It is understandable that the second gain data can be determined by formula (6), which is as follows:

[0134] x=RSSI-LogicSensitivity Formula (6)

[0135] Among them, x is the second gain data, RSSI represents the RSSI value, and LogicSensitivity is the logic sensitivity corresponding to the frame structure. The logic sensitivity corresponding to each frame structure can be determined by actual board testing. The sensitivity of BT packets of different formats is different, so for different BT packets, the value of LogicSensitivity selected in formula (6) is also different.

[0136] Exemplarily, the steps of performing gain control according to the embodiment of the present application after receiving the data frame 1 are described with reference to the accompanying drawings. The specific steps are as follows:

[0137] Step 1: Figure 2 As shown, after the data frame 1 is connected to the RF end, it is processed by the analog front-end circuit for gain control, mixing, filtering, etc. to obtain an intermediate frequency signal, and the intermediate frequency signal is input into the ADC to obtain two-way IQ digital signals, and the two-way IQ digital signals are sent to the gain control unit. Figure 2 As shown, in the same cycle, the two digital signals I signal and Q signal are simultaneously sent to the gain detection module and the RSSI calculation module for calculation.

[0138] Step 2: Reference Figure 6 As shown, in the RSSI calculation module, according to the different frame structures of data frame 1, the ADC output is sent to adjacent channel suppression filter 1 or adjacent channel suppression filter 2 to improve the ability to resist adjacent channel interference; if the frame structure of data frame 1 is a BLE2M frame, it enters adjacent channel suppression filter 1; if the frame structure of data frame 1 is a non-BLE2M frame, it enters adjacent channel suppression filter 2. Assuming that the current gain control timer is in the end state (indicating that the signal is in a stable state), the output signal of the filter is subjected to a single-sample point modulus operation to obtain the modulus value tmp1 according to formula (3); then tmp1 is integrated to obtain the signal power of tmp1. The signal powers corresponding to each modulus value are summed to obtain the mean value power of the signal power. Refer to Figure 6 As shown, the power is smoothed by α filtering operation to obtain the smoothed power power; the smoothed power power is logarithmically operated, that is, the RSSI value is output in real time according to formula (4). Among them, the gain control timer is started when the analog gain changes, and the duration of the gain control timer is set to the response duration.

[0139] Step 3: Reference Figure 2 As shown, in the gain detection module, the I / Q two-way digital signal is saturated through the saturation detection module. The saturation indication can be obtained by referring to formula (5). According to formula (5), if saturation is detected, refer to Figure 2 As shown, enter the gain coarse adjustment detection module and perform large step back of the gain. At this time, you can refer to Figure 5 The gain is backed off in large steps as shown. The gain coarse adjustment detection module is based on the principle that "RX channel gain is not allowed to change during demodulation", so that gain changes are only allowed to occur in the leading part of the frame, and the gain is configured to be backed off in large steps only three times at most. Figure 5 The figure shows the timing of three large-step gain backoffs. Each time saturation is detected, the coarse gain adjustment detection module outputs a step pulse signal, which is then sent to the LUT table to initiate gain adjustment. After both the analog circuit and the digital front end in the analog front-end circuit respond to the gain adjustment, the second saturation detection is triggered. When the saturation state is detected for the fourth time before the end of the preamble code part, the large-step adjustment is stopped.

[0140] Step 4: Reference Figure 2As shown, in the gain detection module, the I / Q digital signal passes through a filter preprocessing module formed by a low-pass filter to suppress adjacent channel interference and noise. The coefficient of the low-pass filter is adjusted for different frame structures of data frame 1. The BT frame structure supported by the low-pass filter can be subdivided into BR, EDR, BLE_1M, BLE_2M, BLE_S2, and BLE_S8. At this time, refer to Figure 4 As shown, after being processed by the low-pass filter, a first filtered signal I1+i*Q1 is obtained, and then the first filtered signal is sent to the gain fine adjustment detection module for fine-tuning the gain to obtain a more accurate gain. Figure 4 The figure shows the logic of the internal detection of the gain fine adjustment module. The gain fine adjustment detection adopts the method of "combining periodic detection and power up-jump detection". When and only when these two conditions are detected, the module will trigger the gain fine adjustment and output the convert signal. The convert signal is then sent to the LUT table for gain adjustment.

[0141] The above-mentioned detection method of "combining periodic detection with power up-jump detection" includes two conditions: "periodicity is successfully detected" and "power up-jump is successfully detected".

[0142] Among them, the periodicity is successfully detected: This detection condition is used to determine whether the preamble field of data frame 1 is periodic. Figure 4 As shown, the I / Q digital signal coming out of the filter preprocessing module obtains K first sampling signals after completing 16-out-of-1 or 8-out-of-1 downsampling. The K first sampling signals are sent to the upper and lower branches at the same time, and the lower branch is the branch for periodic detection. The signal of the lower branch is first conjugate multiplied with the D first sampling signals delayed by the first time length to obtain K signals Y, and then the K Ys are passed through a D-order all-1 filter to obtain the sum of the D signals, and then the "power of the sum" is obtained by modulo square; at the same time, the signal power of the D Ys is accumulated to obtain the "sum of power", and finally the periodicity is judged according to formula (1). When falg1=1, it means that the periodic detection is successful. Among them, the first time length is related to the period of the preamble field, D is related to the length of the preamble field, and D is also the preset number mentioned above.

[0143] Among them, the power jump is successfully detected: Energy jump perception uses the ratio of the current signal energy to the energy at the previous time E to determine whether new energy has arrived. For the I / Q signal obtained at time t, refer to Figure 4As shown, the total power of the third signal is first obtained by approximate modular operation, and then the total power of the third signal is smoothed by an α filter to obtain the total power of the third signal after smoothing, and the total power of the third signal is delayed by a point E to obtain the total power of the fourth signal. Finally, energy jump detection is performed according to formula (2). When flag2=1, it indicates that the power jump detection is successful.

[0144] Step 4: Reference Figure 2 As shown, the RSSI value output by the RSSI calculation module, the step pulse signal output by the gain coarse adjustment detection module, and the convert signal output by the gain fine adjustment detection module are all sent to the LUT table module for gain jump. The gain jump execution mode can be divided into two types: step mode and convert mode.

[0145] Among them, the step method: determine the first gain data according to the input single-shot data, and search the gain level indicated by the first gain data in the constructed lookup table based on the first gain data. The lookup table is shown in Table 1.

[0146] The convert method is as follows: convert the current RSSI value into an index (ie, into second gain data), and search for the gain level indicated by the index in a constructed lookup table. The index table is shown in Table 1.

[0147] Among them, the specific implementation method of the above-mentioned step method is as follows: the initial gain value is set to the maximum gain, that is, the gain gear at this time is 48, and correspondingly, the corresponding initial index value on the lookup table at this time is "0". After the first saturation is detected, a step pulse signal is generated to trigger the first large gain step back, and it will jump to the gain gear with a step of 10 (that is, the value of the "step" corresponding to the initial index value of "0"); after completing the first large gain step back, the second saturation detection is started. If saturation is detected again, a step pulse signal is generated again to trigger the second large gain step back, and jump to the gain gear with a step of 20 (that is, the value of the "step" corresponding to the index value of 10), and so on. The third large gain step back is started later. After the third large gain step back is completed, the coarse gain adjustment is stopped. At this time, fine adjustment can be performed when triggered by the convert method.

[0148] The specific implementation of the above convert method is as follows: after the fine adjustment detection successfully triggers the convert signal, x is calculated according to formula (4), and then the gain gear corresponding to the index value x is jumped.

[0149] In order to properly handle the situation where both the step mode and the convert mode are detected at the same time, the following strategies are adopted:

[0150] a. If the step mode and convert mode are triggered at the same time, the step mode is executed;

[0151] b. If the convert method has been triggered, the step method is prohibited from being triggered;

[0152] c. If neither the step mode nor the convert mode is triggered, both modes can be triggered normally.

[0153] When the preamble of data frame 1 has been detected, the above steps will be repeated for the next data frame 2 to adjust the gain.

[0154] Therefore, the above example of the present application can realize the coordination of the two gain adjustment methods of coarse gain adjustment and fine gain adjustment, and realize the rapid adjustment of gain and avoid repeated adjustment of gain up and down in combination with the LUT table. In actual use, different analog front-end circuits can be adapted by updating the values ​​in the LUT table to achieve higher flexibility; at the same time, the method of "combining periodic detection and power up-jump detection" is used to determine whether the target signal has arrived, so as to make fine adjustment of the gain, avoid frequent adjustment of analog circuit gain, and reduce circuit power consumption.

[0155] The above is a schematic scheme of a control method of a gain control unit of this embodiment. It should be noted that the technical scheme of the control method of the gain control unit and the technical scheme of the above-mentioned gain control unit belong to the same concept, and the details not described in detail in the technical scheme of the control method of the gain control unit can be referred to the description of the technical scheme of the above-mentioned gain control unit.

[0156] like Figure 7 As shown, Figure 7 The structure block diagram of an audio device 300 provided according to an embodiment of the present application is shown. The components of the audio device 300 include but are not limited to a memory 310 and a processor 320. The processor 320 is connected to the memory 310 via a bus 330.

[0157] The audio device 300 further includes a communication module 340, which enables the audio device 300 to communicate with one or more terminal devices 400 over short distances. Figure 7 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 7The electronic device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.

[0158] The terminal device 400 may be any type of stationary or mobile electronic device, including a mobile computer or mobile electronic device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable electronic device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary electronic device such as a desktop computer or a PC. The terminal device 400 may also be a mobile or stationary server.

[0159] The processor 320 is used for computer executable instructions of a gain control unit.

[0160] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the audio device 300 and the technical scheme of the gain control method described above are of the same concept, and the details of the technical scheme of the audio device 300 that are not described in detail can all be referred to the description of the technical scheme of the gain control method described above.

[0161] An embodiment of the present application further provides a computer-readable storage medium, which is a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the gain control method of the gain control unit described above is implemented.

[0162] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and are implemented to be located in one place, or may also be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0163] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0164] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the above implementation mode. Technical personnel familiar with the field can also make various equivalent modifications or substitutions under the shared conditions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.

Claims

1. A gain control method of a gain control unit, characterized in that: The input end of the gain control unit is used to connect to the output end of the digital-to-analog converter, and the input end of the digital-to-analog converter is connected to the analog front-end circuit; the gain control method includes: Determine the RSSI value based on the I / Q signal output by the analog-to-digital converter; Determine first gain data and a control identifier according to the I / Q signal; wherein the first gain data is used to indicate a gain amount for gain control when the analog-to-digital converter is in a saturated state; the control identifier is used to start gain control when a valid preamble code of a data frame is identified, and the gain adjustment amplitude corresponding to the control identifier is less than the gain adjustment amplitude corresponding to the first gain data; A target gain adjustment amount is determined according to the first gain data and second gain data determined based on the control identifier and the RSSI value, wherein the target gain adjustment amount is used to adjust the analog gain of the analog front-end circuit.

2. The gain control method according to claim 1, characterized in that: The control identifier is determined by the following steps: Filtering the I / Q signal to obtain a first filtered signal; Performing preamble code period detection on the first filtered signal to obtain a period identifier, and performing power increment change trend detection on the first filtered signal to obtain a power increment identifier; When the period identifier indicates that a preset period signal condition is satisfied and the power increment identifier satisfies a preset power increment condition, the control identifier is generated.

3. The gain control method according to claim 2, characterized in that: The performing preamble code period detection on the first filtered signal to obtain a period identifier includes: Acquire a plurality of first sampling signals obtained by downsampling the first filtered signal; Delaying each of the first sampling signals by a preset first time length respectively to obtain second sampling signals corresponding to the first sampling signals one by one; wherein the first time length is determined based on the period of the preamble code of the received data frame; Conjugate multiplying the first sampling signal and the corresponding second sampling signal to obtain a plurality of detection signals; Taking the sum of the signal powers of a preset number of the detection signals as the first signal total power; The plurality of detection signals are filtered through a filter, and the second filtered signal obtained by the filtering process is squared to obtain the total power of the second signal; the order of the filter is set to the preset number; The period identifier is obtained according to the first signal total power and the second signal total power.

4. The gain control method according to claim 2, characterized in that: The performing power increment change trend detection on the first filtered signal to obtain a power increment identifier includes: Acquire a plurality of first sampling signals obtained by downsampling the first filtered signal; Performing an approximate modulo operation on the plurality of the first sampling signals to obtain a third signal total power; Smoothing the third signal total power and delaying the third signal total power to obtain a fourth signal total power; The power increment identifier is obtained according to the fourth signal total power and the smoothed third signal total power.

5. The gain control method according to claim 1, characterized in that: The step of determining the RSSI value based on the I / Q signal output by the analog-to-digital converter includes: Performing a single-sample point modulo operation on the I / Q signal output by the analog-to-digital converter to obtain a modulo value; Under the condition that the preset signal stability condition is met, the module value within the preset response time is integrated to obtain the signal power corresponding to each module value; Within the response time, the RSSI value is obtained according to the actual gain adjustment value, the preset control amount and the signal power.

6. The gain control method according to claim 1, characterized in that: The first gain data is determined by the following steps: Get the preset saturation detection threshold; Determine a maximum signal value and a minimum signal value according to an absolute value of an I signal and an absolute value of a Q signal in the I / Q signal; Determine a saturation index according to the maximum value of the signal and the minimum value of the signal; Obtaining a saturation indication according to the saturation index and the saturation threshold; When the saturation indication indicates that the analog-to-digital converter is in a saturation state, the first gain data is determined.

7. The gain control method according to claim 1, characterized in that: The determining a target gain adjustment amount according to the first gain data and second gain data determined based on the control identifier and the RSSI value includes: When a preset first trigger condition is met, determining the target gain adjustment amount according to the first gain data; When a preset second trigger condition is met, second gain data is determined based on the control identifier and the RSSI value, and the target gain adjustment amount is determined according to the second gain data.

8. The gain control method according to claim 7, characterized in that: The first trigger condition includes at least one of the following: only determining that the analog-to-digital converter is in a saturation state; The first gain data and the control identifier are both valid, and there is no gain adjustment record of the target gain adjustment amount determined based on the control identifier in the historical gain adjustment record of the analog front-end circuit for the same data frame; The second trigger condition includes at least one of the following: Only the preamble of the data frame is identified; The first gain data and the control identifier are both valid, and a gain adjustment record of a target gain adjustment amount determined based on the control identifier exists in the historical gain adjustment record of the analog front-end circuit for the same data frame.

9. A gain control unit, characterized in that: The gain control unit comprises: A received signal strength indication RSSI module, wherein the input end of the RSSI module is connected to the output end of the digital-to-analog converter; the RSSI module is used to determine the RSSI value based on the I / Q signal output by the analog-to-digital converter; the input end of the digital-to-analog converter is connected to the analog front-end circuit; A gain detection module, wherein the input end of the gain detection module is connected to the output end of the digital-to-analog converter; the gain detection module is used to determine first gain data and a control identifier according to the I / Q signal; wherein the first gain data is used to indicate the gain amount for gain control when the analog-to-digital converter is in a saturated state; the control identifier is used to start gain control when a valid preamble of a data frame is identified, and the gain adjustment amplitude corresponding to the control identifier is less than the gain adjustment amplitude corresponding to the first gain data; A gain adjustment module, the gain adjustment module is used to determine a target gain adjustment amount according to the first gain data and second gain data determined based on the control identifier and the RSSI value, wherein the target gain adjustment amount is used to adjust the analog gain of the analog front-end circuit.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the steps of a gain control method according to any one of claims 1 to 9.