回  复
12

查看: 726 | 回复: 9

ch340g 芯片 在安卓上的使用问题 咨询
chenliquan 发表于:2016-06-13 16:19:18 1# 编辑

12

主题

32

帖子

198

积分
等级

小学四年级

私信

下载官方的apk demo, 插入ch340g的板子 系统会提示运行,这个时候后续 操作是正常的,包括打开、关闭和读写。 不正常的是:如果安卓重启,再次运行demo的时候,注意板子没有插入动作,这时候app就会报错,请问有什么办法可以解决这种情况呢? 谢谢。

血色顽主 发表于:2017-08-25 10:06:09 2#

0

主题

6

帖子

26

积分
等级

幼儿园

私信

问题同上:官方demo,USB一直插在安卓上,打开APP,报错。查看日志为:

08-24 07:47:54.336: I/art(4208): Not late-enabling -Xcheck:jni (already on)
08-24 07:47:54.677: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.677: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.681: D/AndroidRuntime(4208): Shutting down VM
08-24 07:47:54.688: E/AndroidRuntime(4208): FATAL EXCEPTION: main
08-24 07:47:54.688: E/AndroidRuntime(4208): Process: com.example.c6zdh, PID: 4208
08-24 07:47:54.688: E/AndroidRuntime(4208): java.lang.RuntimeException: Unable to create application com.example.c6zdh.MyAppLication: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.usb.UsbDeviceConnection.controlTransfer(int, int, int, int, byte[], int, int)' on a null object reference
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4521)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.access$1500(ActivityThread.java:144)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.os.Handler.dispatchMessage(Handler.java:102)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.os.Looper.loop(Looper.java:135)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.main(ActivityThread.java:5221)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at java.lang.reflect.Method.invoke(Native Method)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at java.lang.reflect.Method.invoke(Method.java:372)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
08-24 07:47:54.688: E/AndroidRuntime(4208): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.usb.UsbDeviceConnection.controlTransfer(int, int, int, int, byte[], int, int)' on a null object reference
08-24 07:47:54.688: E/AndroidRuntime(4208):  at cn.wch.ch34xuartdriver.CH34xUARTDriver.a(Unknown Source)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at cn.wch.ch34xuartdriver.CH34xUARTDriver.UartInit(Unknown Source)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.example.c6zdh.MyAppLication.initUSB(MyAppLication.java:62)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.example.c6zdh.MyAppLication.onCreate(MyAppLication.java:31)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4518)
08-24 07:47:54.688: E/AndroidRuntime(4208):  ... 9 more

TECH39 发表于:2017-08-28 13:23:40 3#

2

主题

61

帖子

86

积分
等级

小学二年级

私信

引用:
                           

问题同上:官方demo,USB一直插在安卓上,打开APP,报错。查看日志为:

08-24 07:47:54.336: I/art(4208): Not late-enabling -Xcheck:jni (already on)
08-24 07:47:54.677: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.677: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.681: D/AndroidRuntime(4208): Shutting down VM
08-24 07:47:54.688: E/AndroidRuntime(4208): FATAL EXCEPTION: main
08-24 07:47:54.688: E/AndroidRuntime(4208): Process: com.example.c6zdh, PID: 4208
08-24 07:47:54.688: E/AndroidRuntime(4208): java.lang.RuntimeException: Unable to create application com.example.c6zdh.MyAppLication: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.usb.UsbDeviceConnection.controlTransfer(int, int, int, int, byte[], int, int)' on a null object reference
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4521)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.access$1500(ActivityThread.java:144)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.os.Handler.dispatchMessage(Handler.java:102)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.os.Looper.loop(Looper.java:135)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.main(ActivityThread.java:5221)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at java.lang.reflect.Method.invoke(Native Method)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at java.lang.reflect.Method.invoke(Method.java:372)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
08-24 07:47:54.688: E/AndroidRuntime(4208): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.usb.UsbDeviceConnection.controlTransfer(int, int, int, int, byte[], int, int)' on a null object reference
08-24 07:47:54.688: E/AndroidRuntime(4208):  at cn.wch.ch34xuartdriver.CH34xUARTDriver.a(Unknown Source)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at cn.wch.ch34xuartdriver.CH34xUARTDriver.UartInit(Unknown Source)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.example.c6zdh.MyAppLication.initUSB(MyAppLication.java:62)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.example.c6zdh.MyAppLication.onCreate(MyAppLication.java:31)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4518)
08-24 07:47:54.688: E/AndroidRuntime(4208):  ... 9 more


                       

您好:

    尝试使用一下,如下链接中的APP,看下使用结果。

    CH341SER_ANDROID.ZIP下载页面-江苏沁恒股份有限公司

    http://www.wch.cn/download/CH341SER_ANDROID_ZIP.html


血色顽主 发表于:2017-09-06 10:30:00 4#

0

主题

6

帖子

26

积分
等级

幼儿园

私信

引用:

引用:

                           

问题同上:官方demo,USB一直插在安卓上,打开APP,报错。查看日志为:

08-24 07:47:54.336: I/art(4208): Not late-enabling -Xcheck:jni (already on)
08-24 07:47:54.677: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.677: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.678: D/CH34xAndroidDriver(4208): String.format not match
08-24 07:47:54.681: D/AndroidRuntime(4208): Shutting down VM
08-24 07:47:54.688: E/AndroidRuntime(4208): FATAL EXCEPTION: main
08-24 07:47:54.688: E/AndroidRuntime(4208): Process: com.example.c6zdh, PID: 4208
08-24 07:47:54.688: E/AndroidRuntime(4208): java.lang.RuntimeException: Unable to create application com.example.c6zdh.MyAppLication: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.usb.UsbDeviceConnection.controlTransfer(int, int, int, int, byte[], int, int)' on a null object reference
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4521)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.access$1500(ActivityThread.java:144)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.os.Handler.dispatchMessage(Handler.java:102)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.os.Looper.loop(Looper.java:135)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.main(ActivityThread.java:5221)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at java.lang.reflect.Method.invoke(Native Method)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at java.lang.reflect.Method.invoke(Method.java:372)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
08-24 07:47:54.688: E/AndroidRuntime(4208): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.hardware.usb.UsbDeviceConnection.controlTransfer(int, int, int, int, byte[], int, int)' on a null object reference
08-24 07:47:54.688: E/AndroidRuntime(4208):  at cn.wch.ch34xuartdriver.CH34xUARTDriver.a(Unknown Source)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at cn.wch.ch34xuartdriver.CH34xUARTDriver.UartInit(Unknown Source)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.example.c6zdh.MyAppLication.initUSB(MyAppLication.java:62)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at com.example.c6zdh.MyAppLication.onCreate(MyAppLication.java:31)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
08-24 07:47:54.688: E/AndroidRuntime(4208):  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4518)
08-24 07:47:54.688: E/AndroidRuntime(4208):  ... 9 more


                       

 

您好:

    尝试使用一下,如下链接中的APP,看下使用结果。

    CH341SER_ANDROID.ZIP下载页面-江苏沁恒股份有限公司

    http://www.wch.cn/download/CH341SER_ANDROID_ZIP.html


 

使用官方的APP,重新插拔USB,发现一直弹出未授权权限。

 

TECH39 发表于:2017-09-06 13:22:12 5#

2

主题

61

帖子

86

积分
等级

小学二年级

私信

有没有更换过手机,如果一直不弹出权限,可能是当前系统没有使能 usb host 造成的。

血色顽主 发表于:2017-10-13 08:31:43 6#

0

主题

6

帖子

26

积分
等级

幼儿园

私信

引用:

有没有更换过手机,如果一直不弹出权限,可能是当前系统没有使能 usb host 造成的。

 

没更换过,我们使用的是友善之臂的4412的开发板,问题是和LZ提到的一样,重新开机后,USB必须要重新插拔一次才可以使用!

http://www.arm9.net/tiny4412.asp

楼层回复

关闭

评分

关闭
积分 评分区间 今日剩余
评分扣除自身相应积分,普通会员最高加分3分 0~10 5
12
你需要登录才可以发帖