CN112631851A - Chip debugging agent device and chip debugging method - Google Patents

Chip debugging agent device and chip debugging method Download PDF

Info

Publication number
CN112631851A
CN112631851A CN202110022995.1A CN202110022995A CN112631851A CN 112631851 A CN112631851 A CN 112631851A CN 202110022995 A CN202110022995 A CN 202110022995A CN 112631851 A CN112631851 A CN 112631851A
Authority
CN
China
Prior art keywords
chip
usb
debugging
interface
usb hid
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110022995.1A
Other languages
Chinese (zh)
Inventor
侯建桥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jirui Zhiyuan Technology Co ltd
Original Assignee
Beijing Jirui Zhiyuan Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jirui Zhiyuan Technology Co ltd filed Critical Beijing Jirui Zhiyuan Technology Co ltd
Priority to CN202110022995.1A priority Critical patent/CN112631851A/en
Publication of CN112631851A publication Critical patent/CN112631851A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a chip debugging agent device and a chip debugging method, and relates to the technical field of electronics. One specific implementation of the chip debugging agent device comprises: the single chip debugging board is used for debugging the debugged chip; the upper computer is used for displaying debugging information; the USB HID interface is used for connecting USB HID equipment; the conversion serial port is used for converting the USB interface into an output serial port of the single-chip debugging board so as to connect the upper computer and the single-chip debugging board; and the chip debugging interface is used for connecting the AUX interface of the debugged chip. According to the embodiment, the GPIO signal output by the TCON chip can be measured and debugged on the premise of not disassembling the liquid crystal screen.

Description

Chip debugging agent device and chip debugging method
Technical Field
The invention relates to the technical field of electronics, in particular to a chip debugging agent device and a chip debugging method.
Background
The logic board is also called a screen driving board, a central control board and a TCON chip. The TCON chip is used for converting image data input signals (input signals comprise three types of signals including color data signals, clock signals and control signals) sent by the digital board into LVDS (low voltage differential signaling) capable of driving the liquid crystal screen after being processed by the logic board, and then directly sending the LVDS to the LVDS receiving chip of the liquid crystal screen. The image data signals are stored by processing the shift register, the clock signals are converted into control signals which can be identified by the screen, and the MOSFET (metal oxide semiconductor field effect transistor) in the screen is controlled by the row-column signals to work so as to control the torsion degree of liquid crystal molecules and drive the liquid crystal screen to display images.
The TCON chip is a core component of the liquid crystal display, and is more and more complex with the continuous development of the display technology. The debugging means of the TCON chip is becoming more important. In the TCON chip debugging process, there are two important tasks: firstly, the register is written through the I2C interface to configure the TCON chip, and simultaneously the register is read to check the working state of the TCON chip, and another important work is to measure the liquid crystal time sequence control signal (GPIO signal) at the output end.
Typically, TCON chips are packaged with a bus controller, i.e., I2C interface, I2C interface has two roles, one is to read data from an external E2RPOM (a memory that can be electrically erased and written in-line), and the other is to serve as an interface for internal register modification configuration. In the design and debugging process of the liquid crystal display, the TCON chip is in an exposed state, the TCON chip is easily in physical connection, the debugging mode at the moment is simple, the register can be read and written only by connecting the single chip debugging board with the I2C interface of the TCON chip, and for the output GPIO signal, a logic analyzer or an oscilloscope is usually used for connecting the output of the TCON chip for measurement.
As shown in fig. 1, for a notebook computer with an installed shell, debugging is inconvenient, an I2C interface channel for reading registers cannot be physically connected, and an audio bidirectional data channel in a DisplayPort (display interface) is left for reading registers, and this channel needs to be supported by a bottom layer video card driver of a manufacturer. Software is usually developed on a personal computer, and the read-write operation of the register of the TCON chip is performed by calling a video card driver.
The debugging method has the following defects:
1. the operation can be performed only under the condition that the display of the liquid crystal screen is normal;
2. in some cases, the LCD screen cannot be used, for example, the LCD screen enters a test picture or enters a self-refresh mode;
3. originally, a test program developed based on a debugging board singlechip cannot be used and can be used only by being transplanted into a personal computer program;
4. for a notebook computer with a mounted shell, when an output time sequence signal is measured, only the liquid crystal panel is disassembled to expose the printed circuit board where the TCON chip is located, and the flying line connection can be realized.
Therefore, in order to overcome the above disadvantages, a new debugging method is needed to be provided, in which a set of debugging agents is developed to enable the debugging agents to realize chip debugging without disassembling the notebook shell, and the existing debugging means, i.e., the single chip debugging board, is used for debugging, so that the debugging program of the original single chip can run completely.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: in the assembled liquid crystal module, the TCON chip cannot be directly contacted, and the traditional debugging means cannot be applied. Aiming at the defects in the prior art, a new debugging thought based on a debugging agent is provided, the data communication with a TCON chip can be realized under the condition that a liquid crystal module is not disassembled through the debugging agent, the debugging agent can be compatible with the existing debugging program, and a non-differentiated debugging scheme is provided.
In order to solve the above technical problem, the present invention provides a chip debug agent apparatus, including:
the single chip debugging board is used for debugging the debugged chip;
the upper computer is used for displaying debugging information;
the USB HID interface is used for connecting USB HID equipment;
the conversion serial port is used for converting the USB interface into an output serial port of the single chip debugging board so as to connect the upper computer and the single chip debugging board;
and the chip debugging interface is used for connecting the AUX interface of the debugged chip.
Preferably, the USB HID device comprises a control endpoint, a receiving endpoint and a sending endpoint;
the control endpoint is used for transmitting USB HID device descriptors, chip reading commands or chip writing commands, the receiving endpoint is used for receiving chip data, and the sending endpoint is used for sending the chip data.
Preferably, the first and second electrodes are formed of a metal,
the USB HID interface is arranged on the single chip debugging board;
the USB HID interface is provided with a high-speed pin and a low-speed pin, and the high-speed pin or the low-speed pin is provided with a pull-up resistor;
when the USB HID equipment is not accessed, the high-speed pin and the low-speed pin are both at a low level; when the USB HID equipment is accessed, the high-speed pin or the low-speed pin is in a high level.
Preferably, the method further comprises the following steps:
and the screen interface is arranged on the single chip debugging board and used for connecting an external screen to display the connection information.
Preferably, the debugging device further comprises a key, a dial switch and an indicator light which are arranged on the single-chip debugging board.
The invention also provides a chip debugging method, which is applied to the chip debugging agent device and comprises the following steps:
the single chip debugging board acquires a USB HID descriptor of the USB HID; wherein the USB HID device descriptor comprises a device descriptor, a configuration descriptor, an interface descriptor, an endpoint descriptor, a string descriptor, an HID descriptor, a report descriptor, and an entity descriptor;
the single chip debugging board initializes the USB HID equipment based on the USB HID descriptor and determines that an interface mode is a USB mode;
after the single chip debugging board starts a chip debugging program, the USB HID sends a chip reading command or a chip writing command to a debugged chip through a chip debugging interface;
and the USB HID sends the chip data obtained from the debugged chip to the single chip debugging board so as to finish debugging the debugged chip.
Preferably, the one-chip debug board obtains a USB HID device descriptor of the USB HID device, and the method further includes:
and the single chip debugging board regularly inquires the connected USB HID and stores the connection state of the USB HID.
Preferably, the sending, by the USB HID device, the chip read command or the chip write command to the debugged chip through the chip debug interface includes:
the USB HID receives a data reading command or a data writing command;
the USB HID converts the data reading command or the data writing command into a chip reading command or a chip writing command;
and the USB HID sends the chip reading command or the chip writing command to a debugged chip through a chip debugging interface.
Preferably, the sending, by the USB HID device, the chip read command or the chip write command to the debugged chip through a chip debug interface includes:
the control endpoint of the USB HID sends the chip reading command to the debugged chip through a chip debugging interface so as to read the chip data from the register of the debugged chip; or
And the control endpoint of the USB HID equipment sends the chip write-in command to the debugged chip through the chip debugging interface so as to write register configuration into the debugged chip.
Preferably, the sending, by the USB HID device, chip data obtained from a debugged chip to the single chip debug board includes:
a receiving endpoint of the USB HID receives chip data read from a register of a debugged chip and stores the chip data into a USB cache region in a USB array form; the USB array is defined with a structure body pointer, and the structure body pointer points to the USB cache region;
the sending end of the USB HID device sends the chip data of the USB cache area to the single chip debugging board; the chip data comprises a data valid bit mark, a command bit, a target address bit to be operated by reading and writing, a length bit to be operated by reading and writing and a variable data bit.
The chip debugging agent device and the chip debugging method have the following beneficial effects that:
the debugging technology of the TCON chip based on the debugging agent is realized, the USB interface of a computer and a single chip microcomputer are used as an intermediate circuit on the premise of not disassembling a liquid crystal screen, the communication between the debugged TCON chip and an external debugging machine is realized, and a new USB agent debugging interface is connected to the existing debugging program. Meanwhile, the original debugging program can be used for debugging conveniently, and the liquid crystal display screen does not need to be disassembled completely, so that a brand-new debugging path is developed for the TCON chip.
Drawings
FIG. 1 is a block diagram of a conventional TCON chip debug connection;
fig. 2 is a role block diagram of a chip debug agent apparatus according to an embodiment of the present invention;
FIG. 3 is a functional block diagram of hardware circuitry of a chip debug agent apparatus of an embodiment of the present invention;
FIG. 4 is a circuit diagram of a core portion of a referenced one-chip debug board;
FIG. 5 is a circuit diagram of a USB communication portion of a referenced one-chip debugging board;
FIG. 6 is a circuit diagram of a USB to serial port portion of a referenced single chip debug board;
FIG. 7 is a diagram illustrating a method for debugging a chip according to an embodiment of the present invention;
FIG. 8 shows the program structure of the single chip microcomputer with an additional USB interface;
FIG. 9 is a referenced upper computer interface layout;
FIG. 10 is a block diagram of a referenced USB HID library version C #.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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 some, but not all, embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
Example one
As shown in fig. 2 and 3, a chip debug agent apparatus provided in an embodiment of the present invention includes: the device comprises a single chip debugging board, an upper computer, a USB HID interface, a conversion serial port and a chip debugging interface. The single chip debugging board is used for debugging a debugged chip; the upper computer is used for displaying debugging information; the USB HID interface is an equipment interface and is used for connecting USB HID equipment; the conversion serial port is used for converting the USB interface into an output serial port of the single-chip debugging board so as to connect the upper computer and the single-chip debugging board; the chip debugging interface (I2C interface) is used for connecting an AUX interface (audio input interface) of a debugged chip.
The debugged chip (TCON chip) is originally connected with a single-chip debug board through an I2C interface, and all debugging programs are developed in the single-chip. After the liquid crystal display is well installed, only an AUX channel (namely an AUX interface) is left in a TCON chip and an external two-way communication port, and in order to continue to use a developed singlechip debugging program, a data channel communicated with the singlechip needs to be established by using the AUX channel, which is a function to be realized by the invention. At the computer end, a bottom layer driver can be used for reading and writing a register of a TCON chip through an AUX channel, if the data of the program can be forwarded to a single chip microcomputer program, the purpose of debugging can be achieved, the program is called as a debugging agent upper computer program, and for achieving communication between the upper computer program and the single chip microcomputer, an existing single chip microcomputer debugging board needs to be improved, a USB (universal serial bus) interface is added, and the upper computer program is connected with the single chip microcomputer through the USB interface. Therefore, the upper computer program establishes a communication channel between the single chip microcomputer and the TCON chip through the AUX interface and the USB interface. The single chip microcomputer program is modified to redirect the command originally accessing the register through the I2C interface to the USB interface, the debugging agent upper computer program is responsible for forwarding the command of the single chip microcomputer to the TCON chip and forwarding the returned data to the single chip microcomputer, namely the TCON chip debugging agent software and hardware overall design idea.
As a preferred embodiment, the CPU on the debug agent hardware circuit (i.e., the one-chip debug board of the chip debug agent apparatus) may select the STM32f103 chip. The STM32f103 is an STM32 for short, is a 32-bit processor based on an ARM Cortex-M3 kernel, and has strong performance, outstanding power consumption control and a plurality of peripherals.
Fig. 4 shows a circuit diagram of a core portion of a one-chip debug board. Fig. 4 provides a partial wiring layout of a reference STM32f103 chip, and reference may be made to a tool book or a general explanation for illustration of element symbols, pins, and the like in the drawing, which is not repeated in the embodiments of the present invention.
In the embodiment of the invention, only three endpoints are needed in the USB HID interface, and the USB HID interface connected with the USB HID interface mainly comprises a control endpoint, a receiving endpoint and a sending endpoint. The control endpoint is used for transmitting a USB HID device descriptor, a chip reading command or a chip writing command; the receiving end point is used for receiving chip data; the sending endpoint is used for sending chip data.
As a preferred implementation manner, in the chip debug agent apparatus according to the embodiment of the present invention, the USB HID interface may be disposed on the single chip debug board, and the USB HID interface is provided with a high-speed pin and a low-speed pin, and the high-speed pin or the low-speed pin is provided with a pull-up resistor, when no USB HID device is connected, both the high-speed pin and the low-speed pin are at a low level, and when a USB HID device is connected, the high-speed pin or the low-speed pin is at a high level.
Fig. 5 shows a circuit diagram of a USB communication part of a one-chip debug board. Fig. 5 provides a wiring layout of a USB communication portion of a reference STM32f103 chip, and reference may be made to a tool book or a general explanation for illustration of component symbols, pins, and the like in the drawing, which is not repeated in the embodiments of the present invention.
Fig. 6 shows a circuit diagram of a conversion serial port part of a single chip debugging board. Fig. 6 provides a wiring layout for USB to serial port circuit design of a referential STM32f103 chip, and reference may be made to a tool book or a general explanation for illustration of component symbols, pins, and the like in the drawing, which is not repeated in the embodiments of the present invention.
When the USB interface is applied, a chip for converting the serial port into the USB can be selected for the conversion of the serial port (namely the USB to the serial port) and used for the USB interface to realize the conversion of the USB into the serial port, so that codes, serial port debugging codes and the like can be downloaded through the USB interface.
In addition, the chip debugging agent device of the embodiment of the invention can also comprise a screen interface, a key, a dial switch and an indicator light.
The screen interface, the keys, the dial switch and the indicator lamp can be arranged on the single-chip debugging board. Therefore, in specific application, the functions that the chip debugging agent device can cover are as follows:
the single chip microcomputer directly outputs and provides a USB2.0 interface.
The output serial port of the singlechip is converted into a USB2.0 interface through a USB-to-serial port.
The power supply control part directly gets power from the USB interface.
Reserved part of keys, key switches (i.e. dial switches) and indicator Lamps (LED)
A set of I2C pins (i.e., chip debug interface) is provided for directly connecting TCON for register debugging
A screen interface is reserved for connecting an external screen for displaying simple connection information or the like, for example, an Organic Light Emitting Diode (OLED) may be connected.
Example two
As shown in fig. 7, an embodiment of the present invention further provides a chip debugging method, where the chip debugging method is applied to the chip debugging agent apparatus in the first embodiment, and mainly includes the following steps:
step S701, the single chip debug board obtains a USB HID device descriptor of the USB HID device.
USB HID devices are a class of human-machine interactive devices used to control some aspects of computer operation.
The chip debugging agent device of the embodiment of the invention is only used as a data transmission channel, one end of the data transmission channel is a USB-to-serial port, so the speed can not exceed 200kbps at most, the type of the USB HID equipment is very suitable, the USB HID equipment can be directly used without installing a driver, and for an STM32 singlechip, a manufacturer provides a standard USB library, so the standard library (namely the USB library) of the manufacturer can be directly used for realizing the USB HID equipment.
In the chip debugging method of the embodiment of the invention, the USB HID device descriptor comprises a device descriptor, a configuration descriptor, an interface descriptor, an endpoint descriptor, a character string descriptor, an HID descriptor, a report descriptor and an entity descriptor.
The USB host (i.e., the one-chip debug board) obtains information of the USB HID device through a USB HID device descriptor of the USB HID device. Standard USB devices have 5 USB descriptors: device descriptors, configuration descriptors, interface descriptors, endpoint descriptors, string descriptors. In addition to some descriptors defined by the standard, a USB HID device includes 3 HID device class specific descriptors: HID descriptor, report descriptor, entity descriptor.
The USB descriptor is described in detail in the standard library, and is not described in detail. The STM32 USB library used in connection with the embodiments of the present invention makes some explanations of the parts that need to be modified:
1. device descriptor
A USB device has only one device descriptor. The device descriptor mainly records information such as: USB protocol version number used by the device, device type, maximum packet size for endpoint 0, vendor id (vid) and product id (pid), device version number, vendor string index, product string index, device serial number index, number of possible configurations, etc.
According to the specification of the USB specification, all USB devices have a supplier id (VID) and a product identification code (PID), and the host distinguishes different devices by different VIDs and PIDs, and the VIDs and PIDs are both two bytes long, wherein the supplier id (VID) is applied to the USB execution forum by suppliers, the VID of each supplier is unique, the PID is determined by the suppliers, theoretically, different products, different models of the same product, and different products of different designs of the same model use different PIDs to distinguish different devices of the same manufacturer, and the test device related to the embodiment of the present invention can directly borrow the code number 0x0483 of the manufacturer.
2. Configuration descriptor set
The configuration descriptor set includes configuration descriptors, interface descriptors, class specific descriptors (here HID descriptors are represented), and endpoint descriptors. Wherein the configuration descriptor section may essentially use the example code default values without modification.
3. Character string descriptor
The string descriptor is primarily the display name of the device, which can be seen in the device manager, so correct modification of the string descriptor helps to distinguish between the various HID devices connected to the computer.
In addition, regarding the viewing of the USB HID, the modified STM32 code can be compiled and burned into hardware, the hardware is connected to a computer host, the machine automatically prompts the installation of the USB HID, and after the installation, the corresponding device information can be viewed from the device manager to be completely the same as that set in the code.
In this embodiment of the present invention, before implementing step S701, the method may further include: the single chip debugging board regularly inquires the connected USB HID and stores the connection state of the USB HID.
Regarding the automatic detection of the USB HID device, when the code implements this step, the connection of the USB device can be implemented by calling the method of device. A pool variable, i.e., pool DeviceConnected, is declared at the beginning of the code for storing the connection state of the device, false when the device is not connected, true when connected.
After the program runs, the USB HID equipment is automatically run for initialization, then whether the device is connected or not is judged by running the method of device.connect (), if the current equipment is not inserted, the device connected is false, then a timer is started, whether the device.connect () is connected or not is judged by executing the method of device.connect () once every second, if the device is connected, the timer is automatically closed, and the device connected is true. When the USB device is unplugged, the function of DeviceOnDisconnected is automatically called, and the function of DeviceConnected is false. Therefore, the automatic plugging detection of the USB equipment can be realized.
Step S702, the single chip debugging board initializes the USB HID based on the USB HID descriptor and determines the interface mode as the USB mode.
After the single chip debug board is powered on, the USB function module needs to be initialized to work, except for configuring a corresponding clock and a corresponding interrupt to enable the corresponding function module, the endpoint of the USB equipment needs to be initialized, namely the USB HID equipment is initialized.
The hardware interfaces supported by the function originally realized by the single chip microcomputer are two, namely I2C and AUX channels, in the chip debugging method of the embodiment of the present invention, the original program needs to be compatible with the new function USB interface function, and the program structure is as shown in fig. 8 (only including the register read-write part in the figure). At this time, the main function terminal mode command may be modified, and when the user parameter is 3, the mode is switched to the USB mode, and a corresponding prompt is given. In the general read-write function of the interface layer, the support of a USB mode is added, two functions are mainly added, one function is a read register function, and when the mode is judged to be the USB mode, a USB mode read register command is called. The other is a write register function, and when the mode is judged to be the USB mode, the USB mode write register command is called.
When the code implements this step, the following example may be referenced:
adding an initialization code of the USB device at the beginning of the program:
Device=new UsbHidDevice(0x0483,0x5850);
v/register a new USB HID device, VID 0x0483, PID 0x5850
The PID and VID must completely correspond to the code in the singlechip
Device.OnConnected+=DeviceOnConnected;
// registering the name of the processing function on a device connection as DeviceOnconnected
Device.OnDisConnected+=DeviceOnDisConnected;
// the name of the processing function when the registered device is disconnected is DeviceOnDisconnected
Device.DataReceived+=DeviceDataReceived;
// registration device receives data with the name of the processing function DeviceDataReceived
The initialization of the new device by the USB HID is completed.
If the VID and PID are the same and the connection is good, the device connection is automatically initialized. At this time, the reception of data can be realized by the DeviceDataReceived function.
Step S703, after the single chip debug board starts the chip debug program, the USB HID device sends a chip read command or a chip write command to the debugged chip through the chip debug interface.
In the embodiment of the present invention, the step of sending the chip read command or the chip write command to the debugged chip by the USB HID device through the chip debug interface may be implemented in the following manner: the USB HID receives a data reading command or a data writing command; the USB HID converts the data reading command or the data writing command into a chip reading command or a chip writing command; and the USB HID sends a chip reading command or a chip writing command to the debugged chip through the chip debugging interface.
In the embodiment of the present invention, the step of sending the chip read command or the chip write command to the debugged chip by the USB HID device through the chip debug interface may be implemented in the following manner: a control endpoint of the USB HID sends a chip reading command to a debugged chip through a chip debugging interface so as to read chip data from a register of the debugged chip; or the control endpoint of the USB HID device sends a chip write command to the debugged chip through the chip debugging interface so as to write the register configuration into the debugged chip.
The chip debugging method of the embodiment of the invention can realize USB reading (namely reading chip data) and writing function (namely chip writing command) in the reading and writing command through the USB interface function.
Regarding the USB reading function, firstly, the address and the data length to be read are filled in the USB buffer through the structure body pointer, then the USB sending command is called to send out the USB buffer data, then the USB receiving mark is polled, if the data is received, the validity of the data is judged, whether the data is correct ACK (reply) or not is judged, if the data is correct ACK (reply), the data in the buffer is read, and the data is returned.
It should be noted that, because the polling method is adopted, if the USB device does not reply, the program will enter into a dead loop, so the timeout determination must be added, and if no USB data is received after a certain set time, the program will exit and return to the timeout error.
Regarding the USB write-in function, firstly, the address, the data length and the data to be written are filled in the USB buffer through the structure body pointer, then the USB sending command is called to send out the USB buffer data, then the USB receiving mark is polled, if the data is received, the validity of the data is judged, whether the data is correct ACK or not is judged, and if the data is correct ACK, 0 is returned.
It should be noted that, as with the read command, since the polling method is used, the timeout determination is increased.
Step S704, the USB HID device sends the chip data obtained from the debugged chip to the single chip debug board to complete the debugging of the debugged chip.
The debugging agent mainly performs communication conversion of read-write operations. In order to ensure the reliability and the universality of data communication, the chip data can comprise several aspects:
1. a data valid bit flag for determining whether the packet is a correct packet;
2. command bits, which in addition to read and write, also need to contain an ACK command to respond whether the operation was successful;
3. reading and writing target address bits to be operated;
4. reading and writing length bits to be operated;
5. variable data bits.
According to the above requirements, the data format design is shown in table 1.
TABLE 1
Figure BDA0002889338170000131
In the embodiment of the present invention, the step of sending the chip data obtained from the debugged chip to the single chip debug board by the USB HID device may be implemented in the following manner: a receiving endpoint of the USB HID receives chip data read from a register of a debugged chip and stores the chip data into a USB cache region in a USB array form; and the sending terminal of the USB HID equipment sends the chip data of the USB cache region to the single chip debugging board.
In a specific application, the USB data endpoint 1 (i.e. the receiving endpoint) may have a receiving buffer with a length initialized to 64 bytes, and when the USB receiving interrupt arrives, the EP1_ OUT _ callback (void) callback function is automatically called to copy the USB received data to the specified location. The method comprises the steps of inquiring USB _ Received _ Flag in a program, and when the USB _ Received _ Flag is 1, storing the currently Received USB data packet in the USB _ Received _ Buffer, wherein the length of the currently Received USB data packet is 64 bytes.
For enabling USB data endpoint 2 (i.e., the sending endpoint) to send USB data, the following steps may be referenced:
1. copying data to be transmitted to a buffer;
2. setting a sending size;
3. starting transmission;
4. waiting for the transmission to complete.
The data buffer (i.e. USB buffer) of USB is actually an array, and in order to enable simpler operation of this array, the data structure of USB may be declared as a structure, and the USB data structure is as follows:
Figure BDA0002889338170000141
meanwhile, a structure body pointer is declared and points to the USB buffer area, so that data can be operated in a structure body pointer mode. The method comprises the following specific steps:
TYPE_USBDAT*USB_RECEIVE_Packet=(TYPE_USBDAT*)US B_RECEIVE_Buffer;
the code of the pointer operation data is as follows:
USB_Send_Packet->Magic_Tag=COMM_TAG_USB;
USB_Send_Packet->Ins=USB_CMD_Read;
USB_Send_Packet->Addr_OSB=slaveID;
USB_Send_Packet->Addr_High=addrh;
USB_Send_Packet->Addr_Mid=addrm;
USB_Send_Packet->Addr_Low=addrl;
USB_Send_Packet->Lenth=Rlength;
EXAMPLE III
In the embodiment of the present invention, the upper computer debugging agent may be implemented in the following manner:
1.C # program interface implementation
In the embodiment of the invention, the key point of debugging agent development is to call C + + written codes, and to develop a simple interface, the performance is not a problem which needs to be considered preferentially, so C # becomes the first choice. C + + is an inheritance of the C language (a procedural-oriented, abstract, general-purpose programming language) and can be used for both procedural programming of the C language and object-based programming featuring abstract data types, as well as object-oriented programming featuring inheritance and polymorphism. C # is a secure, stable, simple, elegant, object-oriented programming language derived from C and C + +. The great advantage of selecting C # for development of the upper computer is that the interface design is very simple and the design can be completely based on a UI dragging mode.
The program interface layout is shown in fig. 9, wherein the window name "ANX-debug agent V0.1" is followed to prompt the debug agent whether the hardware device is connected.
The drop-down box currently selected as the Intel eDP on the user interface is used for selecting the communication port, because the DisplayPort is divided into two types, namely, a DP (notebook external expansion output standard interface) and an eDP (notebook internal output standard interface), and the Intel driver also supports the two interfaces, the drop-down box is selected by the user, and for the debugging agent in the embodiment of the invention, the debugging agent mainly supports the application of the eDP, so the default is the eDP interface. And a selectable box "Show Debug info" is provided below the drop-down box for selecting whether to display the Debug information.
The 'Test Read DPCD' button is a button for testing reading DPCD (register), is used for testing whether the current program can correctly Read the data in the DPCD, and can independently Test the channel for reading the data in the debugging agent.
The Clear Debug Windows button is used for clearing window data, the window part is used for displaying debugging information, and when the debugging agent works, the window can display a reading or writing command received from the single chip microcomputer and also can display a data return value read from the DPCD.
The "Start Console" button is a control window that initiates a function of the add-on accessory for commanding line mode data reading.
C # calling DLL (library) for realizing USB data communication
The communication between the C # and the USB HID interface is relatively complex compared with the communication between the C # and the serial port, and data communication can be carried out in a mode based on the USB HID library as long as the interface calling of the USB HID library is concerned.
2.1 invocation of USB HID library
The structure of the C # version of the USB HID library is shown in fig. 10, and takes the form of a file directory. Running C # may generate a solution, i.e., may generate a usbhid.
Cs defines a function interface that DLL files can share with external program calls through the method of DLLImport. An example of the function interface code is as follows:
[DllImport("hid.dll",SetLastError=true)]
public static extern bool HidD_FlushQueue(SafeFileHandle hidDeviceObject);
[DllImport("hid.dll",SetLastError=true)]
public static extern bool HidD_FreePreparsedData(IntPtr preparsedData);
after the DLL is generated, the UsbHid.dll file is copied to a debug directory (system debugging folder) of an item (namely, a USB HID library), so that the program can find the needed DLL file when running, the reference of the USB HID library is added at the beginning of the main program, and the code is as follows:
using UsbHid;
using UsbHid.USB.Classes.Messaging;
thus, the preparation work of the USB HID library is completed.
2.2 initialization of USB HID devices
Adding an initialization code of the USB device at the beginning of the program:
Device=new UsbHidDevice(0x0483,0x5850);
v/register a new USB HID device, VID 0x0483, PID 0x5850
The PID and VID must completely correspond to the code in the singlechip
Device.OnConnected+=DeviceOnConnected;
// registering the name of the processing function on a device connection as DeviceOnconnected
Device.OnDisConnected+=DeviceOnDisConnected;
// the name of the processing function when the registered device is disconnected is DeviceOnDisconnected
Device.DataReceived+=DeviceDataReceived;
// registration device receives data with the name of the processing function DeviceDataReceived
The initialization of the new device by the USB HID is completed.
If the VID and PID are the same and the connection is good, the device connection is automatically initialized. The data can be received through the DeviceDataReceived function.
2.3 automatic detection of USB HID devices
The connection of the USB equipment can be realized by calling a method of device.connect (), if the connection is successful, True is returned, otherwise false is returned.
A pool variable, i.e., pool DeviceConnected, is declared at the beginning of the code for storing the connection state of the device, false when the device is not connected, true when connected.
After the program runs, the USB HID equipment is automatically run for initialization, then whether the device is connected or not is judged by running the method of device.connect (), if the current equipment is not inserted, the device connected is false, then a timer is started, whether the device.connect () is connected or not is judged by executing the method of device.connect () once every second, if the device is connected, the timer is automatically closed, and the device connected is true.
When the USB device is unplugged, the function of DeviceOnDisconnected is automatically called, and the function of DeviceConnected is false. Therefore, the automatic plugging detection of the USB equipment can be realized.
2.4 data communication for USB HID devices
After the USB HID device establishes connection, if the device receives data, a DeviceDataReceived function is triggered, and when a Get _ Command (data) is called in the function, an array received by the USB is stored in the data.
Data transmission of the USB HID device is achieved by calling a device. sendmessage (command), where the command is an array of data to be transmitted.
3. Implementation of debug agent data translation component
The main work of the debugging agent is to convert the data reading command and the data writing command received from the USB interface into the data reading command and the data writing command of the display card driving program to the TCON, and to send back the received result in the reverse direction.
The format of the data received from the USB interface is as follows:
the USB data structure is as follows:
typedef struct_TYPE_USBDAT
{
Udata[0]=00;
udata [1] unidentified char Magic _ Tag; // head identification COMM _ TAG
Udata [2] unidentified char Ins; // instruction
Udata[3]unsigned char Addr_OSB;
Udata[4]unsigned char Addr_High;
Udata[5]unsigned char Addr_Mid;
Udata[6]unsigned char Addr_Low;
Udata [7] unidentified char Length; // data field Length
Udata [8] unidentified char ValDat [ REPORT _ COUNT-7 ]; // data field, max 64
}TYPE_USBDAT;
The format of the command to be converted is:
Read_AnxReg(Convert.ToByte(sliveID),offset,Dat_Length,ref Read_dat[0]);
the corresponding relation of each parameter is as follows:
sliveID=Udata[3](Addr_OSB)
converting int _ offset into Udata [4] < <16| Udata [5] < <8| Udata [6 ];
Dat_Length=Udata[7];
and after the format conversion is finished, calling the AUX to read data, and then returning the read data to the single chip microcomputer through the USB interface.
The conversion of the write command can refer to the conversion of the read command, and is not described herein again.
Example four
For the chip debugging agent device and the chip debugging method of the embodiment of the invention, the following modes can be referred for debugging agent software design and verification:
firstly, connecting a USB port of a logic analyzer with any USB port of a debugged host, starting logic analyzer software, seeing the prompts of equipment and connection ok, and correctly displaying the prompts of equipment, connection and extraction by plugging and unplugging equipment;
secondly, connecting a serial port-to-USB interface of the debugging board with a PC for debugging by using a USB cable, starting serial port terminal software, and seeing that a serial port is inserted;
then, a command '\\ mode 3' is input in the serial port terminal, and the USB mode is prompted to be switched into;
finally, the read and write register commands are tested in the serial port terminal, and the correct return value can be seen.
From the above operation results, it can be seen whether the work of the debug agent can achieve the debug target.
In addition, can also test original singlechip test function through debugging agent, specifically:
firstly, reading a test basic register, wherein the register is a non-DPCD register and can be read only by converting a DPCD address (a specific conversion method can be realized by adopting the existing method and is not described herein);
then, the read register segment address 0x7 and the register with offset 0x25 are sent in the command terminal, the read register value is seen to be 0x80, and according to the expectation, a 0xAA is written in the register with the register segment address 0xe and the offset 0x17, and the read returned value is the same as the written value;
and finally, testing the user function, inputting a command '\ show' into the command terminal, and seeing that the correct resolution information is obtained through the USB channel, thereby judging whether the original user function can normally work in a debugging agent mode.
In summary, the chip debug agent apparatus and the chip debug method according to the embodiments of the present invention have at least the following advantages:
the debugging technology of the TCON chip based on the debugging agent is realized, the communication between the debugged TCON chip and an external debugging machine is realized by using a computer USB interface and a singlechip as an intermediate circuit on the premise of not disassembling a liquid crystal screen, and a new USB agent debugging interface is connected to the existing debugging program;
meanwhile, the original debugging program can be used for debugging conveniently, and the liquid crystal display screen does not need to be disassembled completely, so that a brand-new debugging path is developed for the TCON chip.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A chip debug agent apparatus, comprising:
the single chip debugging board is used for debugging the debugged chip;
the upper computer is used for displaying debugging information;
the USB HID interface is used for connecting USB HID equipment;
the conversion serial port is used for converting the USB interface into an output serial port of the single chip debugging board so as to connect the upper computer and the single chip debugging board;
and the chip debugging interface is used for connecting the AUX interface of the debugged chip.
2. The apparatus of claim 1, wherein:
the USB HID device comprises a control endpoint, a receiving endpoint and a sending endpoint;
the control endpoint is used for transmitting USB HID device descriptors, chip reading commands or chip writing commands, the receiving endpoint is used for receiving chip data, and the sending endpoint is used for sending the chip data.
3. The apparatus of claim 1, wherein:
the USB HID interface is arranged on the single chip debugging board;
the USB HID interface is provided with a high-speed pin and a low-speed pin, and the high-speed pin or the low-speed pin is provided with a pull-up resistor;
when the USB HID equipment is not accessed, the high-speed pin and the low-speed pin are both at a low level; when the USB HID equipment is accessed, the high-speed pin or the low-speed pin is in a high level.
4. The apparatus of claim 1, further comprising:
and the screen interface is arranged on the single chip debugging board and used for connecting an external screen to display the connection information.
5. The apparatus of claim 1, further comprising a button, a dial-up switch, and an indicator light disposed on the single chip debug board.
6. A chip debug method applied to the chip debug agent apparatus according to any one of claims 1 to 5, comprising:
the single chip debugging board acquires a USB HID descriptor of the USB HID; wherein the USB HID device descriptor comprises a device descriptor, a configuration descriptor, an interface descriptor, an endpoint descriptor, a string descriptor, an HID descriptor, a report descriptor, and an entity descriptor;
the single chip debugging board initializes the USB HID equipment based on the USB HID descriptor and determines that an interface mode is a USB mode;
after the single chip debugging board starts a chip debugging program, the USB HID sends a chip reading command or a chip writing command to a debugged chip through a chip debugging interface;
and the USB HID sends the chip data obtained from the debugged chip to the single chip debugging board so as to finish debugging the debugged chip.
7. The chip debugging method of claim 6, wherein the monolithic debugging board obtains the USB HID descriptor of the USB HID, and the method further comprises the following steps:
and the single chip debugging board regularly inquires the connected USB HID and stores the connection state of the USB HID.
8. The chip debugging method of claim 6, wherein the USB HID sends the chip read command or the chip write command to the debugged chip through the chip debugging interface, and the method comprises the following steps:
the USB HID receives a data reading command or a data writing command;
the USB HID converts the data reading command or the data writing command into a chip reading command or a chip writing command;
and the USB HID sends the chip reading command or the chip writing command to a debugged chip through a chip debugging interface.
9. The chip debugging method of claim 8, wherein the sending the chip read command or the chip write command to the debugged chip by the USB HID through a chip debugging interface comprises:
the control endpoint of the USB HID sends the chip reading command to the debugged chip through a chip debugging interface so as to read the chip data from the register of the debugged chip; or
And the control endpoint of the USB HID equipment sends the chip write-in command to the debugged chip through the chip debugging interface so as to write register configuration into the debugged chip.
10. The chip debugging method of claim 6, wherein the sending, by the USB HID device, the chip data obtained from the debugged chip to the single chip debugging board comprises:
a receiving endpoint of the USB HID receives chip data read from a register of a debugged chip and stores the chip data into a USB cache region in a USB array form; the USB array is defined with a structure body pointer, and the structure body pointer points to the USB cache region;
the sending end of the USB HID device sends the chip data of the USB cache area to the single chip debugging board; the chip data comprises a data valid bit mark, a command bit, a target address bit to be operated by reading and writing, a length bit to be operated by reading and writing and a variable data bit.
CN202110022995.1A 2021-01-08 2021-01-08 Chip debugging agent device and chip debugging method Pending CN112631851A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110022995.1A CN112631851A (en) 2021-01-08 2021-01-08 Chip debugging agent device and chip debugging method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110022995.1A CN112631851A (en) 2021-01-08 2021-01-08 Chip debugging agent device and chip debugging method

Publications (1)

Publication Number Publication Date
CN112631851A true CN112631851A (en) 2021-04-09

Family

ID=75293836

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110022995.1A Pending CN112631851A (en) 2021-01-08 2021-01-08 Chip debugging agent device and chip debugging method

Country Status (1)

Country Link
CN (1) CN112631851A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115033444A (en) * 2022-08-10 2022-09-09 合肥健天电子有限公司 8051 core-based online debugging circuit control device and control method
US11573871B2 (en) * 2019-05-08 2023-02-07 Yealink (Xiamen) Network Technology Co., Ltd. Debugging method for USB device and USB device
CN116204429A (en) * 2023-02-21 2023-06-02 深圳市道旅旅游科技股份有限公司 Code organization and debugging method, system and storage medium thereof

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102087624A (en) * 2009-12-02 2011-06-08 上海摩波彼克半导体有限公司 Circuit structure and method for realizing USB interface functional verification test on the basis of FPGA module
CN105740117A (en) * 2016-01-29 2016-07-06 硅谷数模半导体(北京)有限公司 Chip debugging method and apparatus
CN106710496A (en) * 2017-01-18 2017-05-24 深圳市视显光电技术有限公司 Device and method for online debugging of parameters of LCD logic board
CN110825567A (en) * 2019-07-17 2020-02-21 深圳芯智汇科技有限公司 Test system and test method of audio chip

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102087624A (en) * 2009-12-02 2011-06-08 上海摩波彼克半导体有限公司 Circuit structure and method for realizing USB interface functional verification test on the basis of FPGA module
CN105740117A (en) * 2016-01-29 2016-07-06 硅谷数模半导体(北京)有限公司 Chip debugging method and apparatus
CN106710496A (en) * 2017-01-18 2017-05-24 深圳市视显光电技术有限公司 Device and method for online debugging of parameters of LCD logic board
CN110825567A (en) * 2019-07-17 2020-02-21 深圳芯智汇科技有限公司 Test system and test method of audio chip

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
姚文星: "基于JTAG的多核DSP调试系统的研究与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 15 March 2017 (2017-03-15), pages 135 - 622 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11573871B2 (en) * 2019-05-08 2023-02-07 Yealink (Xiamen) Network Technology Co., Ltd. Debugging method for USB device and USB device
CN115033444A (en) * 2022-08-10 2022-09-09 合肥健天电子有限公司 8051 core-based online debugging circuit control device and control method
CN115033444B (en) * 2022-08-10 2022-11-15 合肥健天电子有限公司 8051 core-based online debugging circuit control device
CN116204429A (en) * 2023-02-21 2023-06-02 深圳市道旅旅游科技股份有限公司 Code organization and debugging method, system and storage medium thereof
CN116204429B (en) * 2023-02-21 2023-12-08 深圳市道旅旅游科技股份有限公司 Code organization and debugging method, system and storage medium thereof

Similar Documents

Publication Publication Date Title
CN112631851A (en) Chip debugging agent device and chip debugging method
USRE44628E1 (en) System and method for expansion of a computer
US5619659A (en) System for extending ISA bus without using dedicated device driver software by using E2 P2 interface which provides multiplexed bus signal through standard parallel port connector
US5519851A (en) Portable PCMCIA interface for a host computer
US7921244B2 (en) Data sharing and transfer systems and methods
EP2040174B1 (en) Card-type peripheral device
US6618773B1 (en) Receiving a particular identification file among an analog identification file and a digital identification file in response to a request to a dual-interface monitor
US6016518A (en) Automatic master/slave designation for computer peripherals
JP2004227588A (en) Sdio card development system
TWI760615B (en) Method for performing detect control of write protection command of memory device, associated control chip and associated electronic device
US7334054B2 (en) Video detection using display data channel
US6148384A (en) Decoupled serial memory access with passkey protected memory areas
KR20030074828A (en) A method of enabling a port in a computing device
US6526525B1 (en) PCI debugging device, method and system
US5664198A (en) High speed access to PC card memory using interrupts
US6807629B1 (en) Apparatus and method for accessing POST 80h codes via a computer port
KR20030048415A (en) Streamlining ata device initialization
KR100801759B1 (en) Device and system for debugging device using control bus
CN110765060B (en) MDIO bus-to-parallel bus conversion method and device, equipment and medium
US20040049665A1 (en) Trace control circuit adapted for high-speed microcomputer operation
USRE39052E1 (en) System and method for expansion of a computer
CN213365381U (en) Main board
CN109783407B (en) Device and method for realizing PC and display card bridging based on FPGA
CN107704417A (en) The method and its communication system to be communicated with equipment under test
CN111459736A (en) Plate electrode debugging method of video processing chip

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination