Interested?

* Indicates a required field

- from

GT-VP Communication on Linux

Introduction

This describes USB communication methods for the GT-VP (1P) TFT module using Linux:

USB Information

GTWV050VHB00P GT800X480A-1303P GT1280X800A-1303P
Vendor ID 0x0EDA 0x0EDA 0x0EDA
Product ID 0x012DD 0x012DE 0x012DF
EP IN Address 0x81 0x81 0x81
EP OUT Address 0x02 0x02 0x02
Device and Interface Class 0xFF (Vendor-specific) 0xFF (Vendor-specific) 0xFF (Vendor-specific)

Endpoint Information

Endpoint Type Maximum Packet Size
Endpoint 0 Control Full speed: 64 bytes
Endpoint 1 Bulk IN Full speed: 64 bytes
Endpoint 2 Bulk OUT Full speed: 64 bytes
Endpoint 3 Interrupt IN Full speed: 18 bytes

This device has a single configuration with a single interface and two endpoints for data transfer.

libusb.h – USB Communication Library

For USB communication, we have used libusb.h. This is an open source library that lets users communicate with generic USB devices from user-space.

Website: https://libusb.info/

Installation: sudo apt-get install libusb-1.0-0-dev

This library can be used to open the GT-VP device and perform bulk transfers to send display commands and read responses back from the module.

The following functions are used to establish a test connection with a GT-VP module:

  1. libusb_init(NULL);
    1. This function initializes libusb with the default context.
  2. libusb_open_device_with_vid_pid(NULL, 0x0EDA, 0x12DE);
    1. This function opens a device with a specific vendor and product ID. This example will establish a connection with a GT800X480A-1303P module with the default context.
    2. This function returns the libusb_device_handle, which, for this example, we will call devh.
  3. libusb_claim_interface(devh, 1);
    1. This function claims the desired interface to communicate with. When communicating with the GT-VP module, we need to claim interface 0.

The libusb_bulk_transfer() function is used to write and read data to and from the GT-VP module using libusb.h:

  1. To write a byte of data, use the module’s EP OUT address (0x02).
    1. libusb_bulk_transfer(devh, 0x02, data_byte, 1, &actual_length, timeout);
      1. timeout = 0
  2. To read a byte of data, use the module’s EP IN address (0x81).
    1. libusb_bulk_transfer(devh, 0x81, read_data_array, number_bytes_to_read, &actual_length, timeout);
      1. timeout = 1000

The following functions are used to close and release a fully established USB connection to a GT-CP module using libusb.h:

  1. libusb_release_interface(devh, 1);
    1. This function releases the interface that was previously claimed.
  2. libusb_close(devh);
    1. This function closes the specified device handle.
  3. libusb_exit(NULL);
    1. This function will deinitialize libusb.

 

Brightness Adjustment Example Program Using libusb.h

The example program (main.c) changes the connected display’s brightness based on the user’s terminal arguments. This program utilizes “GT1P_USB_LIB.c” (a libusb wrapper) and “GT1P.c” (a GT-1P command library). The commands found in “GT1P.c” directly relate to the commands found in the GT-VP datasheet.

Run “make” before executing the program with “sudo ./libusb_example <brightness_value> <module_PN>”.

<brightness_value> is the desired brightness percentage ranging from 1 – 100%.

<module_PN> is the connected module’s product number (GTWV050VHB00P, GT800X480A-1303P, or GT1280X800A-1303P).

Once the program is executed, the back-light on the GT-VP module should change based on the desired brightness. (Make sure the module is receiving video signal so you can notice a brightness change.)

If “sudo ./libusb_example 100 GT800X480A-1303P” is used, then the module’s brightness should look like this:

If “sudo ./libusb_example 10 GT800X480A-1303P” is used, then the module’s brightness should look like this:

This brightness example also applies to the generic USB driver example program. (except for the display PN parameter)

Generic USB Driver

When connected to a Linux PC, a GT-VP module does not automatically get assigned to a USB driver.

To attach a generic USB driver to a GT800X480A-1303P module, use:

  • modprobe -r usbserial
  • modprobe usbserial vendor=0x0EDA product=0x12DE

Once a generic USB driver is attached, the GT-VP module is not associated with a device path like /dev/ttyUSB0. You can check your exact device path with the dmesg terminal command after plugging the module into your Linux PC. Look for the “generic converter now attached to ttyUSBX” message.

NOTE: A generic USB driver is intended for evaluation purposes only.

 

Brightness Adjustment Example Program Using Generic USB Driver

The example program (main.c) changes the module’s brightness using terminal parameters and a generic USB driver. The program opens “/dev/ttyUSB0” and write the brightness change command to the device path.

Run “make” before executing the program with “sudo ./generic_example <brightness_value>”.

<brightness_value> is the desired brightness percentage ranging from 1 – 100%.

Once the program is executed, the back-light on the GT-VP module should change based on the desired brightness. (Make sure the module is receiving video signal so you can notice a brightness change.)

Download Example Code

Disclaimer

The software examples above are provided “AS-IS”. We are not responsible for any issues that may occur while using this program.
All software (code and/or examples) on this page is provided for demonstration and evaluation purposes only.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.