8devices Community https://www.8devices.com/community/ |
|
Working with SPI, GPIO and I2C https://www.8devices.com/community/viewtopic.php?f=1&t=13 |
Page 1 of 3 |
Author: | David [ 27 Dec 2011, 15:54 ] |
Post subject: | Working with SPI, GPIO and I2C |
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! |
Author: | EmbeddedMan [ 27 Dec 2011, 21:31 ] |
Post subject: | Re: Working with SPI, GPIO and I2C |
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 |
Author: | macpod [ 27 Dec 2011, 23:23 ] |
Post subject: | Re: Working with SPI, GPIO and I2C |
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) |
Author: | David [ 28 Dec 2011, 10:15 ] |
Post subject: | Re: Working with SPI, GPIO and I2C |
Author: | Saulius [ 28 Dec 2011, 21:11 ] |
Post subject: | Re: Working with SPI, GPIO and I2C |
Author: | David [ 29 Dec 2011, 09:23 ] |
Post subject: | Re: Working with SPI, GPIO and I2C |
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. |
Author: | David [ 29 Dec 2011, 09:44 ] |
Post subject: | Re: Working with SPI, GPIO and I2C |
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? |
Author: | Saulius [ 29 Dec 2011, 10:50 ] |
Post subject: | Re: Working with SPI, GPIO and I2C |
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. |
Author: | David [ 29 Dec 2011, 11:07 ] |
Post subject: | Re: Working with SPI, GPIO and I2C |
Author: | Saulius [ 31 Dec 2011, 09:54 ] |
Post subject: | Re: Working with SPI, GPIO and I2C |
Page 1 of 3 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |