Skip to content

USB Gadget Serial Instructions for Use*

Overview*

USB Gadget Serial is a function that uses USB to simulate a serial port. The usage method is similar to that of an ordinary serial port.

Instructions*

  • Enable [*] Enable ttyACMx through USB in make menuconfig to open USB Gadget Serial.
  • After connecting to PC, it will be recognized as ttyACMx and can be used as a normal serial port
    $ ll /dev/ttyACM*
    crw-rw---- 1 jialp dialout 166, 0 October 19 18:24 /dev/ttyACM0
    
  • Refer to the compilation configuration configuration:
    configs/nationalchip_public_version/USB_GS_bypass_bin_demo.config
    

demo description*

  • The demo shows the basic sending and receiving functions, sending back the data received by USB Gadget Serial
    $ echo GS_test_1 > /dev/ttyACM0;cat /dev/ttyACM0
    GS_test_1
    $ echo GS_test_2 > /dev/ttyACM0;cat /dev/ttyACM0
    GS_test_2
    $ echo GS_test_3 > /dev/ttyACM0;cat /dev/ttyACM0
    GS_test_3
    
  • GsOpen() is called in _SystemInit(), there is no need to call GsOpen() again