Hi all, I am familiar with programmed embedded systems with the likes of UCOS and no OS etc and this is my first time to learn to build Android on a mini6410 of which I am enjoying the experience. The thing I am stuck at is lack of documentation and unfamiliar with Linux etc. (Again a new learning experience as I am now running Ubuntu 64 to build the Android 2.3.4 system) I have a custom designed board that the mini6410 plugs into. This includes a AC-DC power supply, a DC-DC power supply and external RS232 drivers and external connection point for the WiFi board. Here are some images of the board and enclosure. http://www.axoninstruments.biz/download/DSC01256.JPG http://www.axoninstruments.biz/download/IMAG0219_sm.jpg On this PPCB design I have a push button power supply controller and this has 2 connections that go to the GPIO pins on the mini6410. One is for an interrupt ouput that goes low when the button is pressed. The second is an input to the push button controller that allows the system to kill the power. When this is pulled low by the mini6410 the power is switched off. This would normally be when all processes are either shutdown or put to sleep and data saved. This is why there is an input to signal the processor power should be removed. The issue I have is where I handle these GPIO input and outputs. I think looking at the code this should be done in the Linux kernel. It needs to alert the Android OS though that power is being switched off and allow any running application to do housework before the power is removed. I am stuck right now with lack of knowledge on the correct place for this code and looking for some pointers. This is a home project to allow me to interface to my electrical meter to monitor the power usage and control heating and air-conditioning in my apartment. Appreciate any help anyone can offer, even if just where to look in the code and if possible a place to look for sample as I can figure out what I need from there. Cheers Dave...
GPIO under Android
Hi Dave have you read this documentation? http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO also where did you found the information to build Android 2.3.4?
Hi Andre, Thanks for the info. I'll have a read of it this week. I got the download from the FTP site. Look for these files: Tiny6410B-20111022.iso Tiny6410A-20111022.iso They were dated Nov 2011 so I assumed an update. When I downloaded I found 2.3.4 on there. :) Dave...
Oops. Wrong files. Try these Mini6410A-20111022.iso Mini6410B-20111022.iso Oct release it should be, not Nov. Sorry. Dave...
Hi Dave, i've just stumbled over your pictures. What I can see so far is a nice and tidy job: very well done. Just a small hint: in the 2'nd picture at the middle/top there is a flat-ribbon going thru the PCB. Perhaps you can add some protection to the edge of the PCB to avoid damages of the ribbon. As I say'd before: seldom seen such a tidy selfmade gadget !!! Martin ...
Hi there, Dave, did you manage to access GPIO on Android ? I worked a bit to get serial ports working, and finally I have a working service class to handle serial port com. But the settings of the COM are applied by the pre-compiled library libfriendlyarm-hardware.so (are the source file available ?) Is access to GPIO mean recompile the kernel and add things like gpio-sysfs, and write a driver accessible with JNI ? If so, I seriously need help ;o) It is a shame that we cannot see what is behind setLedState() of the libfriendlyarm-hardware.so Anyway thanks a lot, Pierre
Hi Martin and Muth, I just stumbled across your replies. I with this forum would do email notifications. Martin, the ribbon at the top of the pic part of the LCD supplied by FriendlyArm so I have no control over this. Thanks for the kind comments. Much appreciated. (As it happens this box is now going to be used for a customer test project) Muth, working on GPIO now. I just got I2C to work tonight (there is a posting about this on the forum). I already have RS232 from elsewhere. The FriendlyArm library is far too limited in the calls it provides. I can't see why they would make this source closed when so many people with their boards would like to see the code and my development time would have been reduced from months to weeks. I am designing in the Mini210 for my next commercial project so it would pay them to do so. Mindee, do you have a comment on this, if you're reading this. Anyway, I am slowly learning to use the JNI and looking to add GPIO next. I'll let you know how I get on. Cheers Dave...
Hi Dave ! A huge thanks, I didn't expect a reply, it's really kind. Really interesting, I have an i2c BMP085 digital barometer I will test it ! I'll follow your dev with lot of interest, again, thanks a lot for sharing Dave !
Hi Muth, how did you get on with the I2C? Did it work for you? I am still trying to get GPIO working. I don't need any kernal code, just a way for Android to set GPIO pins. Dave...
Hi, I have got GPIO working on Tiny6410. I had to compile the kernel to include /sys/class/gpio. This exposes the gpio pins for root. I then compiled android system making changes to init.rc. Added permissions to gpio export in init.rc as below: chown system system /sys/class/gpio/export chmod 0666 /sys/class/gpio/export Later added the pin numbers to export in init.rc. The pin numbers can be found from /sys/class/gpio/gpiochip104/base(similarly for other pins) write /sys/class/gpio/export 108 (similarly for other pins) This gives access to individual pins through gpio108/direction and gpio108/value. But these are again write protected so i have changed permissions in init.rc chown system system /sys/class/gpio/gpio108/direction chown system system /sys/class/gpio/gpio108/value chmod 0666 /sys/class/gpio/gpio108/direction chmod 0666 /sys/class/gpio/gpio108/value (similarly for other pins) This should make it work. For controlling through a program I have used jni: fp = fopen("/sys/class/gpio/gpio108/value", "rb+")); strcpy(set_value,"1"); fwrite(&set_value, sizeof(char), 1, fp); It is also possible using a simple file operation in java. Cheers, Harsha
Excellent work Harsha. Once I get my Ubuntu system working again (update to 12.04 has trashed the bootup) I'll complete my JNI for I2C and GPIO and update the source so others can get it. I'll comment your help in the code. Much appreciated for your time. Dave... PS... I will shortly test this on the Mini210 too as I am moving to that instead of the Mini6410 because of the fast speed and better LCD and touch.
Hi Dave, Great that you are publishing the source. It took me almost a week to get GPIO working. I would be glad to help if anything further is required. email - harshaherur@gmail.com Cheers, Harsha
Cheers Harsha, In case you missed it, my I2C code is here. I'll update this with GPIO next based on your help and code. https://sourceforge.net/projects/mini6410-i2c Dave...
Hey Harsha. I finally got time this weekend with the wife being away to put in some time to get GPIO working and after many hours today I have it working on the Mini210. Now that I know how to do it, I will do the same for the Mini6410 Took me a little while to figure it out and work out how it all works but I am learning more each day and enjoying the challenge. Your help put me in the right direction. I added all the changes to init.rc and now all the GPIO that is available on the GPIO connector is included when I install Android on the flash. For now I have the GPIO working tested with ADB and I am going to update the source for the JNI once I have that working. Cheers, Dave...
Hi everybody! My intention is to connect two i/o-cards (IOIO V1/,2, 48-line i/o) via I2C GPIO expander, can you suggest the easiest (or cheapest) way to do it with Android (2.3<)?
Great job Dave, When will your wife be away again so that your can share your Mini210 GPIO code with us Thank you in advance
Hi Mexx. I have done the coding and tested it on my Mini210 so I will try and get it up this weekend or at least over the next few days. Dave...
Dear Friends last two days I am trying to establish RS232 communication in Android with my Tyni6410 development board.I am using libfriendlyarm-hardware library,success in sending data from board to PC ( write() function) but there is no effect with read() fuction.I am testing serial communication with Terminal emulator in windows 7 ( board connected to laptop usb port via usb-serial converter ). what is wrong with read() function ? thanks in advance latheef
Hi,I would like to know how access any GPIO in Java (MINI6410)? I use the libfriendlyarm-hardware.so, but there are small quantity GPIO's (led's, ADC, Memory I2C, PWM). I want to use, for example, the pushbutton. I want to use others I2C devices (because in libfriendlyarm-hardware.so i can't to put a address slave). I want to use others GPIO's (extension). How i generate a libfriendlyarm-hardware.so? Thanks.
Hi Anderson, I am trying to create a new SourceForge entry for the GPIO software. I will post a link here once it is up. It is not 100% completed and tested yet but I would welcome any others to help with it. I am so busy with a work project that I don't get much time on it just now. Give me a couple of days and it will be up and ready for download. Dave...
Hi Mexx and all, I finally put it up on sourceforge but I am still waiting for the PCB to arrive to test this with my Mini210 but initial testing works. This includes GPIO and I2C. Right now, all that is up there is the JNI code. I'll upload the Android Java this week. https://sourceforge.net/p/friendlyarmgpio/ Dave...
Hi Dave, Thank you for sharing your code, I will test in in next few weeks and revert. Really appreciate your effort...
Hi Danijel, I changed the files I uploaded. I included the JAVA file and removed the old files. Dave...
Hello guys Thanks for the useful thread. I have a question: Is it possible to configure the GPIO permissions in Android Java code instead of rebuilding Android system with a modified init.rc ? has anyone done it successfully ?
Is there any chance Dave that you can email it me, unfortunately sourceforge is not accessable from here. (real real pain) phil_in_china at yahoo dot com Thanks
Hello Nice work you had done Mr.Dave I'm working with ANDROID ICS in Beaglebone. I need to implement just 4 GPIO buttons like your device MENU,BACK,HOME and POWER ON/OFF. In my beaglebone following GPIO pins are available in header GPIO0_26,GPIO1_1, GPIO1_2, GPIO1_3, GPIO1_4, GPIO2_1, GPIO2_8 other some pins are available i think that its enough to explain my problem. I need to know how to configure the GPIO buttons in kernel and how to map the key according to ANDROID key code, more than week i'm trying this but i cant succeed. Can any one help me to finish this.Especially i want to know which files have to be modify in ANDROID AOSP. Any one have handled it plz mail me sangilikumar.muniyandi@marudham.co.in ( i dono that if any one reply for this post it will come to my mail or not thats why i'm enclosing my mail id) I'm very thankful, who make me clear Thanks in advance.
@chains. Why not download the source code for the Mini6410 or Mini210 and see how FriendlyArm did it? You can get them from the FTP site.
Thanks for your reply Mr.Dave Sorry Mr.Dave I'm using TI-Android-ICS source code. My works are almost over (schematic,BOM,etc.) with the reference of AM335xEVM and Beaglebone Schematic.So at the last moment i can't change it to new things.But I've plan to design another android device with in 1 month for automation purpose so mini6410 or mini210 will help me rather than TI image.Mean while i'll get the source code and go through it. I hope mini6410 help me to complete my upcoming device. Now i need to implement the buttons in my device.Can yo tell me the procedure for configure the GPIO for ANDROID menu button. I hope you will help me. Thanks in advance..!!
Hi all. Been a while. I got GPIO working now on my Mini210 but I can't get GPH0_0 to change state. It remains HIGH no matter what I do. I suspect a fault with the board and will confirm with my other board in the next few days. I'll be updating the files on sourceforge in the next day or so once I have finished tidying it up. Thanks to all for your help. It has been fun learning how this all works and how JNI works too. Cheers Dave...
hey hi can anyone guide me how get gpio,leds,adc pins... i cannt found the pins in tiny6410.. i hve install android... hve got all the setup JNI n all but the path for acessin the pins cannt b found.... if nyone knw how to do?? harsha has xplained but m new to it m not able to get wherre to write dat commmnds n all.. i really need help thnks in advance
Hi Dave, I read your post and downloaded the code, a great work, I am new to Android and Java, I could not understand how to use your project files. I created a new tiny210 android project and included your project files, now how can I use them ? I also have following problems: 1. JNIEXPORT in axonio.c shows syntax error. 2. setdirectionGPIO(String nodeName, int State); what should I write in place of nodeName to access GPH0_0 of tiny210. Any help can be really appreciated, thanks in advance.
I have the same doubts as asci. How do you use the setdirectionGPIO, what to write in the place of nodeName. Any help would be really appreciated.
In my test code I have this setdirectionGPIO("gpio128", 1); gpio128 is the device name. You'll need to locate this in your kernel drivers.
Hi Dave, Thank you for sharing your code, I downloaded your code on page https://sourceforge.net/p/friendlyarmgpio/ but i can't look for lib axonIO.so I hope you will help me.