GPIO in native

Hi,

I've been working on adding GPIO support to RIOT native today, and I was wondering if anyone had any experience with GPIO devices in Linux.

When I researched the topic, I saw that there are some USB <> GPIO devices available. Does anyone have any experience with those?

As far as I understood it, Linux enables access to GPIO on the Raspberry PI via sysfs, so I went forth and started implementing that interface.

Do you know if any other platforms enable this kind of access? Which ones? Do you have experience with it?

If you want to try it out the stub (which I didn't yet - reading *should* work ;), the PR is here: https://github.com/RIOT-OS/RIOT/pull/1737

Cheers, Ludwig

Hi David, rioters,

Just to clarify what I'm doing here: The goal for GPIO support in native is two-fold: - accelerate application development without hardware (a virtual GPIO interface is also part of the PR) - accelerate driver development for GPIO attached devices by providing access to hardware connected to the host system

The incentive is that a raspberry pi or similar can act as a cheap development board when the target board is not (yet) available, and the possibility to use Valgrind et al for driver development. In the long run, the virtual interface should provide a means for test automation (of distributed applications in virtual testbeds) while it immediately allows for manual testing (again, with Valgrind et al).

It is not a goal to have the best solution for production use of GPIO devices, as native is meant as a development tool.

I2C (SPI, PWM, ...) is a different matter and on the to do list for the same reasons as GPIO.

Apparently there is at least one other method of interfacing GPIO as well, some broadcom driver which can be accessed from user space and is said to be faster. I'm not sure whether it makes sense to support this as in addition to the sysfs approach.

Hi,

Hi Martine,

That's actually the interface we are talking about. Their documentation is really great!

I have to do some more testing over the next few days with my C++ GPIO class.

Some time ago I was told that I should use namespaces. This might be a good time to look at that.

To my understanding and experimentation, it should be possible to make a GPIO class work on all hardware including uC and Linux and Riot.

Great documentation link - thanks.

David

s/USES says/uses sysfs/

Apologies for the errors. My tablet, were I rather quickly wrote last mail, has a mind of its own :D.

Cheers, Martine

emCraft seems to have support for GPIO in their uCLinux distro:

http://www.emcraft.com/som/stm32f4/controlling-gpio-from-linux-user-space

Seems to be based on /sys/class/gpio, like the others seem to be.

I don't know more about that, just found out.

--Pekka

Hi,

I guess this page [1] has nothing new to say, right?

Cheers, Hauke

[1] http://www.udoo.org/ProjectsAndTutorials/linux-gpio-manipulation/

That's correct.

If all the systems that can be found support essentially the same interface, I'd see that as being positive.

Just a point from an Application-level-programmer, that /sys/class interface is less inviting than the Wiring/Arduino pinMode/digitalWrite functionality.

So anything that moves away from that shell script style interface can only be good.

Regards

David