Method and device for optimizing classical Bluetooth adaptive frequency hopping
By calculating the signal-to-noise ratio in real time by statistically analyzing signal and noise power during Bluetooth transmission and dynamically adjusting the adaptive frequency hopping mapping table, the real-time and efficiency issues in Bluetooth transmission are resolved, ensuring that the channel quality meets the requirements of different logical transmission methods and improving transmission efficiency and real-time performance.
Patent Information
- Application Number
- CN202511174308.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-12-05
AI Technical Summary
In existing technologies, the generation of adaptive frequency hopping mapping tables during Bluetooth transmission has poor real-time performance and affects transmission efficiency. It also fails to effectively distinguish the channel quality requirements of different logical transmission methods, resulting in high-real-time services using low-quality channels while low-priority services occupy high-quality channel resources.
During odd-numbered time slots, when the Bluetooth master device receives response data packets from the slave device, it counts the average power of the received signal and the average power of the background noise, calculates the real-time signal-to-noise ratio, and dynamically adjusts the adaptive frequency hopping mapping table according to the signal-to-noise ratio threshold, marks the channel availability, and ensures that the channel quality meets the transmission requirements.
It enables real-time evaluation of channel quality during signal transmission without the need for additional scanning to interrupt transmission, dynamically adjusts channel usage, improves transmission efficiency and real-time performance, and ensures that appropriate channels are used for different logical transmission methods.
Smart Images

Figure CN121077504A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of Bluetooth transmission technology, and in particular to a method and device for optimizing classic Bluetooth adaptive frequency hopping. BACKGROUND
[0002] Classic Bluetooth (BR / EDR) uses adaptive frequency hopping (AFH) technology to improve anti-interference capability, and the core is to dynamically exclude poor quality channels by generating an adaptive frequency hopping mapping table (AFH_map). The prior art mainly generates AFH_map in two ways:
[0003] Method one: scan the received signal strength indication (RSSI) of 79 channels, and select low interference channels;
[0004] Method two: count the data packet transmission success rate of each channel, and select high success rate channels.
[0005] However, the above methods all rely on additional scanning or statistical processes independent of normal communication. RSSI scanning requires switching channels one by one and waiting for the radio frequency to stabilize, which takes milliseconds, and cannot reflect channel state changes (such as sudden interference) in real time; transmission success rate statistics require accumulation of a large number of data packets, with significant delay, making it difficult to adapt to dynamic environments. The channel quality requirements of different logical transmission modes of Bluetooth (such as SCO voice and ACL data) are not distinguished, resulting in high real-time services (such as SCO) using low-quality channels, and low-priority services (such as ACL) occupying high-quality channel resources.
[0006] Therefore, the present application needs to provide a technology that can solve the technical problem of poor real-time performance and affecting transmission efficiency when generating an adaptive frequency hopping mapping table in the Bluetooth transmission process in the prior art. SUMMARY
[0007] The embodiments of the present application provide a method and device for optimizing classic Bluetooth adaptive frequency hopping, which can solve the technical problem of poor real-time performance and affecting transmission efficiency when generating an adaptive frequency hopping mapping table in the Bluetooth transmission process in the prior art. The technical solution is as follows:
[0008] In a first aspect, the embodiments of the present application provide a method for optimizing classic Bluetooth adaptive frequency hopping, comprising:
[0009] In odd time slots, the Bluetooth master device receives the response data packet of the slave device, and at the same time, the average received signal power is counted; and the average background noise power is counted in the idle time from the end of receiving the response data packet to the end of the odd time slot;
[0010] The real-time signal-to-noise ratio is determined according to the ratio of the average received signal power and the average background noise power;
[0011] determining whether the real-time signal-to-noise ratio is greater than a signal-to-noise ratio threshold value;
[0012] if yes, keeping the current channel as available in the adaptive frequency hopping mapping table;
[0013] if no, updating the adaptive frequency hopping mapping table to mark the current channel as unavailable;
[0014] synchronizing the updated adaptive frequency hopping mapping table to the slave device, so that the master and slave devices switch to the updated adaptive frequency hopping mapping table for communication at a preset time.
[0015] In some embodiments of the present application, the signal-to-noise ratio threshold value includes a synchronous connection link threshold value, an enhanced synchronous connection link threshold value, and an asynchronous connectionless link threshold value; and further includes:
[0016] based on the synchronous connection link threshold value being greater than the enhanced synchronous connection link threshold value, and the enhanced synchronous connection link threshold value being greater than the asynchronous connectionless link threshold value, dynamically adjusting the signal-to-noise ratio threshold value.
[0017] In some embodiments of the present application, further includes:
[0018] if the Bluetooth master device does not receive a response data packet from the slave device in an odd time slot, determining that the current channel quality is poor;
[0019] and updating the adaptive frequency hopping mapping table to mark the current channel as unavailable.
[0020] In some embodiments of the present application, when the current channel is marked as unavailable, further includes:
[0021] deleting the current channel from the adaptive frequency hopping mapping table, and synchronously starting a timer of the current channel to start incrementing the timer from the time when the current channel is deleted;
[0022] determining whether the timer is greater than a recovery time threshold value;
[0023] if yes, adding the current channel to the adaptive frequency hopping mapping table, and stopping the timer and resetting the timer.
[0024] In some embodiments of the present application, each channel in the adaptive frequency hopping mapping table corresponds to an independent recovery time threshold value; and the recovery time threshold value is represented by the following formula:
[0025] T_recover = 2^(N-1) * T_base
[0026] Wherein, T_recover represents a recovery time threshold, N is a number of consecutive transmission failures of a current channel, and T_base is a basic recovery time of the recovery time threshold.
[0027] In some embodiments of the application, the updating the adaptive frequency hopping mapping table and marking the current channel as an unusable state comprises:
[0028] At the end of the odd time slot, the adaptive frequency hopping mapping table is assigned to a new adaptive frequency hopping mapping table.
[0029] In the new adaptive frequency hopping mapping table, the assignment of the current channel is modified to 0.
[0030] In some embodiments of the application, the number of valid channels in the adaptive frequency hopping mapping table is greater than a preset number of channels.
[0031] In a second aspect, the application further provides an optimization device for adaptive frequency hopping of classic Bluetooth, comprising:
[0032] The statistical module is configured to, at the odd time slot, simultaneously with the Bluetooth master device receiving a response data packet from the slave device, statistically calculate an average received signal power, and statistically calculate an average background noise power in an idle time from the end of receiving the response data packet to the end of the odd time slot.
[0033] The calculation module is configured to determine a real-time signal-to-noise ratio according to a ratio of the average received signal power and the average background noise power.
[0034] The judgment module is configured to judge whether the real-time signal-to-noise ratio is greater than a signal-to-noise ratio threshold.
[0035] The first updating module is configured to, if the real-time signal-to-noise ratio is greater than the signal-to-noise ratio threshold, keep the current channel as an available state in the adaptive frequency hopping mapping table.
[0036] The second updating module is configured to, if the real-time signal-to-noise ratio is less than the signal-to-noise ratio threshold, update the adaptive frequency hopping mapping table and mark the current channel as an unusable state.
[0037] The synchronization module is configured to synchronize the updated adaptive frequency hopping mapping table to the slave device, so that the master-slave devices switch to the updated adaptive frequency hopping mapping table for communication at a preset time.
[0038] In a third aspect, the application further provides an electronic device, comprising a processor and a memory.
[0039] The memory has stored thereon a computer readable program which can be executed by the processor.
[0040] The processor, when executing the computer readable program, implements the steps in the optimization method for adaptive frequency hopping of classic Bluetooth.
[0041] In a fourth aspect, the present application provides a computer readable storage medium storing one or more programs executable by one or more processors to implement the steps of the method for optimizing classic Bluetooth adaptive frequency hopping as described above.
[0042] The technical scheme provided by some embodiments of the present application has at least the following beneficial effects: in an odd time slot, the master device receives a response data packet from the slave device and simultaneously counts the average received signal power; and in the idle time after the end of the response data packet to the end of the odd time slot, the average background noise power is counted; thus, the purpose of simultaneously performing channel quality evaluation in the process of signal transmission is achieved, without additional scanning interrupting the transmission, and real-time channel quality evaluation and signal transmission are achieved, and then the real-time signal-to-noise ratio is determined according to the ratio of the average received signal power and the average background noise power; thus, the signal-to-noise ratio is used as the criterion for channel quality, and it is determined whether the real-time signal-to-noise ratio is greater than the signal-to-noise ratio threshold; if yes, the current channel is marked as available in the adaptive frequency hopping mapping table; if no, the adaptive frequency hopping mapping table is updated, and the current channel is marked as unavailable; thus, based on the size relationship between the real-time signal-to-noise ratio and the signal-to-noise ratio threshold, the quality of each channel is determined, and the high-quality channel meeting the Bluetooth transmission requirement is screened out, and the updated adaptive frequency hopping mapping table is synchronized to the slave device, so that the master and slave devices switch to the updated adaptive frequency hopping mapping table for communication at a preset time. BRIEF DESCRIPTION OF DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0044] Figure 1 The system architecture diagram of an embodiment of the method for optimizing classic Bluetooth adaptive frequency hopping provided by the present application;
[0045] Figure 2 The method flowchart of an embodiment of the method for optimizing classic Bluetooth adaptive frequency hopping provided by the present application;
[0046] Figure 3 In the method for optimizing classic Bluetooth adaptive frequency hopping provided by the present application, the working schematic diagram of the master device;
[0047] Figure 4 In the method for optimizing classic Bluetooth adaptive frequency hopping provided by the present application, the working schematic diagram of the slave device;
[0048] Figure 5 is a flow chart of another embodiment of the method for optimizing classic Bluetooth adaptive frequency hopping provided by the present application.
[0049] Figure 6 is a schematic diagram of an embodiment of the device for optimizing classic Bluetooth adaptive frequency hopping provided by the present application.
[0050] Figure 7 is a schematic diagram of the running environment of an embodiment of the electronic device provided by the present application. DETAILED DESCRIPTION
[0051] To make the purposes, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0052] It should be noted that the method for optimizing classic Bluetooth adaptive frequency hopping provided by the present application is generally executed by a terminal device, and accordingly, the device for optimizing classic Bluetooth adaptive frequency hopping is generally arranged in the terminal device.
[0053] Figure 1 An exemplary system architecture to which the method for optimizing classic Bluetooth adaptive frequency hopping or the device for optimizing classic Bluetooth adaptive frequency hopping of the present application can be applied is shown.
[0054] As shown in Figure 1 , the system architecture can include a terminal device 101 and a server 102. The terminal device 101 and the server 102 can communicate with each other through a network, which is a medium for providing a communication link between the above-mentioned units. The network can include various types of wired communication links or wireless communication links, for example, the wired communication links include optical fibers, twisted pairs or coaxial cables, etc., and the wireless communication links include Bluetooth communication links, wireless fidelity (Wi-Fi) communication links or microwave communication links, etc.
[0055] It should be noted that the terminal device 101 and the server 102 can be hardware or software. When the terminal device 101 and the server 102 are hardware, they can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When the terminal device 101 and the server 102 are software, they can be implemented as multiple software or software modules (for example, to provide distributed services), or as a single software or software module, which is not specifically limited here.
[0056] Various communication client applications can be installed on the terminal device of the present application, for example, video recording applications, video playing applications, voice interaction applications, search applications, instant messaging tools, mailbox clients, social platform software, etc.
[0057] The terminal device can be hardware or software. When the terminal device is hardware, it can be various terminal devices with a display screen, including but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, and the like. When the terminal device is software, it can be installed in the terminal devices listed above. It can be implemented as multiple software or software modules (for example, to provide distributed services) or as a single software or software module, which is not specifically limited here.
[0058] When the terminal device is hardware, a display device and a camera can also be installed thereon. The display device can be various devices capable of achieving a display function, and the camera is used to collect a video stream. For example, the display device can be a cathode ray tube display (CR), a light-emitting diode display (LED), an electronic ink screen, a liquid crystal display (LCD), a plasma display panel (PDP), and the like. A user can use the display device on the terminal device to view displayed text, pictures, videos, and the like.
[0059] It should be understood that Figure 1 The number of terminal devices, networks, and servers in the above is only illustrative. According to the implementation needs, there can be any number of terminal devices, networks, and servers.
[0060] Before the present application is described, related terms and technical principles are explained:
[0061] Bluetooth clock: 28-bit counter, incremented by 1 every 312.5us.
[0062] SLOT: time slot, 1 time slot is 625us, i.e., 2 Bluetooth clock periods, and the time slot number is the Bluetooth clock count right shifted by 1 bit (divided by 2 and rounded).
[0063] UAP / LAP: Upper Address Part / Lower Address Part; Bluetooth address, UAP is 8 bits, and LAP is 24 bits.
[0064] Bluetooth master device: central device, device initiating paging in a piconet, such as a mobile phone.
[0065] Bluetooth slave device: peripheral device, paging scanning device in a piconet, such as a Bluetooth headset.
[0066] The master device sends data packets at the start of even time slots and receives response data packets at the start of odd time slots. The slave device receives data packets at the start of even time slots and sends response data packets at the start of odd time slots.
[0067] Piconet: A network composed of a master device and slave devices.
[0068] Channel (frequency band): There are 79 channels in classic Bluetooth, from 2402M to 2480M, with a bandwidth of 1M for each channel, and one channel is used for each transmission.
[0069] Basic frequency hopping: In order to reduce interference between devices, improve stability and security, classic Bluetooth uses a fixed frequency hopping algorithm for communication. Specifically, after the slave device obtains the FHS (Frequency Hop Synchronization) data packet broadcast by the master device, it obtains the Bluetooth clock and Bluetooth address (UAP / LAP) information of the master device. After synchronization between the master and the slave, the same classic Bluetooth frequency hopping algorithm is used to obtain the same frequency hopping sequence, and the master and the slave communicate according to the frequency hopping sequence.
[0070] AFH_map: Adaptive frequency hopping map, 79 bits, each bit represents whether the corresponding channel is available. For example, the first bit is 1, indicating that the 2402M channel is available, and the 79th bit is 0, indicating that the 2480M channel is not available. The AFH_map is generated by the master device based on its own detection and feedback from the slave device. The initial value of the AFH_map is all 1, that is, all channels are available by default before the device starts adaptive detection (at this time, it is equivalent to the basic frequency hopping of Bluetooth without adaptive table).
[0071] BR / EDR frequency selector: adaptive frequency hopping selection module, which implements the adaptive frequency hopping algorithm. According to the high 27 bits of the Bluetooth clock, the low 4 bits of the UAP, the 24 bits of the LAP, and the 79 bits of the AFH_map, the working frequency for the next transmission is obtained. The channel number selected by Bluetooth frequency hopping is a pseudo-random sequence.
[0072] BR / EDR transceiver: responsible for basic transmission management of classic Bluetooth, including LC (link control), PHY (physical layer), and RF (radio frequency).
[0073] The following will be described in detail with reference to the accompanying drawings. Figure 2 The optimization method of the adaptive frequency hopping of classic Bluetooth provided by the embodiments of the present application will be described in detail. The adaptive frequency hopping optimization device of classic Bluetooth in the embodiments of the present application can be a terminal device as shown in the drawings. Figure 1 The adaptive frequency hopping optimization device of classic Bluetooth in the embodiments of the present application can be a terminal device as shown in the drawings.
[0074] Please refer to Figure 2A flowchart of an optimization method of classic Bluetooth adaptive frequency hopping is provided for the embodiments of the present application. The present application describes timing assumptions that the Bluetooth master and slave devices are already in the connected state. As shown in Figure 2 the method of the embodiments of the present application can include the following steps:
[0075] S201, in the odd time slot, the Bluetooth master device receives the response data packet of the slave device while counting the average received signal power, and counts the average background noise power in the idle time before the end of the odd time slot after receiving the response data packet;
[0076] It should be noted that in the conventional scheme, the Bluetooth master device has no action in the idle time slot after receiving the response data packet in the odd time slot. In the present embodiment, as shown in the black part in Figure 3 and 4 , the average background noise power is counted in the idle time before the end of the odd time slot, and the signal power is measured in real time, without additional scanning and interruption of the signal transmission of the Bluetooth connection, thereby improving the efficiency of signal transmission.
[0077] S202, determining the real-time signal-to-noise ratio according to the ratio of the average received signal power and the average background noise power;
[0078] It should be noted that by calculating the real-time signal-to-noise ratio, the signal and noise are considered at the same time, the channel quality is truly reflected, and the stability of the transmission of the channel is represented. The greater the value of the real-time signal-to-noise ratio, the cleaner the signal, and the better the channel quality.
[0079] S203, judging whether the real-time signal-to-noise ratio is greater than a signal-to-noise ratio threshold value;
[0080] It should be noted that by setting the signal-to-noise ratio threshold value as the judge of the channel quality, and comparing the size of the real-time signal-to-noise ratio and the signal-to-noise ratio threshold value, it is determined whether the current channel quality meets the requirements of the Bluetooth connection transmission.
[0081] In one specific embodiment, the signal-to-noise ratio threshold value includes a synchronous connection link threshold value, an enhanced synchronous connection link threshold value and an asynchronous connectionless link threshold value; further comprising:
[0082] Based on the synchronous connection link threshold value being greater than the enhanced synchronous connection link threshold value, and the enhanced synchronous connection link threshold value being greater than the asynchronous connectionless link threshold value, the signal-to-noise ratio threshold value is dynamically adjusted.
[0083] Specifically, different signal-to-noise ratio thresholds are set according to different service types and Bluetooth logical transmission modes. Different signal-to-noise ratio thresholds (SNR_th) are set for different logical transmission modes (SCO / eSCO / ACL). For example, for SCO transmission with high real-time performance and no retransmission, a high-quality channel is selected to ensure the reliability of transmission, and a large threshold is set, for example, SNR_th = 85 dB. For ACL transmission with low real-time performance and supporting multiple retransmissions, a smaller noise threshold is set to avoid frequency conflicts with a larger number of channels, for example, SNR_th = 75 dB. For eSCO supporting one retransmission, an intermediate value is set, for example, SNR_th = 80 dB.
[0084] Further, the SNR_th can be adjusted according to the number of available channels. For example, when there are more available channels, the SNR_th can be appropriately increased, and vice versa. Different SNR_th are set for different Bluetooth logical transmission modes to adjust the number of channels. A higher SNR_th for SCO / eSCO can improve the reliability of real-time transmission, and a lower SNR_th for ACL can reduce the frequency conflict of non-real-time transmission. If the logical transmission mode is not fixed, different SNR_th can be used for each transmission mode, and an AFH_map_new is maintained for each transmission mode. The master device selects the AFH_map_new according to the current logical transmission mode and synchronizes it to the piconet.
[0085] It should be noted that when the signal-to-noise ratio threshold is reduced or increased, the synchronous connection link threshold, the enhanced synchronous connection link threshold, and the asynchronous connectionless link threshold need to be increased or decreased while meeting the conditions that the synchronous connection link threshold is greater than the enhanced synchronous connection link threshold, and the enhanced synchronous connection link threshold is greater than the asynchronous connectionless link threshold.
[0086] S204, if yes, the current channel is kept in the available state in the adaptive frequency hopping map;
[0087] It should be noted that when the current channel quality meets the demand of Bluetooth transmission, the original AFH_map is assigned to the new AFH_map_new at the end of the RX time slot.
[0088] It should be noted that the adaptive frequency hopping map is a dynamic marking of the availability of 79 Bluetooth channels, which is a binary table that avoids interference channels. In the conventional method, it is a fixed channel mapping table. In this application, the signal-to-noise ratio is calculated in the odd time slot blanking interval, the channel quality is analyzed, and the adaptive frequency hopping map is dynamically adjusted.
[0089] S205, if no, update the adaptive frequency hopping map and mark the current channel as unavailable;
[0090] It should be noted that at the end of the odd time slot, the adaptive frequency hopping mapping table is assigned to a new adaptive frequency hopping mapping table.
[0091] In the new adaptive frequency hopping mapping table, the assignment of the current channel is modified to 0.
[0092] S206, synchronizing the updated adaptive frequency hopping mapping table to the slave device, so that the master and slave devices switch to the updated adaptive frequency hopping mapping table for communication at a preset time.
[0093] It should be noted that the master device selects AFH_map_new according to the current logical transmission mode and synchronizes it to the piconet. This method hops according to the original classic Bluetooth frequency hopping algorithm, does not require additional frequency point switching, does not change the original timing, and only needs to maintain background energy detection (RX_EN=1) after the end of Bluetooth packet reception until the end of the time slot. And AFH_map_new cannot be updated to AFH_map immediately, but after successful transmission to the Bluetooth slave device, both of them switch to AFH_map_new at the same time according to the agreed time, so as to ensure that the master device and the slave device change according to the same frequency hopping sequence. Similarly, the Bluetooth slave device can also use this method, at this time, the Bluetooth slave device generates AFH_map_new and feeds back to the Bluetooth master device, and the Bluetooth master device generates the final AFH_map and synchronizes it to the piconet for use. Whether AFH_map is generated by the master device or fed back by the slave device, or both, the master device ultimately calculates and generates it and sends it to all devices in the piconet, and using a unified adaptive frequency hopping mapping table can avoid frequency conflicts between different slave devices.
[0094] In this embodiment, in the odd time slot, the Bluetooth master device receives the response data packet from the slave device while simultaneously counting the average received signal power; and counts the average background noise power during the idle time from the end of receiving the response data packet to the end of the odd time slot; thereby achieving the purpose of simultaneously performing channel quality evaluation while maintaining signal transmission, without additional scanning interrupting transmission, and being able to perform real-time channel quality evaluation and signal transmission. Subsequently, the real-time signal-to-noise ratio is determined according to the ratio of the average received signal power and the average background noise power; thereby using the signal-to-noise ratio as the judge of channel quality, determining whether the real-time signal-to-noise ratio is greater than the signal-to-noise ratio threshold; if yes, keeping the current channel as available in the adaptive frequency hopping mapping table; if no, updating the adaptive frequency hopping mapping table and marking the current channel as unavailable; thereby determining the quality of each channel based on the size relationship between the real-time signal-to-noise ratio and the signal-to-noise ratio threshold, thereby screening out high-quality channels that meet the Bluetooth transmission requirements, and synchronizing the updated adaptive frequency hopping mapping table to the slave device, so that the master and slave devices switch to the updated adaptive frequency hopping mapping table for communication at a preset time.
[0095] In some embodiments of the present application, please refer to Figure 5 , further comprising:
[0096] S501, deleting the current channel from the adaptive frequency hopping mapping table, and synchronously starting the timer of the current channel to make the timer of the current channel start counting from the time when the current channel is deleted;
[0097] S502, judging whether the counting of the timer is greater than the recovery time threshold;
[0098] S503, if yes, adding the current channel into the adaptive frequency hopping mapping table, and closing the timer and clearing the counting of the timer.
[0099] In the present embodiment, the deleted channel should have a recovery mechanism, because a certain strong interference channel can be recovered after a period of time, and should be re-added into the adaptive table to try again, while the available channels in the AFH table can be avoided from becoming less and less. Thus, the recovery time threshold is set as the threshold of channel recovery.
[0100] It should be noted that the interference of a certain channel can be temporary or persistent, so the probability of the deleted channel being recovered cannot be consistent, and each channel has its own independent T_recover. The recovery time threshold is represented by the following formula:
[0101] T_recover=2^(N-1)*T_base
[0102] Wherein, T_recover represents a recovery time threshold, N is the number of consecutive transmission failures of the current channel, and T_base is a basic recovery time of the recovery time threshold. The first failure is T_recover=T_base, two consecutive failures are T_recover=2*T_base, three consecutive failures are T_recover=4*T_base, and so on until a self-defined upper limit is reached. If a transmission is successful, N=0, and the subsequent channel is deleted, and T_recover is restarted from T_base. T_base can be set according to the number of available channels, for example, if the number of available channels is large (>60) for a long time, T_base can be appropriately increased to ensure the reliability of the channel. In a specific embodiment, a time greater than the time that can be changed in the air interface is set, and if the channel is good, there are many available channels in the AFH_map table, and it is unnecessary to recover so quickly, and the threshold can be set to be long. A simple formula can be defined, T_recover=N*Bluetooth transmission period. Wherein N is the average number of available channels in the last three master-slave synchronization updates of the AFH_map table. For example, N=40, and T_recover=40*1.25ms=50ms. After all the available channels are used, the channel is recovered, which can ensure the reliability of the channel and will not make the available channels too few.
[0103] In some embodiments of the application, the method further comprises:
[0104] In an odd time slot, if the Bluetooth master device does not receive the response data packet of the slave device, it is determined that the quality of the current channel is poor;
[0105] And updating the adaptive frequency hopping mapping table, marking the current channel as unavailable.
[0106] In this embodiment, the master device does not receive the response data packet of the slave device, which can be caused by reception interference or the slave device not receiving the data packet sent by the master device and failing to respond. Both of these two cases indicate that the quality of the channel is poor, so the channel is deleted uniformly.
[0107] In some embodiments of the application, the number of valid channels in the adaptive frequency hopping mapping table is greater than a preset channel number.
[0108] In this embodiment, the classic Bluetooth protocol specifies that the minimum number of available channels when frequency hopping is 20, otherwise the randomness of frequency hopping is too weak, and different Bluetooth devices are prone to frequency conflicts, so it is necessary to ensure that there are at least 20 available channels after the channel is deleted. Therefore, the preset channel number is 20.
[0109] In one specific embodiment, firstly, it is judged whether the number of valid channels in the AFH_map_new is greater than or equal to 20. If yes, the AFH_map_new remains unchanged; if not (the number of valid channels in the table is 19), the channel in the channel recovery module closest to the T_recover time is marked as 1 (the air interface condition of this channel is most likely to have changed, and it is recovered in advance).
[0110] The application has the following beneficial effects: in an odd time slot, the master device of the Bluetooth receives a response data packet from the slave device, and at the same time, the average power of the received signal is counted; and the average power of the background noise is counted in the idle time before the end of the odd time slot; thus, the purpose of evaluating the channel quality while maintaining the signal transmission is achieved, the transmission is not interrupted by additional scanning, and the channel quality evaluation and signal transmission can be performed in real time, and then, the real-time signal-to-noise ratio is determined according to the ratio of the average power of the received signal and the average power of the background noise; thus, the real-time signal-to-noise ratio is judged according to the signal-to-noise ratio threshold value; if yes, the current channel is kept as available in the adaptive frequency hopping map table; if not, the adaptive frequency hopping map table is updated, and the current channel is marked as unavailable; thus, the quality of each channel is determined based on the size relationship between the real-time signal-to-noise ratio and the signal-to-noise ratio threshold value, the high-quality channel meeting the Bluetooth transmission requirement is screened out, and the updated adaptive frequency hopping map table is synchronized to the slave device, so that the master and slave devices switch to the updated adaptive frequency hopping map table for communication according to the preset time.
[0111] The following is an apparatus embodiment of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the apparatus embodiments of the present application, please refer to the method embodiments of the present application.
[0112] Please refer to Figure 6 which shows a structure schematic diagram of an optimized classic Bluetooth adaptive frequency hopping device provided by an example embodiment of the present application, hereinafter referred to as device 6. The device 6 can be realized by software, hardware or a combination of both to become all or part of a terminal device. The device 6 comprises:
[0113] A counting module, configured to count the average power of the received signal while the master device of the Bluetooth receives a response data packet from the slave device in an odd time slot; and count the average power of the background noise in the idle time before the end of the odd time slot after the end of the reception of the response data packet;
[0114] A calculating module, configured to determine the real-time signal-to-noise ratio according to the ratio of the average power of the received signal and the average power of the background noise;
[0115] A judging module, configured to judge whether the real-time signal-to-noise ratio is greater than the signal-to-noise ratio threshold value;
[0116] The first updating module is configured to keep the current channel as available in the adaptive frequency hopping mapping table if the real-time signal-to-noise ratio is greater than the signal-to-noise ratio threshold.
[0117] The second updating module is configured to update the adaptive frequency hopping mapping table to mark the current channel as unavailable if the real-time signal-to-noise ratio is less than the signal-to-noise ratio threshold.
[0118] The synchronization module is configured to synchronize the updated adaptive frequency hopping mapping table to the slave device, so that the master and slave devices switch to the updated adaptive frequency hopping mapping table for communication at a preset time.
[0119] The embodiment of the application further provides a computer storage medium, which can store a plurality of instructions, the instructions being suitable for being loaded and executed by a processor to perform the method steps of the embodiment as shown in the above Figure 2 The specific implementation process can refer to the specific description of the embodiment as shown in the above Figure 2 The specific implementation process can refer to the specific description of the embodiment as shown in the above
[0120] The application further provides a computer program product, which stores at least one instruction, the at least one instruction being loaded and executed by the processor to implement the optimization method of the classic Bluetooth adaptive frequency hopping as described in each of the above embodiments.
[0121] Please refer to Figure 7 , which provides a structural schematic diagram of a terminal device. As shown in the above Figure 7 The terminal device 700 can include at least one processor 701, at least one network interface 704, a user interface 703, a memory 705, and at least one communication bus 702.
[0122] The communication bus 702 is configured to realize the connection and communication among the components.
[0123] The user interface 703 can include a display screen (Display), a camera (Camera), and optionally a standard wired interface and a wireless interface.
[0124] The network interface 704 can optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0125] The processor 701 can include one or more processing cores. The processor 701 connects various parts in the terminal device 700 through various interfaces and lines, and performs various functions and processes data of the terminal device 700 by running or executing instructions, programs, code sets or instruction sets stored in the memory 705, and calling data stored in the memory 705. Optionally, the processor 701 can be implemented in at least one of a hardware form of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 701 can integrate a combination of one or more of a central processing unit (CPU), a graphics processor (GPU), and a modem. Among them, the CPU is mainly used to process operating systems, user interfaces, and application programs; the GPU is used to render and draw the content to be displayed on the display screen; and the modem is used to process wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the processor 701, but can be realized by a separate chip.
[0126] The memory 705 can include a random access memory (RAM) and can also include a read-only memory (ROM). Optionally, the memory 705 includes a non-transitory computer-readable storage medium. The memory 705 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 705 can include a program storage area and a data storage area, wherein the program storage area can store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area can store data involved in the above-mentioned various method embodiments, etc. The memory 705 can also be at least one storage device located away from the above-mentioned processor 701. As shown in the figure, the memory 705 as a computer storage medium can include an operating system, a network communication module, a user interface module, and an application program. Figure 7 As shown in the figure, the memory 705 as a computer storage medium can include an operating system, a network communication module, a user interface module, and an application program.
[0127] In Figure 7In the terminal device 700 shown, the user interface 703 is mainly used to provide an interface for the user to input, and obtain data input by the user; and the processor 701 can be used to call an application stored in the memory 705, and specifically execute the method as shown in Figure 2 The specific process can refer to the method shown in Figure 2 The specific process can refer to the method shown in
[0128] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware. The program can be stored in a computer readable storage medium, and when the program is executed, the program can include the processes of the above-mentioned embodiments. The storage medium can be a magnetic disc, an optical disc, a read-only memory, a random access memory, etc.
[0129] The above only describes the preferred embodiments of the present application, and cannot limit the scope of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope of the present application.
Claims
1. A method for optimizing classic Bluetooth adaptive frequency hopping, characterized in that, The method comprises the following steps: In the odd time slot, the master device receives the response data packet from the slave device, and simultaneously, the average power of the received signal is counted; And in the idle time from the end of receiving the response data packet to the end of the odd time slot, the average power of the background noise is counted; The real-time signal-to-noise ratio is determined according to the ratio of the average power of the received signal and the average power of the background noise; It is judged whether the real-time signal-to-noise ratio is greater than the signal-to-noise ratio threshold value; If yes, the current channel is kept as available in the adaptive frequency hopping mapping table; If no, the adaptive frequency hopping mapping table is updated, and the current channel is marked as unavailable; The updated adaptive frequency hopping mapping table is synchronized to the slave device, so that the master and slave devices switch to the updated adaptive frequency hopping mapping table for communication at a preset time.
2. The method of claim 1, wherein, The signal-to-noise ratio threshold value comprises a synchronous connection link threshold value, an enhanced synchronous connection link threshold value and an asynchronous connectionless link threshold value; and further comprises: Based on the synchronous connection link threshold value being greater than the enhanced synchronous connection link threshold value, and the enhanced synchronous connection link threshold value being greater than the asynchronous connectionless link threshold value, the signal-to-noise ratio threshold value is dynamically adjusted.
3. The method of claim 1, wherein, Further comprising: In the odd time slot, if the master device does not receive the response data packet from the slave device, it is determined that the current channel quality is poor; And the adaptive frequency hopping mapping table is updated, and the current channel is marked as unavailable.
4. The method of claim 1, wherein, While marking the current channel as unavailable, further comprising: The current channel is deleted from the adaptive frequency hopping mapping table, and a timer of the current channel is simultaneously started, so that the timer of the current channel starts counting from the time when the current channel is deleted; It is judged whether the counting of the timer is greater than the recovery time threshold value; If yes, the current channel is added to the adaptive frequency hopping mapping table, and the timer is closed and the counting of the timer is cleared.
5. The method of claim 4, wherein, Each channel in the adaptive frequency hopping mapping table corresponds to an independent recovery time threshold value; and the recovery time threshold value is represented by the following formula: T_recover=2^(N-1)*T_base Wherein, T_recover represents the recovery time threshold value, N represents the number of consecutive transmission failures of the current channel, and T_base represents the basic recovery time of the recovery time threshold value.
6. The method of claim 1, wherein, The adaptive frequency hopping mapping table is updated, and the current channel is marked as unavailable, comprising: At the end of the odd time slot, the adaptive frequency hopping mapping table is assigned to a new adaptive frequency hopping mapping table; In the new adaptive frequency hopping mapping table, the assignment of the current channel is modified to 0.
7. The method of claim 1, wherein, The number of valid channels in the adaptive frequency hopping mapping table is greater than a preset channel number.
8. An optimization device for classic Bluetooth adaptive frequency hopping, characterized in that, The method comprises the following steps: The statistical module is used to count the average power of the received signal while the master device receives the response data packet from the slave device in the odd time slot; And count the average power of the background noise in the idle time from the end of receiving the response data packet to the end of the odd time slot; The calculation module is used to determine the real-time signal-to-noise ratio according to the ratio of the average power of the received signal and the average power of the background noise; The judgment module is used to judge whether the real-time signal-to-noise ratio is greater than the signal-to-noise ratio threshold value; The first update module is used to keep the current channel as available in the adaptive frequency hopping mapping table if the real-time signal-to-noise ratio is greater than the signal-to-noise ratio threshold value; The second updating module is configured to update the adaptive frequency hopping mapping table and mark the current channel as unavailable if the real-time signal-to-noise ratio is less than the signal-to-noise ratio threshold. The synchronization module is configured to synchronize the updated adaptive frequency hopping mapping table to the slave device, so that the master and slave devices switch to the updated adaptive frequency hopping mapping table for communication at a preset time.
9. An electronic device, comprising: The method comprises: a processor and a memory; the memory stores a computer readable program which can be executed by the processor; the processor executes the computer readable program to implement the steps in the optimization method of the classic Bluetooth adaptive frequency hopping according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores one or more programs which can be executed by one or more processors to implement the steps in the optimization method of the classic Bluetooth adaptive frequency hopping according to any one of claims 1-7.
Citation Information
Patent Citations
Heterogeneous protocol cooperation method based on WiFi and BLE composite chip
CN111954223A
Channel selection method and device based on Bluetooth adaptive frequency hopping
CN115119320A
Bluetooth in-band stray test method
CN117394928A
Self-adaptive communication method and device for low-power-consumption Bluetooth, equipment, storage medium and program product
CN120151922A