Serial port testing method and system
Technical Field
The invention relates to the field of serial port testing, in particular to a serial port testing method and a serial port testing system.
Background
The common touch control panel has two interfaces, one of which is a USB interface, and the other is a UART serial port, wherein the UART serial port is mainly used for a touch screen of KTV. The industrial standard of the UART serial port is three effective lines, namely a 5V vdd line, a GND ground line and a TX signal line, wherein the TX signal line is used for transmitting a signal line of a touch coordinate from a touch control board to a KTV system mainboard.
The test method for the UART serial port comprises the steps that one test method is to connect the UART serial port to a serial port for testing, and the other test method is to connect the UART serial port to a KTV displayer for scribing test; when carrying out the marking off test, at first will insert the sensor on touch control panel, look for a KTV mainboard and display, the reuse hand is marked off, see whether the display has signal output, thereby judge whether the UART serial ports normally works, this kind of test method needs the supporting mainboard of KTV, and touch sensor is in coordination, the winding displacement of sensor has 60 many pins or many winding displacements simultaneously, the speed is very slow during the plug, and the winding displacement has the life-span influence, can increase the cost of test simultaneously, the efficiency is lower, and because will connect the bayonet socket and mark off this action with the hand, lead to the productivity lower.
Disclosure of Invention
The invention aims to provide a serial port testing method to solve the problems in the background technology.
In order to achieve the purpose, the invention provides the following technical scheme:
a serial port testing method comprises the following steps:
s1, connecting a TX signal wire on the serial port interface;
s2, applying for a timer I in a main program of the touch chip, wherein the timer I sends a section of recognition characters outwards from the TX signal line periodically according to preset time;
s3, designing a serial port tool, judging whether the identification character is received and analyzed in a preset period when a serial port is plugged, if so, judging that the three lines from the touch chip to the TX port and the components in the transmission process work normally, and if not, judging that the three lines from the touch chip to the TX port and the components in the transmission process are abnormal.
As a further scheme of the invention: the step S3 further includes the steps of: when the three lines from the touch chip to the TX port and the components in the transmission process are judged to work normally and the touch screen is not touched really, the steps S2-S3 are circulated, whether the recognition characters are received and analyzed is judged in a preset period, if yes, the three lines from the touch chip to the TX port and the components in the transmission process are judged to work normally, and if not, the three lines from the touch chip to the TX port and the components in the transmission process are judged to be abnormal.
As a further scheme of the invention: step S2 includes the steps of:
the main program of the touch chip sends head recognition characters as test interface signals at fixed time according to preset time, and the head recognition characters are transmitted on a link line in a touch data mode; the head recognition character is an invalid character.
As a still further scheme of the invention: the time of the preset period is two times or more than two times of the preset time.
A serial port test system comprising:
the TX port is used for connecting a TX signal line on a serial port interface;
the identification character sending module is used for sending a section of identification characters outwards from the TX signal wire periodically according to preset time by using a timer I;
and the judging module is used for judging whether the identification characters are received and analyzed in a preset period, and judging whether the components from the touch chip to the TX three lines and in the transmission process are abnormal when the identification characters are not received or analyzed in the preset period.
As a still further scheme of the invention: the judging module further comprises a circulating judging unit which is used for judging whether the components in the three lines from the touch chip to the TX port and the transmission process are normal and judging whether the components in the three lines from the touch chip to the TX port and the transmission process are abnormal when the touch screen is judged to be idle without real touch and the judging module judges whether the identification characters are not received or analyzed in a preset period.
As a still further scheme of the invention: the identification character sending module comprises a specific identification character sending unit, and is used for sending the head identification character as a test interface signal at regular time according to preset time and transmitting the head identification character on a link line in a touch data mode.
Compared with the prior art, the invention has the beneficial effects that: this application is through regularly sending the discernment character towards the computer end, and the discernment character can set up according to service condition, guarantees whether real-time supervision serial ports can normally work, and this application adopts original connected mode to detect for the process is simple, does not need all the other test matching devices, saves the test cost.
Drawings
Fig. 1 is a diagram of a serial port testing method.
Fig. 2 is a schematic connection diagram of a serial port testing method.
Fig. 3 is a schematic diagram of test control in the serial port test method.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1 to 3, in an embodiment of the present invention, a serial port testing method and system includes the steps of:
s1, connecting a TX signal wire which sends out on the serial port interface, because there is basically only one TX signal wire which sends out signals on the serial port interface, only touch data is sent out at ordinary times, the coordinate of the touch position of the touch sensor can be inducted and transmitted, when the coordinate of the touch position is transmitted, in order to realize the test of the serial port, a string of invalid characters can be sent to identify when the coordinate is sent, so the method comprises the step S2;
s2, in order to realize the test of the serial port, a first timer is applied in the main program of the touch chip, a section of recognition characters are sent out from a TX signal line periodically in T0 within the time controlled by the first timer, wherein the T0 period can be set to be about 50ms, in the step, the coordinate signals normally reported and the efficiency problem during the test can be adjusted through the adjustment of the time T0, T0 is too short, the transmission frequency is too high, the operation of part of the computer is slow, T0 is too long, the waiting time of the test end is too long, and the T0 is recommended to select any value between 10ms and 200ms under the condition of low efficiency. The set time T0 adopts a cyclic sending mode, so that the test can be ensured without a related starting signal when the control board is powered on, and the test can be carried out because only a TX signal line is arranged in the scene, and the signal can be sent out and cannot be received;
s3, designing a serial port tool, and when a serial port is plugged, determining whether to receive and analyze the identification character in a certain period, that is, in this embodiment, the time of 2T0 or 2T0 is taken as the period, if the identification character is received and analyzed, determining that the slave touch chip, the TX signal line, and the process component are working normally, and if not, determining that the slave touch chip, the TX signal line, and the process component are abnormal, and displaying the test result on the test tool as OK.
As a further embodiment of the present application, referring to fig. 1 and fig. 2, step S3 further includes the steps of: when the three lines from the touch chip to the TX port and the components in the transmission process are judged to work normally and the touch screen is not touched really, the steps S2-S3 are circulated, whether the recognition characters are received and analyzed is judged in a preset period, if yes, the three lines from the touch chip to the TX port and the components in the transmission process are judged to work normally, and if not, the three lines from the touch chip to the TX port and the components in the transmission process are judged to be abnormal.
As a further embodiment of the present application, referring to fig. 1 and 2, the recognition character in step S2 is a head recognition character, which is "TWSC", and the character "TWSC" is an invalid null character with respect to the KTV host, because the content is very small, and therefore, the normal communication is not affected. And sending a section of 'invalid character' which does not influence the work of the KTV host machine as a test tool interface signal at regular time through an mcu program of the touch chip, and transmitting the 'invalid character' on a link line in a mode similar to normal touch data.
A serial port test system comprises a TX port, a serial port interface and a signal processing module, wherein the TX port is used for connecting a TX signal line on the serial port interface so as to realize the transmission of information; the identification character sending module is used for sending a section of identification characters outwards from the TX signal wire periodically according to preset time by using a timer I; and the judging module is used for judging whether the identification characters are received and analyzed in a preset period, and judging whether the components from the touch chip to the TX three lines and in the transmission process are abnormal when the identification characters are not received or analyzed in the preset period.
As a further embodiment of the present application, the determining module further includes a cycle determining unit, configured to determine that there is an abnormality in the components in the transmission process and the three lines from the touch chip to the TX port when it is determined that the components in the transmission process and the three lines from the touch chip to the TX port are working normally and the touch screen is not touched really, and determine that there is an abnormality in the components in the transmission process and the three lines from the touch chip to the TX port when it is determined that the recognition character is not received or is not resolved in a preset period.
As a further embodiment of the present application, in the recognition character transmitting module, a specific recognition character transmitting unit is further included, which is configured to transmit the head recognition character as a test interface signal at a preset time timing, and transmit the test interface signal on the link line in a touch data manner, so that transmission of specific data can be achieved.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.
Furthermore, it should be understood that although the present description refers to embodiments, not every embodiment may contain only a single embodiment, and such description is for clarity only, and those skilled in the art should integrate the description, and the embodiments may be combined as appropriate to form other embodiments understood by those skilled in the art.