Android: accessing UARTs/Serial Ports on Freescale's EVK51

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Android: accessing UARTs/Serial Ports on Freescale's EVK51

9,490 Views
mbp
Contributor V

Wondering outloud if anybody has had any success in accessing & utilizing the UARTs/serial ports on the EVK when running Android.  I have been working on porting the Android serialPort API (http://code.google.com/p/android-serialport-api/) but running into permissions issues (among others).  I am using the prebuilt library and not rebuilding via NDK. 

 

If anyone has success with serial port access - I would appreciate some pointers or a code snippet/sample. 

 

Thanks all!

Labels (1)
0 Kudos
Reply
10 Replies

3,407 Views
mbp
Contributor V

SOLVED - in the various responses above!

3,407 Views
mbp
Contributor V

Carl,

Note that (1) the  ~myandroid/device/fsl/imx51_bbg/init.rc  is copied to  out/target/product/imx51_bbg/root/init.freescale.rc  and (2) the  ~myandroid/device/fsl/imx5x/init.rc  is copied to out/target/product/imx51_bbg/root/init.rc  upon Make.

You should modify (1) with your own specific changes.  Subsequently you can confirm the changes by noting the init.freescale.rc contents in the out folder after Make.

Mike

0 Kudos
Reply

3,407 Views
arunmondkar
Contributor I

Hello

         I loaded Adeneo android 2.3.3version image on imx53quick sort board its working fine . But when i write the data and through the serial port application with /dev/ttymxc0 port it is giving read/write permissions are needed. For that i did  temporally by setting chmod 777 /dev/ttymxc0 through minicom its working perfectly . so my quesion is how to set the permissions permanently in Android (In linux we will modify init.rc file) so how should i proceed further , and i changed

1) i.MX53-QSB-Android-Gingerbread-Release4.3/src/device/fsl/imx53_loco/init.rc  with chmod 0777 /dev/ttymxc0 .After this i compiled   but no success

2)i.MX53-QSB-Android-Gingerbread-Release4.3/src/device/fsl/imx5x/init.rc with chmod 0777 /dev/ttymxc0 . After this i compiled   but no success

3)i.MX53-QSB-Android-Gingerbread-Release4.3/src/system/core/rootdir/init.rc with chmod 0777 /dev/ttymxc0 After this i compiled   but no success

So i followed above procedures but all fail can any one please give me suggestion how to set the permanent permissions in Android for /dev/ttymxc0

       And also can i change the permissions in the Serial port apk through android application development tool ??????????? if that is possible please give me the solution how to do in application development


0 Kudos
Reply

3,407 Views
mbp
Contributor V

Arun,

You may have noticed there are several init.rc file variants in several locations.  Some of these are the core and used in the make file to produce the .rc files that are run during boot.  Modifying one of these 'make(d)' .rc's will do nothing as they are overwritten on your next make!    The root 'user' init.rc file is located in the ~myandroid/device/fsl/imx5XXX/ directory and is copied to init.freescale.rc upon make.  So this is the file you need to modify.  After the make check the init.freescale.rc in your "out/target/product/....."  directory and you will see your modifications carried across and you will have confirmed you have updated the correct file!

Mike

0 Kudos
Reply

3,407 Views
CarlIgelstram
Contributor I

How do one change the init.rc ? I have tried opening it in several programs without success, and opening it on the boards Emulated terminal does not work either? Chmod 777 /dev/ttymxc0 works like a charm but as u posted before its only temporary

BR

Carl


Mike Petersen said:

Yes.  You must chmod 777 /dev/ttymxc0.  You can temporarily do this from the console port or permanently in the init.rc file.

0 Kudos
Reply

3,407 Views
mbp
Contributor V

Yes.  You must chmod 777 /dev/ttymxc0.  You can temporarily do this from the console port or permanently in the init.rc file.

0 Kudos
Reply

3,407 Views
ScottIngham_ng
Contributor I

I am trying to get the serial-port-api project running on my SABRE Tablet and getting the same read/write permissions error. I am using ttymxc0 and I can successfully write echo "test" > /dev/ttymxc0 via the Debug board, but fail when trying to run the app. Did anyone ever figure out the permissions issue?

0 Kudos
Reply

3,407 Views
mbp
Contributor V
Ok - I took a peek and Can't find anything either (wonder where it went??).  Anyway you need to download the serial-port-api project (android.serialport).  You can play with this as a standalone app - all the source is there.  Build the C driver using ndk and include as a library.  Then tweak the Android/Linux code; babbage.c (I think - would have to power up the Linux system to recall) to add the definitions for the new UART you want to use (e.g. UART2 for ttymxc1).  Then include the SerialPort.java (I do have SerialPortFinder as well - but I think I can yank it).  I installed my own variants of the serial-port app; read thread, onDataReceived and OutputStream write functions.  That's the core.
0 Kudos
Reply

3,407 Views
mbp
Contributor V
Yes I have.  The product you see in my 'pic' is controlling our test 'modules' via the second UART.  Reserving the 1st UART for console duties.  If you do a bit of a search on this site you will find a series of steps to gain access of the UART.  If you didn't find it here it must be in the MX51EVK group (I originally posted both groups with this query).
0 Kudos
Reply

3,407 Views
PaulMcGregor
Contributor I

Did you ever have any luck with using the uart I am working on a app that will require doing so on the QSB.

Amy pointers would be appreciated 

0 Kudos
Reply