Android UART

Started by mohammadfa91, April 09, 2014, 11:32:28 AM

Previous topic - Next topic

mohammadfa91

Is There Anyone Can Use UART In Android Directly?
(Not Using FT232 , PT2303 , ...)


mohammadfa91

Quote from: dave-at-axon on April 09, 2014, 01:03:22 PM
Yes, use this.

https://code.google.com/p/android-serialport-api/
Thanks, Great code but is there any codes that not use NDK?
I was thinking we can add a lib to kernel and a lib to SDK and control UART in a simple command in Eclipse.
Is that necessary to disable serial debug to use UART-1?

dave-at-axon

There is no native support for serial ports under Android. Even if you have a kernel driver and by the way, the existing UART driver is in the kernel, you will still need a JNI and the NDK to access it.

It is very easy to setup the NDK under Eclipse. I even have it under Android Studio with a couple script files to create the final builds and move the files so that AS sees them.

Your lib idea still need to would be a JNI too, as is the SerialPort API I linked to. Use it as it works great. I have an Android system talking to a fingerprint reader on a UART and it is rock solid.

mohammadfa91

Thanks, Can you explain how to set NDK for Android Studio? And is that necessary disable serial debug to use UART 1?

dave-at-axon

For NDK see here.

https://developer.android.com/tools/sdk/ndk/index.html

As for the UART, I don't know much about the A13, sorry.

mohammadfa91

Excuse me, is there codes for using PWM,ADC,GPIO ?

dave-at-axon

Not seen anything for PWM yet but GPIO and I2C are fully working under Android.

I wrote an I2C driver for another Android platform but it is very easily ported to the A20/A13 etc

http://sourceforge.net/projects/mini6410-i2c/

GPIO is easy too. Same principle. Do a search for Android GPIO on Google as there is a load of stuff on this.

As for ADC, I use an external ADC over I2C (MCP3428) as it's easier than writing a driver for the internal ADC.

mohammadfa91

I don't know how to thank you for these. I will have more question inside the codes. ;D