Verification test platform and verification test method for Bluetooth TWS (time and wavelength service) function
Technical Field
The invention belongs to the technical field of Bluetooth, and particularly relates to a verification test platform and a verification test method for a Bluetooth TWS (time varying signal) function, which are suitable for verification test of a Bluetooth TWS hardware function and a TWS protocol function.
Background
Bluetooth headset, namely the Bluetooth technology is applied to the headset for between earphone and the sound source equipment (usually possess bluetooth wireless communication function's such as cell-phone equipment), need not physical cable connection, can realize audio data's transmission.
The stereo Bluetooth earphone such as neck hanging type and head wearing type still has physical connection between the left earphone and the right earphone, and the flexibility and the convenience of the Bluetooth earphone are limited to a certain extent. The advent of TWS technology enabled Bluetooth handsets to implement true wireless stereo.
In order to realize the application of the TWS technology, chip manufacturers often need to carry out certain digital design modification on the Bluetooth baseband on the basis of the traditional Bluetooth chip, and meanwhile, corresponding algorithms are also needed to be added on software to realize the TWS function.
At present, the verification test of the Bluetooth TWS function is mainly performed by a manual test method. The method comprises the steps of simulating a target RTL code by a digital designer, verifying the feasibility of a designed module, running a designed TWS application program on Bluetooth equipment by a software designer, designating one platform as a main earphone, designating the other platform as an auxiliary earphone, setting a Bluetooth address of the other platform, and needing a mobile phone. When testing, the connection between the main earphone and the auxiliary earphone is established, and then the connection between the main earphone and the mobile phone is established, so that a TWS connection topology is formed, a tester needs to perform specific operation on the mobile phone, and whether the TWS application program runs normally is judged according to log printing of a hardware platform. Software and hardware designers may also be required to combine to test and analyze the problems existing in TWS software and hardware designs in cooperation with tools such as Bluetooth protocol analyzers, bluetooth comprehensive testers and the like. The whole test process is complex, the efficiency is low, the cost is high, the conventional manual test is not completely controllable, the coverage range of the test content is small, and the working condition of the chip digital logic design in the real environment can not be further verified.
Disclosure of Invention
The first object of the invention is to provide a verification test platform for Bluetooth TWS function.
The verification test platform for the Bluetooth TWS function comprises a test host and one or more tested platforms. Each tested platform comprises a testing machine, two tested machines and three USB-to-serial port modules, each USB-to-serial port module is provided with a unique serial port characteristic value, and the USB-to-serial port modules are mapped into designated equipment numbers through specific serial port characteristic values and are used for distinguishing connected Bluetooth equipment.
The test host comprises:
the memory is used for storing the test tool, log information output in the execution process of the test tool and test analysis results;
The processor is used for executing the testing tool and analyzing the testing result;
The testing tool is written by using the python language and is packaged into an executable file, and a pre-written testing script is selected by running the executable file on the processor to automatically complete the test;
The test tool comprises test scripts, wherein the test scripts are written and contained in engineering projects of the test tool before being packaged into executable files, the test scripts contain TWS function points to be tested, and corresponding code description is adopted for each test function point, and the code description is used for controlling the flow of the test;
And the hardware interface is used for connecting with external equipment.
The testing machine is a Bluetooth device, is used as a mobile phone, has the functions of searching the Bluetooth device, establishing connection with other Bluetooth devices and transmitting data, and is provided with a UART interface and a radio frequency module, wherein the testing machine is connected with one USB-to-serial port module through the UART interface, the USB-to-serial port module is connected with a processor of a testing host through a hardware interface, and the testing machine is used for receiving and transmitting radio frequency data through the radio frequency module and is used for establishing Bluetooth connection and interacting data between the Bluetooth devices.
The device to be tested is provided with a UART interface and a radio frequency module, the two test machines are respectively connected with the other two USB-to-serial port modules through the UART interface, the USB-to-serial port modules are connected with a processor of a test host through a hardware interface, the test machines are used for receiving and transmitting radio frequency data through the radio frequency module, and the device to be tested is used for establishing Bluetooth connection and interacting data between Bluetooth devices.
Furthermore, the tester is an FPGA development platform, a digital design file with a classical Bluetooth function is preloaded, the digital design file is used for describing the hardware function of the tester, and before testing, module design items are compiled and downloaded into the FPGA platform, so that the digital design file has the classical Bluetooth function.
Further, the testing machine is a development board with a Bluetooth chip, and the Bluetooth chip has a classical Bluetooth function.
Furthermore, the tested machine is an FPGA development platform, a digital design file with TWS hardware functions is preloaded, the digital design file is used for describing the hardware functions of the tested machine, and module design items are compiled and downloaded into the FPGA platform before testing, so that the tested machine has Bluetooth TWS functions.
Further, the tested machine is a development board with a Bluetooth chip, and the Bluetooth chip has a TWS hardware function.
Further, the testing tool and the tested platform carry out HCI instructions, event interaction and data transmission through the USB to serial port module.
It is another object of the present invention to provide a method for testing bluetooth TWS functions using the platform verification described above.
The method comprises the steps that (1) a processor executes a testing tool, one or more testing scripts to be executed are selected, the testing tool issues HCI instructions to a testing machine and a tested machine in a group of tested platforms, and the instructions are used for reading testing roles of Bluetooth equipment;
Step (2), after the testing machine and the tested machine receive the HCI instruction, analyzing the HCI instruction, executing corresponding operation, and sending an execution result to the testing tool in the form of an HCI event, wherein the execution result contains the role of the equipment itself, and indicates that the equipment is the testing machine or the tested machine;
step (3) if the Bluetooth device is a tested machine, the testing tool sends an HCI instruction for reading the TWS role to the Bluetooth device, and the Bluetooth device returns to the TWS role to indicate that the Bluetooth device is a main earphone or an auxiliary earphone;
Step (4), the testing tool respectively sends HCI instructions for reading Bluetooth addresses to three Bluetooth devices, and the Bluetooth devices return the Bluetooth addresses of the testing tool and are used for establishing Bluetooth connection between the Bluetooth devices;
Step (5), according to the test requirement, the test tool controls the test machine to be actively connected with the main earphone or controls the main earphone to be actively connected with the test machine, and the test machine and the main earphone establish a classical Bluetooth link;
If the testing machine is actively connected with the main earphone, the testing machine is used as a Bluetooth master in a Bluetooth network, the main earphone is used as a Bluetooth slave, and then the TWS slave function is tested;
if the main earphone is actively connected with the tester, the tester is used as a Bluetooth slave in a Bluetooth network, the main earphone is used as a Bluetooth master, and then TWS MASTER functions are tested;
step (6), the testing tool controls the auxiliary earphone to monitor the data of the testing machine, establishes TWS connection topology, establishes SCO/eSCO connection between the testing machine and the main earphone according to the testing requirement, or enters a sniff mode;
the TWS connection topology is that a classical Bluetooth link is established between a testing machine and a main earphone, a classical Bluetooth link is established between the main earphone and an auxiliary earphone, and a nonstandard monitoring link is established between the auxiliary earphone and the testing machine;
According to the TWS mode type, the test direction and the specific test details in each direction, the test tool issues different test commands and test parameters to the tested platform, and the tested platform executes corresponding test operation;
the TWS mode types comprise TWS slave mode and TWS MASTER mode;
the test type comprises TWS bottom hardware function test and TWS protocol behavior test;
the test direction comprises ACL, eSCO, SCO, sniff, error;
The specific test details are the receiving and transmitting test of the appointed data packet type, or the receiving and transmitting test of the random data packet type, or the processing of errors, or the data receiving and transmitting test of the specific frame arrangement position during eSCO/sniff, or the test of TWS function feature of the upper protocol/Bluetooth firmware;
step (7), if TWS bottom hardware function test is carried out, the test tool issues an instruction to the tested platform, and all frame arranging operations of the test platform are suspended, namely all link data transmission in the Bluetooth network is stopped;
Generating random data by a testing tool, and sending the random data to a testing machine and a tested machine, wherein the random data is used as the testing data to be transmitted between Bluetooth devices, and is used as the original data by a data receiver for data integrity comparison;
Restarting the frame arranging by the tested platform, only maintaining the link data transmission between the testing machine and the main earphone, and monitoring the testing machine by the auxiliary earphone, wherein the link data transmission between the main earphone and the auxiliary earphone is not restored;
The tested platform executes corresponding operation according to specific test details;
step (8), if TWS protocol behavior test is carried out, directly carrying out test according to TWS application scenes set by test scripts;
Step (9), after the TWS bottom hardware function test or/and TWS protocol behavior test is finished, the tested platform reports a test result to the test tool, wherein the test result comprises the number of data packet receiving and transmitting in the test process, the number of data packets monitored by the auxiliary earphone, the integrity comparison result of data received by the Bluetooth device and original data, error condition in the data receiving and transmitting process, radio frequency receiving and transmitting quality and the processing condition of the upper protocol/Bluetooth firmware on TWS application scene;
the test tool compares and analyzes the received test result with the expected test result to obtain a conclusion that the test passes/fails;
And (10) the HCI data interaction condition of the whole test process, which comprises the original data of the test result and the analysis conclusion, is stored in a memory, and finally a test report is generated.
The invention can realize verification test of the Bluetooth TWS function through simple hardware connection and flexible script configuration. The automatic test mode simplifies the complicated manual test flow, improves the test efficiency, and enables the research and development personnel to put more time and effort into other works. When the invention is used, the testing scene can be modified and combined according to the needs, the TWS function of the upper protocol/Bluetooth firmware can be tested more comprehensively and variously, and when the invention is used, expensive testing tools such as a Bluetooth protocol analyzer, a Bluetooth comprehensive tester and the like are not required to be matched, so that the testing cost can be reduced well.
Drawings
FIG. 1 is a schematic diagram of a verification test platform of the present invention;
fig. 2 is a schematic diagram of bluetooth device connection during the testing process of the present invention.
Detailed Description
As shown in fig. 1, a verification test platform for bluetooth TWS functions includes a test host 1 and one or more platforms under test. Each tested platform comprises a testing machine 2, two tested machines 3 and three USB-to-serial port modules 4, each USB-to-serial port module 4 is provided with a unique serial port characteristic value, and the USB-to-serial port modules are mapped into designated equipment numbers through specific serial port characteristic values and are used for distinguishing connected Bluetooth equipment.
(1) The test host 1 includes:
The memory 11 is used for storing the test tool, log information output in the execution process of the test tool and test analysis results;
a processor 12 for executing the test tool and analyzing the test results;
A test tool 13 written in python language and packaged into an executable file, and automatically completing the test by running the executable file on a processor, selecting a test script written in advance;
The test tool comprises test scripts, wherein the test scripts are written and contained in engineering projects of the test tool before being packaged into executable files, the test scripts contain TWS function points to be tested, and corresponding code description is adopted for each test function point, and the code description is used for controlling the flow of the test;
a hardware interface 14 for connecting to an external device, in particular a USB interface.
(2) The testing machine 2 is a Bluetooth device, is an FPGA development platform or a development board with a Bluetooth chip, and is provided with a UART interface 21 and a radio frequency module 22, the FPGA platform is preloaded with a digital design file with classical Bluetooth functions, the digital design file is used for describing hardware functions of the testing machine, module design items are compiled and downloaded into the FPGA platform before testing to enable the module design items to have classical Bluetooth functions, the Bluetooth chip has classical Bluetooth functions if the testing machine is the development board with the Bluetooth chip, the testing machine 2 is used as a mobile phone and has the functions of searching Bluetooth devices, establishing connection with other Bluetooth devices and transmitting data, the testing machine is provided with a UART interface 21 and a radio frequency module 22, the testing machine is connected with one USB-to-serial port module 4 through the UART interface 21, the USB-to-serial port module 4 is connected with a processor 12 of a testing host through the hardware interface 14, and the testing machine is used for receiving and transmitting radio frequency data through the radio frequency module 22 and establishing Bluetooth connection between the Bluetooth devices and exchanging data. During testing, firstly, a Bluetooth driving code with a classical Bluetooth function is downloaded to the testing machine 2 and used for controlling and using the classical Bluetooth hardware function.
(3) The tested machine 3 is a Bluetooth device, is an FPGA development platform or a development board with a Bluetooth chip, the FPGA platform is preloaded with a digital design file with TWS hardware functions if the FPGA development platform is used for describing the hardware functions of the tested machine, module design projects are compiled and downloaded into the FPGA platform before testing to enable the tested machine to have the Bluetooth TWS functions, the Bluetooth chip is provided with the TWS hardware functions if the development board with the Bluetooth chip is used for the development board, the two tested machines 3 respectively serve as left and right earphones, one serves as a main earphone, the other serves as a secondary earphone, the functions of searching Bluetooth devices, establishing connection and data transmission with other Bluetooth devices are achieved, the tested machine 3 is provided with a UART interface 31 and a radio frequency module 32, the two tested machines 3 are respectively connected with the other two USB serial port modules 4 through the UART interface 31, the USB serial port modules 4 are connected with a processor 12 of a testing host through the hardware interface 14, and the tested machine 3 realizes the receiving and transmitting of radio frequency data through the radio frequency module 32 for establishing Bluetooth connection and interaction data between the Bluetooth devices. In the test, firstly, the Bluetooth driving code with TWS function is downloaded to the tested machine 3 for controlling and using TWS hardware function.
As shown in fig. 2, the method for verifying and testing the bluetooth TWS function by using the platform specifically comprises the following steps:
Step (1) the processor 12 executes a test tool, selects one or more test scripts 14 to be executed, and the test tool issues HCI instructions to the test machines 2 and 3 in a set of platforms under test, the instructions being used to read the test roles of the bluetooth device.
And (2) after the testing machine 2 and the tested machine 3 receive the HCI instruction, analyzing the HCI instruction, executing corresponding operation, and sending an execution result to the testing tool in the form of an HCI event, wherein the execution result comprises the role of the equipment, and the role is indicated to be the testing machine or the tested machine.
And (3) if the Bluetooth device is a tested machine, the testing tool sends an HCI instruction for reading the TWS role to the Bluetooth device, the Bluetooth device returns to the TWS role to indicate that the Bluetooth device is a main earphone or an auxiliary earphone, and if the Bluetooth device is the testing machine, the testing tool does not operate.
And the testing tool and the tested platform carry out HCI instructions, event interaction and data transmission through the USB-to-serial port module.
And (4) the testing tool respectively sends HCI instructions for reading the Bluetooth addresses to the three Bluetooth devices, and the Bluetooth devices return the Bluetooth addresses of the testing tool and are used for establishing Bluetooth connection between the Bluetooth devices.
After the testing tool obtains the basic information of the Bluetooth device, the Bluetooth device does not need to search for other devices in the discovery environment, but controls the auxiliary earphone to be directly connected with the main earphone, so that the connection flow is simplified, and the testing time is saved.
Step (5), according to the test requirement, the test tool controls the test machine to be actively connected with the main earphone or controls the main earphone to be actively connected with the test machine, and the test machine and the main earphone establish a classical Bluetooth link;
If the testing machine is actively connected with the main earphone, the testing machine is used as a Bluetooth master in a Bluetooth network, the main earphone is used as a Bluetooth slave, and then the TWS slave function is tested;
if the main earphone is actively connected with the tester, the tester is used as Bluetooth slave in the Bluetooth network, the main earphone is used as Bluetooth master, and then TWS MASTER functions are tested.
Step (6), the testing tool controls the auxiliary earphone to monitor the data of the testing machine, establishes TWS connection topology, establishes SCO/eSCO connection between the testing machine and the main earphone according to the testing requirement, or enters a sniff mode;
the TWS connection topology is that a classical Bluetooth link is established between the testing machine and the main earphone, a classical Bluetooth link is established between the main earphone and the auxiliary earphone, and a nonstandard monitoring link is established between the auxiliary earphone and the testing machine.
According to the TWS mode type, the test direction and the specific test details in each direction, the test tool issues different test commands and test parameters to the tested platform, and the tested platform executes corresponding test operation.
The TWS mode types comprise TWS slave mode and TWS MASTER mode;
the test type comprises TWS bottom hardware function test and TWS protocol behavior test;
The test direction includes ACL, eSCO, SCO, sniff, error.
The specific test details are a transceiving test of a specified data packet type, a transceiving test of a random data packet type, a processing of errors (including but not limited to lt_addr error and crc error), a data transceiving test of a specific frame arrangement position (including but not limited to eSCO retransmission window arrangement frame and SNIFF ATTEMPT/timeout window arrangement frame) or a test of TWS function feature of upper layer protocol/Bluetooth firmware when eSCO/sniff is processed.
And (7) if the TWS bottom hardware function test is carried out, the test tool issues an instruction to the tested platform, and all frame arranging operations of the test platform are suspended, namely all link data transmission in the Bluetooth network is stopped.
Random data is generated by the testing tool and is sent to the testing machine and the tested machine, the random data is transmitted between Bluetooth devices as the testing data, and the random data is used as the original data by a data receiving party for data integrity comparison.
The tested platform restarts the frame arranging, only keeps the link data transmission between the testing machine and the main earphone, monitors the testing machine by the auxiliary earphone, and does not recover the link data transmission between the main earphone and the auxiliary earphone.
And the tested platform executes corresponding operation according to the specific test details.
And (8) if the TWS protocol behavior test is carried out, testing is directly carried out according to the TWS application scene set by the test script 14. And the tested platform executes corresponding operation according to the specific test details.
And (9) after the TWS bottom hardware function test or/and TWS protocol behavior test is finished, the tested platform reports the test result to the test tool.
The test result comprises the number of data packet receiving and transmitting in the test process, the number of data packets monitored by the auxiliary earphone, the integrity comparison result of the data received by the Bluetooth device and the original data, error conditions in the data receiving and transmitting process, the quality of radio frequency receiving and transmitting, and the processing condition of the upper protocol/Bluetooth firmware on TWS application scenes.
And the test tool compares and analyzes the received test result with the expected test result to obtain a conclusion that the test passes/fails.
And (10) the HCI data interaction condition of the whole test process, which comprises the original data of the test result and the analysis conclusion, is stored in a memory, and finally a test report is generated. The chip designer or software developer can further analyze, locate and solve the problems existing in the research and development process according to the test report.
The above embodiments are described in further detail below using a specific test scenario:
and executing the testing tool at the PC end, and selecting one testing case.
The testing tool reads the configuration information of the USB-to-serial port module, so that the testing tool can normally communicate with Bluetooth equipment.
The test tool reads the device address, test role and TWS role of the Bluetooth device.
The test equipment controls the secondary earpiece page master earpiece and then the tester page master earpiece, the tester becomes master in the piconet and the master earpiece becomes slave in the piconet.
The headset enters listening, forming the TWS connection topology shown in fig. 2.
The tester sends a request to enter the sniff mode to the main earphone, wherein the sniff parameter is attempt =3 and the timeout=2.
The tester and the master earphone enter the sniff mode and the slave earphone also starts to monitor the tester in the sniff mode.
Suspending all frame scheduling operations of the test platform, and stopping link data transmission in all piconets.
The test tool respectively sends random data packets and specific scenes of the sniff test to the Bluetooth device. The test scenario requires that the main and auxiliary earphones receive the data packet in the third attempt window of SNIFF INTERVAL, and receive the data packet in the second timeout window after the end of the attempt window, the main earphone replies the same data packet to the tester after receiving the data packet (the information carried by the data packet contains the case of TWS monitoring), and after 1000 pieces of SNIFF INTERVAL, the test case is ended, and the test result is sent to the test tool.
The tester sends the data packet in the third attempt window fixed at SNIFF INTERVAL and sends the data packet in the second timeout window after the end of the attempt window. After the testing machine sends out the data packet, the data packet replied by the main earphone is waited to be received, and the data packet is checked after the data packet is received. After 1000 SNIFF INTERVAL test cases are finished, the test results are sent to the test tool.
After the test tool receives the test result, comparing with the expected test result set in the test case, if the result accords with the expected one or the deviation from the expected one is in the set range, judging that the test is passed, otherwise, not passing.
After all the test cases are completed, a test report of the test is generated.