Test UART C4 - Android

Post Reply
timnuwin
Posts: 6
Joined: Sun Jan 03, 2021 10:37 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Test UART C4 - Android

Post by timnuwin »

How can I test a peripheral with a baud rate 38400 on the odroid c4 that has the latest Android image via the command line?
It doesn't look like I have `microcom` w/ busybox.

timnuwin
Posts: 6
Joined: Sun Jan 03, 2021 10:37 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Test UART C4 - Android

Post by timnuwin »

Is there any sample android app source-code that you guys recommend to test this UART out?

timnuwin
Posts: 6
Joined: Sun Jan 03, 2021 10:37 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Test UART C4 - Android

Post by timnuwin »

When I try to call uart:

type=1400 audit(0.0:1122): avc: denied { read } for name="ttyS0" dev="tmpfs" ino=2334 scontext=u:r:untrusted_app:s0:c64,c256,c512,c768 tcontext=u:object_r:serial_device:s0 tclass=chr_file permissive=1


I've also updated the /odm/boot.ini to `Okay` the serial port

Luke.go
Posts: 596
Joined: Mon May 30, 2016 1:55 pm
languages_spoken: english
Has thanked: 74 times
Been thanked: 82 times
Contact:

Re: Test UART C4 - Android

Post by Luke.go »

I think a Odroid things feature will help you. :)

https://github.com/xiane/thingsGpioExample/tree/Uart

Please check the GitHub. this example used uart1.

User avatar
odroid
Site Admin
Posts: 36930
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1595 times
Been thanked: 1072 times
Contact:

Re: Test UART C4 - Android

Post by odroid »

Try building this UART example Android app too.
https://wiki.odroid.com/odroid-c2/appli ... ample_code

timnuwin
Posts: 6
Joined: Sun Jan 03, 2021 10:37 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Test UART C4 - Android

Post by timnuwin »

Thanks for the responses, I'm trying out android things idk if it's appending additional characters or if I'm doing the read incorrectly:
https://stackoverflow.com/questions/657 ... -usbserial

When I connect my sensor via the USB and send the same string cmd, I get back what's intended.
Have you run into anything similar?

ukasiu
Posts: 6
Joined: Tue Feb 23, 2021 6:09 am
languages_spoken: english
ODROIDs: C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Test UART C4 - Android

Post by ukasiu »

Hi, I've got a problem with both example apps and /dev/ttyS1. They just don't work, because of avc denied, even after changing /dev/ttyS1 permissions to 666. Could you advise?

User avatar
odroid
Site Admin
Posts: 36930
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1595 times
Been thanked: 1072 times
Contact:

Re: Test UART C4 - Android

Post by odroid »


ukasiu
Posts: 6
Joined: Tue Feb 23, 2021 6:09 am
languages_spoken: english
ODROIDs: C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Test UART C4 - Android

Post by ukasiu »


User avatar
odroid
Site Admin
Posts: 36930
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1595 times
Been thanked: 1072 times
Contact:

Re: Test UART C4 - Android

Post by odroid »

Probably not.
Could you access ttyS1 on the terminal app?

ukasiu
Posts: 6
Joined: Tue Feb 23, 2021 6:09 am
languages_spoken: english
ODROIDs: C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Test UART C4 - Android

Post by ukasiu »

yes, it works well with `microterm`

User avatar
odroid
Site Admin
Posts: 36930
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1595 times
Been thanked: 1072 times
Contact:

Re: Test UART C4 - Android

Post by odroid »

Did you try an example in @Luke.go's comment?

ukasiu
Posts: 6
Joined: Tue Feb 23, 2021 6:09 am
languages_spoken: english
ODROIDs: C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Test UART C4 - Android

Post by ukasiu »

Yes I did. It wasn't crashing, avc denied appeared in dmesg and nothing was read from the port, even though the tx-rx loop was connected.

User avatar
odroid
Site Admin
Posts: 36930
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1595 times
Been thanked: 1072 times
Contact:

Re: Test UART C4 - Android

Post by odroid »

I hope @Luke.go will give you a solution.

Luke.go
Posts: 596
Joined: Mon May 30, 2016 1:55 pm
languages_spoken: english
Has thanked: 74 times
Been thanked: 82 times
Contact:

Re: Test UART C4 - Android

Post by Luke.go »

you don't need to change the owner or permission of ttyS1 node.

please test with 115200 baud rate. And please share your log that crashing.

ukasiu
Posts: 6
Joined: Tue Feb 23, 2021 6:09 am
languages_spoken: english
ODROIDs: C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Test UART C4 - Android

Post by ukasiu »

dmesg

Code: Select all

[   78.512364] meson_uart ffd24000.serial: ttyS1 use xtal(24M) 24000000 change 9600 to 115200
[  184.648689] meson_uart ffd24000.serial: ttyS1 use xtal(24M) 24000000 change 115200 to 115200
[  184.648769] type=1400 audit(1613718577.484:285): avc: denied { read write } for pid=2968 comm="odroidthings@1." name="ttyS1" dev="tmpfs" ino=3317 scontext=u:r:odroid_thing:s0 tcontext=u:object_r:hci_attach_dev:s0 tclass=chr_file permissive=1
[  184.648840] type=1400 audit(1613718577.484:285): avc: denied { read write } for pid=2968 comm="odroidthings@1." name="ttyS1" dev="tmpfs" ino=3317 scontext=u:r:odroid_thing:s0 tcontext=u:object_r:hci_attach_dev:s0 tclass=chr_file permissive=1
[  184.648854] type=1400 audit(1613718577.484:286): avc: denied { open } for pid=2968 comm="odroidthings@1." path="/dev/ttyS1" dev="tmpfs" ino=3317 scontext=u:r:odroid_thing:s0 tcontext=u:object_r:hci_attach_dev:s0 tclass=chr_file permissive=1
[  184.648919] type=1400 audit(1613718577.484:286): avc: denied { open } for pid=2968 comm="odroidthings@1." path="/dev/ttyS1" dev="tmpfs" ino=3317 scontext=u:r:odroid_thing:s0 tcontext=u:object_r:hci_attach_dev:s0 tclass=chr_file permissive=1
[  184.648934] type=1400 audit(1613718577.484:287): avc: denied { ioctl } for pid=2968 comm="odroidthings@1." path="/dev/ttyS1" dev="tmpfs" ino=3317 ioctlcmd=0x5401 scontext=u:r:odroid_thing:s0 tcontext=u:object_r:hci_attach_dev:s0 tclass=chr_file permissive=1
[  190.358270] type=1400 audit(1613718577.484:287): avc: denied { ioctl } for pid=2968 comm="odroidthings@1." path="/dev/ttyS1" dev="tmpfs" ino=3317 ioctlcmd=0x5401 scontext=u:r:odroid_thing:s0 tcontext=u:object_r:hci_attach_dev:s0 tclass=chr_file permissive=1
[  250.000260] meson_uart ffd24000.serial: ttyS1 use xtal(24M) 24000000 change 115200 to 115200
[  256.298838] type=1400 audit(1613718642.836:307): avc: denied { ioctl } for pid=2968 comm="odroidthings@1." path="/dev/ttyS1" dev="tmpfs" ino=3317 ioctlcmd=0x5401 scontext=u:r:odroid_thing:s0 tcontext=u:object_r:hci_attach_dev:s0 tclass=chr_file permissive=1
[  331.044814] meson_uart ffd24000.serial: ttyS1 use xtal(24M) 24000000 change 115200 to 115200
[  335.974545] type=1400 audit(1613718723.880:335): avc: denied { ioctl } for pid=2968 comm="odroidthings@1." path="/dev/ttyS1" dev="tmpfs" ino=3317 ioctlcmd=0x5401 scontext=u:r:odroid_thing:s0 tcontext=u:object_r:hci_attach_dev:s0 tclass=chr_file permissive=1
logcat

Code: Select all

2021-02-19 08:12:00.146 5598-5598/? I/Zygote: seccomp disabled by setenforce 0
2021-02-19 08:12:00.149 5598-5598/? I/ingsgpioexampl: Not late-enabling -Xcheck:jni (already on)
2021-02-19 08:12:00.258 5598-5598/odroid.hardkernel.com.thingsgpioexample W/ActivityThread: Application odroid.hardkernel.com.thingsgpioexample is waiting for the debugger on port 8100...
2021-02-19 08:12:00.264 5598-5598/odroid.hardkernel.com.thingsgpioexample I/System.out: Sending WAIT chunk
2021-02-19 08:12:01.266 5598-5598/odroid.hardkernel.com.thingsgpioexample I/System.out: Debugger has connected
2021-02-19 08:12:01.266 5598-5598/odroid.hardkernel.com.thingsgpioexample I/System.out: waiting for debugger to settle...
2021-02-19 08:12:01.467 5598-5598/odroid.hardkernel.com.thingsgpioexample I/System.out: waiting for debugger to settle...
2021-02-19 08:12:02.470 5598-5598/odroid.hardkernel.com.thingsgpioexample I/chatty: uid=10062(odroid.hardkernel.com.thingsgpioexample) identical 5 lines
2021-02-19 08:12:02.670 5598-5598/odroid.hardkernel.com.thingsgpioexample I/System.out: waiting for debugger to settle...
2021-02-19 08:12:02.871 5598-5598/odroid.hardkernel.com.thingsgpioexample I/System.out: debugger has settled (1357)
2021-02-19 08:12:02.997 5598-5598/odroid.hardkernel.com.thingsgpioexample D/libnativeloader: classloader namespace configured for unbundled vendor apk. library_path=/data/app/odroid.hardkernel.com.thingsgpioexample-HmmG9Dcd0O1vfmikUbbypA==/lib/arm64:/vendor/lib64
2021-02-19 08:12:03.511 5598-5598/odroid.hardkernel.com.thingsgpioexample W/ingsgpioexampl: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
2021-02-19 08:12:03.513 5598-5598/odroid.hardkernel.com.thingsgpioexample W/ingsgpioexampl: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
2021-02-19 08:12:03.867 5598-5598/odroid.hardkernel.com.thingsgpioexample W/ingsgpioexampl: Accessing hidden method Landroid/os/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder; (light greylist, linking)
2021-02-19 08:12:03.872 5598-5598/odroid.hardkernel.com.thingsgpioexample D/PeripheralManager: PeripheralManager init
with the loop between pin 8 and 10

ukasiu
Posts: 6
Joined: Tue Feb 23, 2021 6:09 am
languages_spoken: english
ODROIDs: C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Test UART C4 - Android

Post by ukasiu »

@Luke.go @odroid ok, the example seems to work well with the external device, but it doesn't work with the loop. Also it seems that echo is enabled, so that I get back what I send to the opened UART port. Do you know how to disable it?

Luke.go
Posts: 596
Joined: Mon May 30, 2016 1:55 pm
languages_spoken: english
Has thanked: 74 times
Been thanked: 82 times
Contact:

Re: Test UART C4 - Android

Post by Luke.go »

Please try this.

Code: Select all

$ stty -F /dev/ttyS1 -echo
And try loop again.

I will apply it to android things.

Post Reply

Return to “Android”

Who is online

Users browsing this forum: No registered users and 1 guest