Working with SPI, GPIO and I2C
Author |
Message |
David
Joined: 16 Dec 2011, 14:44 Posts: 105 Location: The Netherlands
|
After some hours of tinkering I've got Carambola working nicely. It's hooked up to the RX/TX of a 3.3V Arduino and spits out commands via /dev/ttyS1. However, I would like to get rid of the Arduino and address some peripherals directly via SPI and I2C. In the Wiki those items are listed as TODO so no documentation is available yet.
I would like to know where to start, so I can start experimenting. Is there a way to interface through SPI using scripts (shell/python/lua) or do I need to make a compiled C program? Can anyone point me to some useful documentation that applies to the Carambola? Thanks!
_________________ | |
|
27 Dec 2011, 15:54 |
|
|
EmbeddedMan
Joined: 19 Dec 2011, 23:05 Posts: 20
|
I'm able to see /sys/class/gpio, and I can do echo 5 > export and then see /sys/class/gpio/gpio5 However, I'm unable to perform any operations on gpio5 that actually seem to affect the pin. Many of the GPIO pins are not 'exportable' to userspace - they come back as "ash: write error: Device or resource busy"
So, how DOES one use the GPIO pins on this guy?
As soon as somebody gets any hardware interfaces working (SPI, I2C, GPIO) please let us know!
*Brian
|
27 Dec 2011, 21:31 |
|
|
macpod
Joined: 21 Dec 2011, 06:23 Posts: 9
|
I2C works fine from my experience. Just download the i2c-tools package and compile your package with the i2c-dev.h header (The userland one, NOT the kernel one)
|
27 Dec 2011, 23:23 |
|
|
David
Joined: 16 Dec 2011, 14:44 Posts: 105 Location: The Netherlands
|
_________________ | |
|
28 Dec 2011, 10:15 |
|
|
Saulius
Joined: 08 Dec 2011, 09:35 Posts: 138
|
|
28 Dec 2011, 21:11 |
|
|
David
Joined: 16 Dec 2011, 14:44 Posts: 105 Location: The Netherlands
|
Thanks! Will try gpioctl today.
By the way, when searching for SPI and Carambola I found who seems to be working on spidev for Carambola on GitHub. I tried manually adding his changes to the source and recompiling but it hasn't provided me with a working SPI yet.
_________________ | |
|
29 Dec 2011, 09:23 |
|
|
David
Joined: 16 Dec 2011, 14:44 Posts: 105 Location: The Netherlands
|
The examples work nicely: I can set and clear gpio1 and gpio2. The other gpio don't seem to work. Why don't they? Are they used by other peripherals?
_________________ | |
|
29 Dec 2011, 09:44 |
|
|
Saulius
Joined: 08 Dec 2011, 09:35 Posts: 138
|
As I mentioned before, some I/O pins are shared with other functions. If function is set to GPIO, gpioctl can control them, else function should be switched.
|
29 Dec 2011, 10:50 |
|
|
David
Joined: 16 Dec 2011, 14:44 Posts: 105 Location: The Netherlands
|
_________________ | |
|
29 Dec 2011, 11:07 |
|
|
Saulius
Joined: 08 Dec 2011, 09:35 Posts: 138
|
|
31 Dec 2011, 09:54 |
|
|
Who is online |
Users browsing this forum: No registered users |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|