{"id":1519,"date":"2016-05-03T22:31:08","date_gmt":"2016-05-03T14:31:08","guid":{"rendered":"http:\/\/kaoru.tech\/?p=1519"},"modified":"2016-05-03T23:30:18","modified_gmt":"2016-05-03T15:30:18","slug":"how-to-use-usb-cdc-acm","status":"publish","type":"post","link":"http:\/\/kaoru.tech:7000\/wordpress\/?p=1519","title":{"rendered":"How to use USB CDC ACM"},"content":{"rendered":"<h1>Kernel Configuration<\/h1>\n<p><a href=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/Gadget-Serial-Kernel-Config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1533\" src=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/Gadget-Serial-Kernel-Config.png\" alt=\"Gadget Serial Kernel Config\" width=\"675\" height=\"900\" srcset=\"http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/Gadget-Serial-Kernel-Config.png 675w, http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/Gadget-Serial-Kernel-Config-225x300.png 225w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/a><\/p>\n<h1>On Embedded\u00a0Platform<\/h1>\n<h2>Insmod Drivers<\/h2>\n<p>After that, a new UART device node will be found in \/dev\/<\/p>\n<pre class=\"lang:sh decode:true\"># create mod.sh file and input followed command\r\n \r\n#\/bin\/sh\r\n\r\ninsmod configfs.ko\r\ninsmod libcomposite.ko\r\ninsmod u_serial.ko\r\ninsmod usb_f_acm.ko\r\ninsmod g_serial.ko\r\n\r\n# chmod +x mod.sh\r\n# .\/mod.sh \r\ng_serial gadget: Gadget Serial v2.4\r\ng_serial gadget: g_serial ready\r\n# ls \/dev\/ttyGS0 -l\r\ncrw-rw----    1 root     root      249,   0 Jan  1 02:40 \/dev\/ttyGS0<\/pre>\n<h2>Connect Target to Host with a USB cable<\/h2>\n<p>You will see Windows notice found a new hardware and try to search and install driver.<\/p>\n<p><a href=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/Gadget-Serial-Device-Driver-installing.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1520 alignnone\" src=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/Gadget-Serial-Device-Driver-installing.png\" alt=\"Gadget Serial Device Driver installing\" width=\"536\" height=\"214\" srcset=\"http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/Gadget-Serial-Device-Driver-installing.png 536w, http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/Gadget-Serial-Device-Driver-installing-300x120.png 300w\" sizes=\"auto, (max-width: 536px) 100vw, 536px\" \/><\/a><\/p>\n<h1>On Host\u00a0Platform<\/h1>\n<p>After\u00a0installation complete, you will see a new serial on Windows<\/p>\n<p><a href=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/Gadget-Serial-on-Windows-Device-Manager.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1521 alignnone\" src=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/Gadget-Serial-on-Windows-Device-Manager.png\" alt=\"Gadget Serial on Windows Device Manager\" width=\"578\" height=\"67\" srcset=\"http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/Gadget-Serial-on-Windows-Device-Manager.png 578w, http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/Gadget-Serial-on-Windows-Device-Manager-300x35.png 300w\" sizes=\"auto, (max-width: 578px) 100vw, 578px\" \/><\/a><\/p>\n<p>And, you will see followed print on target console<\/p>\n<pre class=\"lang:sh decode:true \"># g_serial gadget: high-speed config #2: CDC ACM config<\/pre>\n<p>Then you can test it use &#8216;putty&#8217; or &#8216;Secure CRT&#8217; and so on.<\/p>\n<p>Also, you can connect and test it on virtual PC.<\/p>\n<p><a href=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/Netchip-Gadget-Serial-on-VMware.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1522 alignnone\" src=\"http:\/\/kaoru.tech\/wp-content\/uploads\/2016\/05\/Netchip-Gadget-Serial-on-VMware.png\" alt=\"Netchip Gadget Serial on VMware\" width=\"741\" height=\"550\" srcset=\"http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/Netchip-Gadget-Serial-on-VMware.png 741w, http:\/\/kaoru.tech:7000\/wordpress\/wp-content\/uploads\/2016\/05\/Netchip-Gadget-Serial-on-VMware-300x223.png 300w\" sizes=\"auto, (max-width: 741px) 100vw, 741px\" \/><\/a><\/p>\n<p>with followed kernel message print<\/p>\n<pre class=\"lang:sh decode:true\">[ 7676.420719] usb 1-2: new high-speed USB device number 7 using xhci_hcd\r\n[ 7676.767377] usb 1-2: New USB device found, idVendor=0525, idProduct=a4a7\r\n[ 7676.767381] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0\r\n[ 7676.767382] usb 1-2: Product: Gadget Serial v2.4\r\n[ 7676.767384] usb 1-2: Manufacturer: Linux 3.14.38+ with 2184000.usb\r\n[ 7676.801767] cdc_acm 1-2:2.0: This device cannot do calls on its own. It is not a modem.\r\n[ 7676.801862] cdc_acm 1-2:2.0: ttyACM0: USB ACM device<\/pre>\n<p>so you can test it by &#8216;minicom -D\u00a0\/dev\/ttyACM0&#8217;.<\/p>\n<h1>Reference<\/h1>\n<ul>\n<li><a href=\"https:\/\/developer.ridgerun.com\/wiki\/index.php\/How_to_use_USB_CDC_ACM_and_MS_composite_Linux_gadget_driver\">https:\/\/developer.ridgerun.com\/wiki\/index.php\/How_to_use_USB_CDC_ACM_and_MS_composite_Linux_gadget_driver<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Kernel Configuration On Embedded\u00a0Platform Insmod Drivers After that, a new UART device node will be found in \/dev\/ # create mod.sh file and input followed command #\/bin\/sh insmod configfs.ko insmod&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[14],"tags":[277,68,275,276],"class_list":["post-1519","post","type-post","status-publish","format-standard","hentry","category-embedded","tag-serial","tag-usb","tag-usb-device","tag-usb-gadget"],"_links":{"self":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1519"}],"version-history":[{"count":4,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1519\/revisions"}],"predecessor-version":[{"id":1536,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1519\/revisions\/1536"}],"wp:attachment":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1519"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}