Read GPIO in real time?

3 1868
Edited by Roy360 at Fri Feb 20, 2015 11:20

I know the Raspberry PI can do this, but how about the Banana PI?

I currently have Lubunutu and Geany installed on my PI, and managed to get that basic LED blinking program to run. But I also want to be able to get real time output. I realize I could improvise, and do a printf, to check my values, but is there a better way?

P.S Has anyone had luck connecting their PI to their computer monitors? I Lubuntu, my monitor stays black, and in Android there's some purplish effect. Android works fine on my TV, but Lubuntu there is too much overscan.

So for the time being, I cam using a combination of SSH and Remote Desktop Connection to operate the PI.

also using WiringPi to control the GPIO, is there anything better? I need support for several LDRs and servos.
Edited by Crypter at Sat Feb 21, 2015 11:57

First of all, Linux is not real-time OS (like Arduino is, but that's not an OS - totally irrelevant at the moment), meaning you can't occupy the entire processing power it has to do your stuff. It has to think of the other processes. There's another workaround by using linux kernel modules that can stop the interrupts from the rest of the software, but that means that you just froze the OS to do your stuff, you froze the Ethernet connection, froze the ability to react on your command, froze your SSH session. Until that module releases your Banana PI - your Banana pi is under possession of that kernel module. You can use this but for less than 2 seconds, you get it why...

About connecting the Bpi to composite TV input, Lemaker is non-responsive and it doesn't do anything about it. I get only grayscale image and it's driver/hardware problem that I can't solve, or at least I don't have the knowledge. HDMI works OK.

I'm using WiringPi (they call it WiringBP, guess why...) for reading and writing to GPIOs. With 100% CPU load I'm able to check a single port at a rate of 1MHz (1 read = 10^-6 second) using C program, I'm about to try writing. I'll post my project in a few days here, it's way to unfinished to post it online yet

Hope this gets your stuff answered...

P.S: Ditch Lubuntu and get Bananian, it's more lightweight for this purpose, meaning faster.

Edited by Roy360 at Sat Feb 28, 2015 22:27

I guess print statements on a secondary thread will have to do.

I'm guessing it's my Dell monitors then, because all 3 don't play nice with my PI at all. I have a 7" screen that uses composite, greyscale sucks, but I guess it is better than nothing.

Remote Access works fine too but sometimes it doesn't start on boot, and I need to log in manually before it starts.

I originally had Bananian, but I can't figure out how to connect to the internet with my wireless dongle. Giving my Pi a wired connection would require me to go out an buy a switch or setup a wireless bridge. both I'd like to avoid.

Edited by Roy360 at Thu Apr 9, 2015 19:27
Crypter replied at Sat Feb 21, 2015 11:56
First of all, Linux is not real-time OS (like Arduino is, but that's not an OS - totally irrelevant  ...

I managed to get composite working in Lubuntu.

Just try
screen0_output_mode = 14

Under disp_init

Still working on HDMI though

You have to log in before you can reply Login | Sign Up

Points Rules