• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: i2c and/or GPIO?  (Read 7479 times)
tmk
Newbie
*

Karma: 1
Posts: 40


View Profile
« on: April 08, 2009, 11:12:20 PM »

Hi folks,

I've been poring over the documentation, and i'm trying to figure out how to get at the i2c bus and/or the GPIO pins.

I have some dallas 1 wire temp sensors i want to get at, and i have an i2c->dallas converter. I'm also OK with going straight to dallas 1-wire via the GPIO pins.


So, questions:

Regarding GPIO: The docs all say that you can use the 4 SDIO data pins as GPIO. Any tips on how to address them, and if i need a custom kernel / modules for that?

I don't see a "/sys/class/gpio/" directory, so i'm assuming some things are missing.



Regarding i2c:

dmesg shows the following:
Code:
i2c /dev entries driver

but (after installing i2c-tools), i2cdump says:
Code:
Error: No I2C busses found!
Be sure you have done 'modprobe i2c-dev'
and also modprobed your i2c bus drivers

I'm ok with prying it open (only 30 day warranty anyhow), but i want to be sure the i2c bus is available. Anyone know if there is really i2c on this thing? Do i need to build my own kernel?

Also, the "TWSI" (two wire serial interface, aka i2c) is shown as being on the header on the following graphic:
http://www.globalscaletechnologies.com/skins/skin_1/images/Sheeva_Plug_BlockDiagram.png

but the header diagram on page 10 (top right) of the "Sheeva-final Schematic.pdf" file doesn't show the i2c pins.

The only mention i can find of 'TWSI' in the "Sheeva-final Schematic.pdf" file is on page 5, and it's only 1 pin (MPP1.. i2c needs 2 pins), labeled "TWSI Serial ROM Initialization Disble"


cheers
-tmk
Logged

karurosu
Global Moderator
Full Member
*****

Karma: 0
Posts: 116



View Profile WWW
« Reply #1 on: April 09, 2009, 08:19:30 AM »

I've been also reading on this, so far this is what I have found:

-GPIO are in the SD slot, which means you have to choose SD or GPIO.
-Since this is a dev board, many things are disconnected (audio, MPEG_TS, SATA to name a few), probably the TWSI is also disconnected.
-I read a bit of GPIO control in linux, there is a module especially created for that: http://www.mjmwired.net/kernel/Documentation/gpio.txt

Now, since this needs kernel support, it may not be already integrated with the binary distros, and my sheevaplug is not yet here so I can't test.

Finally, looking at the diagram you linked to, it looks like the TWSI should be inside at some flex connector (in the dev board), so maybe if you open it there is some pin or pad where you can connect to.

BTW, check this file: http://www.marvell.com/files/products/embedded_processors/kirkwood/FS_88F6180_9x_6281_OpenSource.pdf
« Last Edit: April 09, 2009, 08:21:19 AM by karurosu » Logged

tmk
Newbie
*

Karma: 1
Posts: 40


View Profile
« Reply #2 on: April 09, 2009, 08:37:24 AM »

-GPIO are in the SD slot, which means you have to choose SD or GPIO.

BTW, check this file: http://www.marvell.com/files/products/embedded_processors/kirkwood/FS_88F6180_9x_6281_OpenSource.pdf

very nice! The SDIO section was not that useful, but it appears that the MPP pins are each addressable via a set of registers (see page 773). The diagram shows MPP 12-17 as being connected here.

Finally, looking at the diagram you linked to, it looks like the TWSI should be inside at some flex connector (in the dev board), so maybe if you open it there is some pin or pad where you can connect to.

Yea, the diagram shows it, but the schematics either don't have the flex connector on them, or there is no TWSI on it.

the "Sheeva_JTAG Schematic.pdf" page 1 shows an "FPC connector", which according to google is a flex-connector, so i'm guessing that's the one.

There are 30 pins shown, but all are MPP pins, Jtag pins, and some power. no i2c looking stuff.

-tmk
Logged

karurosu
Global Moderator
Full Member
*****

Karma: 0
Posts: 116



View Profile WWW
« Reply #3 on: April 09, 2009, 08:56:44 AM »

Hi again, looking on the net I found this:
http://www.dilnetpc.com/emblinx9e.PDF

This may be one way to use the GPIO ports (a bit hacker-y in my personal opinion) another would be to see if the ports are supported under the GPIO module.

Hope that it helps
Logged

tmk
Newbie
*

Karma: 1
Posts: 40


View Profile
« Reply #4 on: April 16, 2009, 12:11:48 AM »

I found where the GPIO functions are first called out by the kernel:

Code:
arch/arm/plat-feroceon/mv_hal/gpp

Should be a good starting place for poking around.

-tmk
Logged

kens
Newbie
*

Karma: 0
Posts: 10


View Profile
« Reply #5 on: June 14, 2009, 03:24:03 PM »

I've been looking at how to access the I2C /TWSI port.  According to the Hardware Specifications [1] p.53, the TW_SDA and TW_SCK can be mapped to the multi-purpose pins MPP8 and MPP9.  Unfortunately these pins are used for the UA_RTS and UA_CTS UART connection to the mini-USB.  (They appear in the schematic as connected to pin 23 and 23 on the 30-pin connectors.)

I think what you'd need to do to use this is change the MPP register setup in the kernel (however that's done) to map the TW functions to MPP8 and MPP9.   You wouldn't be able to use the development board, since those pins are connected to the USB chip.  Although maybe you could also direct UA_RTS and UA_CTS to MPP15 and MPP16, wire those pins to the USB chip, and then use both the mini-USB and TWSI.  (The mappings between the I/O functions and the 50 MPP pins is a bit confusing, as each pin can map to up to 8 different functions, and each function can map only to one or a few specific pins.  Examining the hardware specifications document will clarify this.)

My understanding from the schematic [2] is that MPP0-5 and MPP18-19 are used for NAND flash, MPP6 is used for reset, MPP7 is used for ?, MPP28-29 are used for USB power control, MPP33 is used for ?, and MPP49 is used for a LED.  The other MPP pins are available on the 30-pin connectors, but MPP8-11 are used for UART for the mini-USB, and MPP12-17 are used for the SD card.  This constrains what functions can be used on the remaining pins.  For instance, SPI requires some of the pins used by NAND flash, so it's not available.  It looks like the unused MPP pins are 20-27, 31-32, and 34-48.

(I should mention that I haven't tried any of this.)

[1] http://www.marvell.com/files/products/embedded_processors/kirkwood/HW_88F6281_OpenSource.pdf
[2] http://www.plugcomputer.org/index.php/us/component/content/article/39-sch-and-bom/52-files
Logged

tmk
Newbie
*

Karma: 1
Posts: 40


View Profile
« Reply #6 on: June 14, 2009, 05:03:38 PM »

I've updated a few other threads.

My solution to this and other problems was to just get at the pins via GPIO, and then bit-bang the desired protocols.

In order to make the gpio pins available, I believe you do need to edit some of the kernel code and note that the pins are available.

Also, you'll need some sort of custom-module to tell the kernel which gpio pins are to be used for what purpose.

I was able to bit-bang the dallas 1-wire bus pretty easily, and i'm assuming i2c should work fine also. Haven't needed to yet.

-tmk
Logged

prafulla
Global Moderator
Newbie
*****

Karma: 0
Posts: 21


View Profile
« Reply #7 on: June 14, 2009, 10:24:55 PM »

Hi
In order to do i2c over GPIO's (data lines of SDIO interface on Sheevaplug,
1. you need to first modify kernel configuration to disable SDIO driver,
2. then plug some sdio h/w in the slot and interface the datalines with some i2c device
3. remember and be careful becasue power and ground connections will also be exposed on this interface and if not handled properly that may dammage SoC or board components.
4. then you need to create/use/enable a bit-banged i2c driver in the kernel
5. Also you need to configure Mpps to enable gpios for pins you are using.
6. then test the interface... good luck :-)

The exercise may not be as simple as I have explained above...

Regards..
Prafulla . .
Logged

kens
Newbie
*

Karma: 0
Posts: 10


View Profile
« Reply #8 on: June 15, 2009, 07:53:25 AM »

I assume that if you use I2C (either bit-banged GPIO or via the TWSI pins), you'd need to use 3.3V devices since the Sheevaplug is 3.3V.  I expect that applying 5V to the Sheevaplug inputs would be a bad thing.   (Based on my reading of the datasheet, not experience.)
Logged

tmk
Newbie
*

Karma: 1
Posts: 40


View Profile
« Reply #9 on: June 15, 2009, 08:35:40 AM »

Hi
In order to do i2c over GPIO's (data lines of SDIO interface on Sheevaplug,
1. you need to first modify kernel configuration to disable SDIO driver,
...
6. then test the interface... good luck :-)

The exercise may not be as simple as I have explained above...

yep, that's pretty much how it went Smiley

I posted pics and such here:
http://openplug.org/plugforum/index.php?topic=104 (scroll down)

-tmk
Logged

Pages: [1]
Print
Jump to: