[go: up one dir, main page]

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

Chip debugging agent device and chip debugging method Download PDF

Info

Publication number
CN112631851B
CN112631851B CN202110022995.1A CN202110022995A CN112631851B CN 112631851 B CN112631851 B CN 112631851B CN 202110022995 A CN202110022995 A CN 202110022995A CN 112631851 B CN112631851 B CN 112631851B
Authority
CN
China
Prior art keywords
chip
debugging
usb
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.)
Active
Application number
CN202110022995.1A
Other languages
Chinese (zh)
Other versions
CN112631851A (en
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/CN112631851B/en
Publication of CN112631851A publication Critical patent/CN112631851A/en
Application granted granted Critical
Publication of CN112631851B publication Critical patent/CN112631851B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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 embodiment of the chip debug agent device comprises: the singlechip 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 being connected with USB HID equipment; the conversion serial port is used for converting the USB interface into an output serial port of the singlechip debugging board so as to connect the upper computer and the singlechip debugging board; the chip debugging interface is used for connecting with an AUX interface of the debugged chip. According to the embodiment, the GPIO signals output by the TCON chip can be measured and debugged on the premise that the liquid crystal screen is not disassembled.

Description

Chip debugging agent device and chip debugging method
Technical Field
The present invention relates to the field of electronic technologies, and in particular, to a chip debug agent device and a chip debug 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 an image data input signal (the input signal comprises three signals of a color data signal, a clock signal and a control signal) sent by the digital board into an LVDS (low voltage differential signal) capable of driving the liquid crystal display after being processed by the logic board, and then directly sending the LVDS signal to the LVDS receiving chip of the liquid crystal display. The image data signals are stored by the processing shift register, the clock signals are converted into control signals which can be identified by the screen, and the row-column signals control the MOSFET (metal oxide semiconductor field effect transistor) in the screen 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 display technology. The debugging means of TCON chips are 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 meanwhile, the read register is used for checking the working state of the TCON chip, and another important task is to measure a liquid crystal time sequence control signal (GPIO signal) of an output end.
Generally, TCON chips are all packaged with a bus controller, i.e., an I2C interface, which has two functions, one for reading data from the external E2RPOM (a memory that is electrically erasable and electrically writeable on line), and the other for modifying the configuration as an internal register. In the process of designing and debugging a liquid crystal display, a TCON chip is in a bare state, the TCON chip is easy to be physically connected, the debugging mode at the moment is simpler, the register can be read and written only by connecting a singlechip debugging board with an I2C interface of the TCON chip, and the output GPIO signal is usually measured by connecting a logic analyzer or an oscilloscope with the output of the TCON chip.
As shown in fig. 1, for a notebook computer with a mounted casing, debugging is very inconvenient, the I2C interface channel for reading the register originally cannot be physically connected, and the audio bidirectional data channel in a DisplayPort (display interface) can be left for reading the register, and the channel needs to be supported by the bottom display card driver of a manufacturer. A software is usually developed on a personal computer, and the register of the TCON chip is read and written by calling a graphics card driver.
The debugging mode has the following defects:
1. operation must be performed under the condition that the display of the liquid crystal display is normal;
2. in some cases, the liquid crystal display screen cannot be used, for example, 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 the test program can be used only after being transplanted into a personal computer program;
4. For the notebook computer with the installed shell, when the output time sequence signal is measured, the liquid crystal panel can only be disassembled to expose the printed circuit board where the TCON chip is located, and the fly line connection can be realized.
Therefore, in order to overcome the above disadvantages, a new debugging method needs to be provided, and a set of debugging agents is developed, so that chip debugging can be realized without disassembling the notebook shell, and the existing debugging means, namely, the single-chip microcomputer debugging board is utilized for debugging, so that the original debugging program of the single-chip microcomputer can be completely operated.
Disclosure of Invention
The invention aims to solve the technical problems that: 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 of not disassembling a liquid crystal module through the debugging agent, the existing debugging program can be compatible, and an indiscriminate debugging scheme is provided.
In order to solve the above technical problems, the present invention provides a chip debug agent device, including:
the singlechip 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 being connected with USB HID equipment;
The conversion serial port is used for converting the USB interface into an output serial port of the singlechip debugging board so as to connect the upper computer and the singlechip debugging board;
the chip debugging interface is used for connecting with an AUX interface of the debugged chip.
Preferably, the USB HID device comprises a control endpoint, a receiving endpoint and a transmitting endpoint;
The control endpoint is used for transmitting a USB HID device descriptor, a chip reading command or a chip writing command, the receiving endpoint is used for receiving chip data, and the transmitting endpoint is used for transmitting the chip data.
Preferably, the method comprises the steps of,
The USB HID interface is arranged on the singlechip 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 device is not accessed, the high-speed pin and the low-speed pin are both in a low level; when the USB HID device is accessed, the high-speed pin or the low-speed pin is at a high level.
Preferably, the method further comprises:
the screen interface is arranged on the singlechip debugging board and used for being connected with an external screen to display connection information.
Preferably, the single chip microcomputer debugging board also comprises keys, a dial switch and an indicator lamp which are arranged on the single chip microcomputer 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 singlechip 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 character string descriptor, an HID descriptor, a report descriptor and an entity descriptor;
The singlechip debugging board initializes the USB HID based on the USB HID descriptor and determines an interface mode as a USB mode;
After the singlechip debugging board starts a chip debugging program, the USB HID device sends a chip reading command or a chip writing command to a debugged chip through a chip debugging interface;
and the USB HID device sends the chip data obtained from the debugged chip to the singlechip debugging board so as to complete the debugging of the debugged chip.
Preferably, the singlechip debugging board acquires a USB HID descriptor of the USB HID, and the method further comprises the following steps:
And the singlechip debugging board queries the connected USB HID device at fixed time and stores the connection state of the USB HID device.
Preferably, the USB HID device sends a chip read command or a chip write command to a debugged chip through a chip debug interface, including:
The USB HID receives a data reading command or a data writing command;
the USB HID device converts the data reading command or the data writing command into a chip reading command or a chip writing command;
and the USB HID device sends the chip reading command or the chip writing command to the debugged chip through a chip debugging interface.
Preferably, the USB HID device sends the chip read command or the chip write command to the debugged chip through a chip debug interface, including:
the control endpoint of the USB HID device sends the chip reading command to the debugged chip through a chip debugging interface so as to read chip data from a register of the debugged chip; or (b)
And the control endpoint of the USB HID device sends the chip writing command to the debugged chip through the chip debugging interface so as to write the register configuration to the debugged chip.
Preferably, the USB HID device sends chip data obtained from a debugged chip to the singlechip debug board, including:
The receiving endpoint of the USB HID receives the chip data read from the register of the debugged chip, and stores the chip data in a USB cache area in the form of a USB array; wherein, the USB array defines a structure pointer, and the structure pointer points to the USB buffer area;
the transmitting terminal point of the USB HID transmits the chip data of the USB buffer area to the singlechip debugging board; the chip data comprises a data valid bit mark, a command bit, a target address bit to be operated for reading and writing, a length bit to be operated for reading and writing and a variable data bit.
The chip debugging agent device and the chip debugging method have the following beneficial effects:
The TCON chip debugging technology based on the debugging agent is realized, the communication between the debugged TCON chip and an external debugging machine can be 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 an existing debugging program. Meanwhile, the original debugging program can be utilized to conveniently debug, and a liquid crystal screen is not required 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 in accordance with an embodiment of the present invention;
FIG. 3 is a functional block diagram of the 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 single-chip debug board that can be referred to;
FIG. 5 is a circuit diagram of a USB communication part of a referenceable singlechip debug board;
FIG. 6 is a circuit diagram of a USB-to-serial port portion of a single chip debug board that can be referred to;
FIG. 7 is a schematic diagram of a chip debug method according to an embodiment of the present invention;
FIG. 8 shows a singlechip program structure with a USB interface added;
FIG. 9 is a diagram of a referenceable host interface layout;
FIG. 10 is a block diagram of version C# of a USB HID library that can be referenced.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
As shown in fig. 2 and 3, a chip debug agent apparatus provided in an embodiment of the present invention includes: the system comprises a singlechip debugging board, an upper computer, a USB HID interface, a conversion serial port and a chip debugging interface. The singlechip debugging board is used for debugging the debugged chip; the upper computer is used for displaying debugging information; the USB HID interface is a device interface and is used for being connected with USB HID devices; the conversion serial port is used for converting the USB interface into an output serial port of the singlechip debugging board, so as to connect the upper computer and the singlechip debugging board; the chip debug interface (I2C interface) is used to connect with the AUX interface (audio input interface) of the chip to be debugged.
The debugging of the debugged chip (TCON chip) is originally connected with the singlechip debugging board through the I2C interface, and all debugging programs are well developed in the singlechip. After the liquid crystal screen is installed, only an AUX channel (namely an AUX interface) is left between the TCON chip and an external two-way communication port, and in order to continuously use a developed singlechip debugging program, a data channel communicated with the singlechip is required to be established by using the AUX channel, which is the function to be realized by the invention. At the computer end, the bottom layer driving program can be used for reading and writing the register of the TCON chip through the AUX channel, if the data of the program can be forwarded to the singlechip program, the program is called as a debugging agent upper computer program, the communication between the upper computer program and the singlechip is realized, the existing singlechip debugging board is required to be improved, a USB (universal serial bus) interface is added, and the upper computer program is connected with the singlechip through the USB interface. Thus, the upper computer program establishes a communication channel between the singlechip and the TCON chip through the AUX interface and the USB interface. The method comprises the steps that a singlechip program is modified to redirect a command which is originally accessed to a register through an I2C interface to a USB interface, and a debugging agent upper computer program is responsible for forwarding the command of the singlechip to a TCON chip and forwarding returned data to the singlechip, namely the overall design thought of debugging agent software and hardware of the TCON chip.
As a preferred embodiment, the CPU on the debug agent hardware circuitry (i.e. the single chip debug board of the chip debug agent device) may select the STM32f103 chip. STM32f103 is abbreviated as STM32, is a 32-bit processor based on ARM Cortex-M3 kernel, and has strong performance, outstanding power consumption control and numerous peripheral devices.
Fig. 4 shows a circuit diagram of a core part of a single chip debug board. Fig. 4 provides a partial wiring layout manner of the STM32f103 chip, and reference numerals and pins in the drawings may refer to an instruction book or a general explanation, 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 device, and the USB HID device 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 endpoint is used for receiving the chip data; the transmitting endpoint is used for transmitting the chip data.
In an embodiment of the present invention, the USB HID interface may be disposed on a single chip debug board, and a high-speed pin and a low-speed pin are disposed on the USB HID interface, and the high-speed pin or the low-speed pin is provided with a pull-up resistor.
Fig. 5 shows a circuit diagram of a USB communication part of a single chip debug board. Fig. 5 provides a wiring layout manner of a USB communication portion of the STM32f103 chip, and reference numerals and pins in the drawing may refer to an instruction book or a general explanation, which is not repeated in the embodiments of the present invention.
Fig. 6 shows a circuit diagram of a conversion serial port portion of a single chip debug board. Fig. 6 provides a layout manner of a USB-to-serial circuit design of a STM32f103 chip, and reference numerals and pins in the drawing may refer to a tool book or a general explanation, which is not repeated in the embodiments of the present invention.
When the method is applied, a chip of the USB-to-serial port can be selected as the conversion serial port (namely, the USB-to-serial port), and the chip is used for the USB interface to realize the USB-to-serial port, so that codes can be downloaded through the USB interface, the serial port can be debugged, and the like.
In addition, the chip debugging agent device of the embodiment of the invention can further comprise a screen interface, keys, a dial switch and an indicator lamp.
The screen interface, the keys, the dial switch and the indicator lamp can be arranged on the singlechip debugging board. Thus, in a specific application, the functions that the chip debug agent device can cover are:
the singlechip 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 control part directly takes power from the USB interface.
Reserved part of keys, key switches (i.e. dial switches) and indicator Lamps (LEDs)
Providing a set of I2C pins (i.e., chip debug interface) for direct connection to TCON for register debug
A screen interface is reserved for connecting to an external screen for displaying simple connection information etc., for example, an Organic Light Emitting Diode (OLED) may be connected.
Example two
As shown in fig. 7, the embodiment of the present invention further provides a chip debug method, which is applied to the chip debug agent device of the first embodiment, and mainly includes the following steps:
step S701, the singlechip debugging board acquires a USB HID descriptor of the USB HID.
USB HID devices are a class of man-machine interoperable devices used to control some aspects of computer operation.
The chip debugging proxy device of the embodiment of the invention is only used as a data transmission channel, wherein one end is a USB-to-serial port, so that the speed is not more than 200kbps at maximum, the type of the USB HID device is very suitable, the device can be directly used without installing a driver, and for an STM32 singlechip, a manufacturer provides a standard USB library, so that the USB HID device can be directly realized by using the standard library (namely the USB library) of the manufacturer.
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 singlechip debugging board) acquires the information of the USB HID through the USB HID descriptor of the USB HID. Standard USB devices have 5 USB descriptors: device descriptor, configuration descriptor, interface descriptor, endpoint descriptor, string descriptor. In addition to some descriptors defined by the standard, the USB HID device also includes 3 HID device class specific descriptors: HID descriptor, report descriptor, entity descriptor.
The USB descriptors are described in detail in the standard library, and will not be described in detail. The STM32 USB library used in connection with the embodiment of the invention explains the parts to be modified:
1. Device descriptor
A USB device has only one device descriptor. The information mainly recorded by the device descriptor is as follows: the USB protocol version number used by the device, the device type, the maximum packet size of 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 Vendor ID (VID) and a product identification code (PID), a host distinguishes different devices through different VIDs and PIDs, the VIDs and the PIDs are two bytes long, the Vendor ID (VID) is applied to a USB executive forum by a vendor, the VID of each vendor is unique, the PID is determined by the vendor at the discretion, in theory, different products, different models of the same products and products of different designs of the same models adopt different PIDs so as to distinguish different devices of the same manufacturer, and the test device related to the embodiment of the invention can directly use the code number 0x0483 of the manufacturer.
2. Configuration descriptor set
The set of configuration descriptors includes configuration descriptors, interface descriptors, class-specific descriptors (here representing HID descriptors), and endpoint descriptors. Wherein the configuration descriptor section may essentially use the example code default values without modification.
3. String descriptor
The string descriptor is mainly the display name of the device, which can be seen in the device manager, so that correct modification of the string descriptor helps to distinguish between the various HID devices connected on the computer.
In addition, regarding the view of the USB HID device, the modified STM32 code can be compiled and burned into hardware and connected to a host computer, the machine automatically prompts the installation of the USB HID device, and after the installation, the corresponding device information can be viewed from a device manager and is identical with the set device information in the code.
In an embodiment of the present invention, before implementing step S701, the method may further include: the singlechip debugging board regularly inquires the connected USB HID equipment and stores the connection state of the USB HID equipment.
Regarding automatic detection of the USB HID device, when the step is realized by the code, connection of the USB device can be realized by calling a device. A boot variable, bool DeviceConnected, is declared at the beginning of the code to store the connection state of the device, false when the device is not connected, true when connected.
After the program is run, the USB HID device is automatically run for initialization, then whether connection is carried out is judged by a method for running device.connect (), if the current device is not inserted, deviceConnected =false, then a timer is started, whether connection is carried out is judged by a method for executing device.connect (), if connection is carried out, the timer is automatically closed, and DeviceConnected =true. When the USB device is unplugged, a DeviceOnDisConnected function is automatically called, deviceConnected =false in the function. Thus, automatic plug detection of the USB equipment can be realized.
Step S702, the singlechip debugging board initializes the USB HID based on the USB HID descriptor, and determines that the interface mode is a USB mode.
After the singlechip debugging board is electrified, the USB function module needs to be initialized to work, and besides the corresponding clock and the corresponding interrupt, the corresponding function module is enabled, the endpoint of the USB device needs to be initialized, namely the USB HID device is initialized.
In the chip debugging method of the embodiment of the invention, the original program needs to be compatible with the new function USB interface function, and the program structure is shown in fig. 8 (only comprises a register read-write part). At this time, the main function terminal mode command can be modified, and when the user parameter is 3, the USB mode is converted, and a corresponding prompt is given. In the general read-write function of interface layer, the support of USB mode is added, mainly two functions are added, one is a read register function, when judging that the mode is USB mode, the USB mode is called to read register command. The other is a write register function, and when the mode is judged to be the USB mode, a USB mode write register command is invoked.
When the code implements this step, reference may be made to the following examples:
the initialization code of the USB device is added 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 correspond to the codes in the SCM
Device.OnConnected+=DeviceOnConnected;
The name of the processing function when the// registration device is connected is DeviceOnConnected
Device.OnDisConnected+=DeviceOnDisConnected;
The name of the processing function when the// registration device is disconnected is DeviceOnDisConnected
Device.DataReceived+=DeviceDataReceived;
The name of the processing function when the data is received by the// registration device is DEVICEDATARECEIVED
The initialization of the new device of the USB HID is completed.
If the VID and the PID are the same and the equipment is well connected, the automatic initialization of the equipment connection is finished. At this point, the reception of data may be accomplished by the DEVICEDATARECEIVED function.
In step S703, after the 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 device converts the data reading command or the data writing command into a chip reading command or a chip writing command; the USB HID device 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, by the USB HID device, a chip read command or a chip write command to the debugged chip through the chip debug interface may be implemented in the following manner: the control endpoint of the USB HID sends a chip reading command to the debugged chip through the chip debugging interface so as to read chip data from a register of the debugged chip; or the control endpoint of the USB HID sends a chip writing command to the debugged chip through the chip debugging interface so as to write the register configuration to the debugged chip.
According to the chip debugging method provided by the embodiment of the invention, USB reading (namely reading chip data) and writing functions (namely chip writing commands) in the reading and writing commands can be realized through the USB interface function.
Regarding the USB read function, firstly, the address and the data length to be read are filled into the USB buffer through the structure pointer, then, the USB send command is invoked to send out the USB buffer data, then, the USB receive flag is polled, if the data is received, the validity of the data is judged, if the data is correct, the data in the buffer is read, and if the data is correct, the data in the buffer is returned.
It should be noted that, because of the polling method, if the USB device does not reply, the program will enter a dead loop, so it is necessary to add a timeout judgment, if any USB data is not received beyond a certain set time, exit, and return a timeout error.
Regarding the USB write function, firstly, the address, the data length and the data to be written are filled into the USB buffer through the structure pointer, then the USB transmission command is invoked to transmit the USB buffer data, then the USB reception flag is polled, if the data is received, the validity of the data is judged, if the data is the correct ACK, if so, 0 is returned.
Note that, as with the read command, the timeout judgment is increased due to the polling manner.
Step S704, the USB HID device sends the chip data obtained from the debugged chip to the singlechip debugging board so as to complete the debugging of the debugged chip.
The debugging agent works as communication conversion mainly for two operations of reading and writing. 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 judging whether or not it is a correct data packet;
2. the command bits, in addition to containing reads and writes, need to contain ACK commands to respond if the operation was successful;
3. Reading and writing target address bits to be operated;
4. reading and writing length bits to be operated on;
5. Variable data bits.
According to the above requirements, the data format design is shown in table 1.
TABLE 1
In the embodiment of the invention, the step of sending the chip data obtained from the debugged chip to the singlechip debugging board by the USB HID device can be realized by adopting the following modes: the receiving endpoint of the USB HID receives the chip data read from the register of the debugged chip, and stores the chip data in a USB cache area in the form of a USB array; the sending terminal point of the USB HID device sends the chip data of the USB buffer area to the singlechip debugging board.
In a specific application, the USB data endpoint 1 (i.e. the receiving endpoint) may have a receiving buffer with a length of 64 bytes, and when the USB reception interrupt arrives, the ep1_out_ Callback (void) callback function is automatically called to copy the data received by the USB to a specified location. In the program, the usb_received_flag is queried, and when usb_received_flag=1, the usb_received_buffer stores the currently Received USB packet, which has a fixed length of 64 bytes.
For letting USB data endpoint 2 (i.e. the transmitting endpoint), the transmission of USB data may refer to the following steps:
1. Copying data to be transmitted to a buffer area;
2. Setting a transmission size;
3. starting transmission;
4. Waiting for the transmission to be completed.
The data buffer of the USB (i.e. the USB buffer) is actually an array, and in order to enable simpler operation of this array, the data structure of the USB may be declared as a structure, where the USB data structure is as follows:
At the same time, a structure pointer is declared and is pointed to the USB buffer, so that the data can be operated by the structure pointer. The method comprises the following 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 implementation of the upper computer debugging agent may refer to the following manner:
C# program interface implementation
In the embodiment of the invention, the development of the debugging agent is focused on calling the code written in C++, and the performance is not a priority problem to be considered when a simple interface is to be developed, so that C# becomes the first choice. C++ is inheritance of a C language (a procedural and abstract general programming language), and can perform procedural programming of the C language, object-based programming with abstract data types as characteristics, and object-oriented programming with inheritance and polymorphism as characteristics. C# is a secure, stable, simple, elegant, object-oriented programming language derived from C and C++. The great benefit of choosing C# for development of the upper computer is that the interface design is very simple, and the design is carried out based on the UI dragging mode completely.
The program interface layout is shown in FIG. 9, where the rear of the window name "ANX-DebugAgent V0.1" would indicate whether the debug agent hardware device was connected.
The drop-down box currently selected as Intel eDP on the user interface is used for selecting a communication port, because DisplayPort is divided into DP (notebook expansion output standard interface) and eDP (notebook internal output standard interface), and the user interface is also supported by Intel drivers, so that the drop-down box is commonly selected by users, and for the debug agent of the embodiment of the present invention, the debug agent is mainly used for supporting the application of eDP, and therefore defaults to be the eDP interface. And a selectable box "Show Debug info" is provided below the drop down box for selecting whether to display Debug information.
The "TEST READ DPCD" button is a button for testing and reading DPCD (register) for testing whether the current program can correctly read data in DPCD, and may separately test the channel for data reading inside the debug agent.
The 'Clear Debug Windows' button is used for clearing window data, and the window part is used for displaying debugging information, when the debugging agent works, the window can display a read or write command received from the singlechip and also can display a data return value read from the DPCD.
The "Start Console" button is to launch a Console window that belongs to a function of the extra attachment for command line mode data reading.
C# calls DLL (library) to realize USB data communication
The communication between the C# and the USB HID interface is complex compared with the communication between the C# and the serial port, and the data communication can be performed by using a mode based on the USB HID library, so long as the interface call 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. Run c# may generate a solution, i.e., a usbhid.
In Hid.cs, there is a function interface that defines the DLL file to be called by external programs by means of DLLImport. Examples of function interface code are 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 generating DLL, copying UsbHid.dll file to debug directory (system debug folder) of item (namely USB HID library), so that the needed DLL file can be found when the program runs, and adding reference of USB HID library at the beginning of main program, the code is as follows:
using UsbHid;
using UsbHid.USB.Classes.Messaging;
Thus, the preparation of the USB HID library is completed.
2.2 Initialization of USB HID device
The initialization code of the USB device is added 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 correspond to the codes in the SCM
Device.OnConnected+=DeviceOnConnected;
The name of the processing function when the// registration device is connected is DeviceOnConnected
Device.OnDisConnected+=DeviceOnDisConnected;
The name of the processing function when the// registration device is disconnected is DeviceOnDisConnected
Device.DataReceived+=DeviceDataReceived;
The name of the processing function when the data is received by the// registration device is DEVICEDATARECEIVED
The initialization of the new device of the USB HID is completed.
If the VID and the PID are the same and the equipment is well connected, the automatic initialization of the equipment connection is finished. At this point, the reception of data may be accomplished by the DEVICEDATARECEIVED function.
2.3 Automatic detection of USB HID devices
The connection of the USB device can be realized by calling a device.
A boot variable, bool DeviceConnected, is declared at the beginning of the code to store the connection state of the device, false when the device is not connected, true when connected.
After the program is run, the USB HID device is automatically run for initialization, then whether connection is carried out is judged by a method for running device.connect (), if the current device is not inserted, deviceConnected =false, then a timer is started, whether connection is carried out is judged by a method for executing device.connect (), if connection is carried out, the timer is automatically closed, and DeviceConnected =true.
When the USB device is unplugged, a DeviceOnDisConnected function is automatically called, deviceConnected =false in the function. Thus, automatic plug detection of the USB equipment can be realized.
2.4 Data communication of USB HID device
After the USB HID device establishes a connection, if the device receives data, a DEVICEDATARECEIVED function is triggered, and when get_Command (data) is called in the function, an array received by the USB is stored into the data.
The data transmission of the USB HID device is realized by calling a device. SendMessage (command) method, wherein command is an array of data to be transmitted.
3. Implementation of debug agent data conversion section
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 driver to the TCON and to send the returned result back.
The data format received from the USB interface is:
the USB data structure is as follows:
typedef struct_TYPE_USBDAT
{
Udata[0]=00;
Udata [1]unsigned char Magic_Tag; the/(header identification commtag)
Udata [2]unsigned char Ins; instruction/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]unsigned char Length; data field length
Udata [8]unsigned char ValDat[REPORT_COUNT-7]; data field, max 64
}TYPE_USBDAT;
The command format 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= Udata < 4 > <16|udata [5] <8|udata [6];
Dat_Length=Udata[7];
And calling AUX to read data after format conversion is completed, and then returning the read data to the singlechip through the USB interface.
The conversion manner of the write command may refer to the conversion manner of the read command, which is not described herein.
Example IV
For the chip debug agent device and the chip debug method of the embodiment of the invention, the design and verification of debug agent software can refer to the following modes:
firstly, connecting a USB port of a logic analyzer with any USB port of a debugged host, starting logic analyzer software, and enabling a user to see prompts of equipment and connection ok, wherein the plug equipment can correctly display the prompts of equipment, connection and extraction;
Secondly, connecting a serial port of the debugging board with a USB interface and a debugging PC by using a USB wire, starting serial port terminal software, and observing that the serial port is inserted;
Then, inputting a command "\mode 3" into the serial port terminal, and prompting to switch to a USB mode;
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 debugging agent works to achieve the debugging target.
In addition, the original singlechip test function can be tested through the debugging agent, and specifically:
Firstly, the basic register is tested for reading, and the part of the basic register is a non-DPCD register and can be read only by converting DPCD addresses (the specific conversion method can be realized by adopting the existing mode and is not repeated here);
then, the register segment address 0x7 and the register with the offset of 0x25 are read in the command terminal, the read register value is 0x80, the expected value is met, a 0xAA is written in the register segment address 0xe and the register with the offset of 0x17, and the read returned value is the same as the written value;
Finally, the user function is tested, a command 'show' is input into the command terminal, and the correct resolution information can be obtained through the USB channel, so that whether the original user function can normally work in the debugging proxy mode is judged.
In summary, the chip debug agent device and the chip debug method according to the embodiments of the present invention have at least the following advantages:
The TCON chip debugging technology based on the debugging agent is realized, the communication between the debugged TCON chip and an external debugging machine can be 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 utilized to conveniently debug, and a liquid crystal screen is not required 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 embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the 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 scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. The chip debugging method is applied to the chip debugging proxy device and is characterized by comprising the following steps of:
The chip debugging agent device comprises a singlechip debugging board and is used for debugging a debugged chip; the upper computer is used for displaying debugging information; the USB HID interface is used for being connected with USB HID equipment; the conversion serial port is used for converting the USB interface into an output serial port of the singlechip debugging board so as to connect the upper computer and the singlechip debugging board; the chip debugging interface is used for connecting an AUX interface of the debugged chip;
The singlechip 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 character string descriptor, an HID descriptor, a report descriptor and an entity descriptor;
The singlechip debugging board initializes the USB HID based on the USB HID descriptor and determines an interface mode as a USB mode;
After the singlechip debugging board starts a chip debugging program, the USB HID device sends a chip reading command or a chip writing command to a debugged chip through a chip debugging interface;
and the USB HID device sends the chip data obtained from the debugged chip to the singlechip debugging board so as to complete the debugging of the debugged chip.
2. The chip debugging method according to 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 a USB HID device descriptor, a chip reading command or a chip writing command, the receiving endpoint is used for receiving chip data, and the transmitting endpoint is used for transmitting the chip data.
3. The chip debugging method according to claim 1, wherein:
The USB HID interface is arranged on the singlechip 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 device is not accessed, the high-speed pin and the low-speed pin are both in a low level; when the USB HID device is accessed, the high-speed pin or the low-speed pin is at a high level.
4. The chip debug method of claim 1, further comprising:
the screen interface is arranged on the singlechip debugging board and used for being connected with an external screen to display connection information.
5. The chip debugging method according to claim 1, further comprising a key, a dial switch and an indicator light arranged on the singlechip debugging board.
6. The chip debugging method of claim 1, wherein the single chip microcomputer debugging board obtains a USB HID device descriptor of the USB HID device, further comprising:
And the singlechip debugging board queries the connected USB HID device at fixed time and stores the connection state of the USB HID device.
7. The chip debugging method according to claim 1, wherein the USB HID device sends a chip read command or a chip write command to the debugged chip through a chip debugging interface, comprising:
The USB HID receives a data reading command or a data writing command;
the USB HID device converts the data reading command or the data writing command into a chip reading command or a chip writing command;
and the USB HID device sends the chip reading command or the chip writing command to the debugged chip through a chip debugging interface.
8. The chip debug method of claim 7, wherein the USB HID device sends the chip read command or the chip write command to a debugged chip through a chip debug interface, comprising:
the control endpoint of the USB HID device sends the chip reading command to the debugged chip through a chip debugging interface so as to read chip data from a register of the debugged chip; or (b)
And the control endpoint of the USB HID device sends the chip writing command to the debugged chip through the chip debugging interface so as to write the register configuration to the debugged chip.
9. The chip debugging method of claim 1, wherein the USB HID device sends chip data obtained from a debugged chip to the singlechip debugging board, comprising:
The receiving endpoint of the USB HID receives the chip data read from the register of the debugged chip, and stores the chip data in a USB cache area in the form of a USB array; wherein, the USB array defines a structure pointer, and the structure pointer points to the USB buffer area;
the transmitting terminal point of the USB HID transmits the chip data of the USB buffer area to the singlechip debugging board; the chip data comprises a data valid bit mark, a command bit, a target address bit to be operated for reading and writing, a length bit to be operated for reading and writing and a variable data bit.
CN202110022995.1A 2021-01-08 2021-01-08 Chip debugging agent device and chip debugging method Active CN112631851B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110022995.1A CN112631851B (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 CN112631851B (en) 2021-01-08 2021-01-08 Chip debugging agent device and chip debugging method

Publications (2)

Publication Number Publication Date
CN112631851A CN112631851A (en) 2021-04-09
CN112631851B true CN112631851B (en) 2024-07-16

Family

ID=75293836

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN112631851B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110175139B (en) * 2019-05-08 2021-01-05 厦门亿联网络技术股份有限公司 Universal debugging method for USB (Universal Serial bus) equipment and USB equipment
CN115033444B (en) * 2022-08-10 2022-11-15 合肥健天电子有限公司 8051 core-based online debugging circuit control device
CN116204429B (en) * 2023-02-21 2023-12-08 深圳市道旅旅游科技股份有限公司 Code organization and debugging method, system and storage medium thereof

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102087624B (en) * 2009-12-02 2013-07-24 上海摩波彼克半导体有限公司 Circuit structure and method for realizing USB interface functional verification test on the basis of FPGA module
CN104239175B (en) * 2014-09-05 2016-08-24 硅谷数模半导体(北京)有限公司 Debugging system, adjustment method and the debugging apparatus of chip
CN110825567A (en) * 2019-07-17 2020-02-21 深圳芯智汇科技有限公司 Test system and test method of audio chip

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN112631851A (en) 2021-04-09

Similar Documents

Publication Publication Date Title
CN112631851B (en) Chip debugging agent device and chip debugging method
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
KR100970821B1 (en) Universal graphics adapter
US7921244B2 (en) Data sharing and transfer systems and methods
EP2040174A1 (en) Card-type peripheral device
CN107066746B (en) Method for realizing PCA9555 function through CPLD based on I2C interface
US11151065B2 (en) Method for performing detection control of write protection function of memory device, associated control chip and associated electronic device
JP2004227588A (en) Sdio card development system
US6892248B2 (en) Method and apparatus for configuring a port on a legacy-free device for general I/O purposes or debugging purposes
US6148384A (en) Decoupled serial memory access with passkey protected memory areas
US6366877B1 (en) Method and device for emulation of peripheral input/output (I/O) controller of a computer system
US6526525B1 (en) PCI debugging device, method and system
CN119049530A (en) FPGA-based memory chip testing method and testing system
CN109783407B (en) Device and method for realizing PC and display card bridging based on FPGA
US5664198A (en) High speed access to PC card memory using interrupts
US6633973B1 (en) Trace control circuit adapted for high-speed microcomputer operation
CN101788946B (en) Method and device for sintering firmware connected with E2PROM (Electrically Erasable Programmable Read-Only Memory) on CPLD (Complex Programable Logic Device)
CN112395147A (en) Debugging device on SOC
CN107704417A (en) The method and its communication system to be communicated with equipment under test
CN109840172A (en) A kind of Nand flash memory analytical equipment and method based on SoC main control chip
KR100801759B1 (en) Slave Debugging Method and System
CN114416046A (en) Method and system for accessing multiple functional board cards based on ATE (automatic test equipment) tester
US20030229727A1 (en) Method and apparatus of virtual COM port
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
GR01 Patent grant
GR01 Patent grant