Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing with PMOD GYRO (I2C)

Status
Not open for further replies.

tacker

Newbie level 2
Newbie level 2
Joined
Nov 27, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
25
Hi,

I am working on a project that uses the Virtex 5 board. I have been researching everywhere on how to interface with the Digilent PMOD GYRO (L3G4200D) through I2C core. I have set up the I2C core in the Xilinx EDK and exported the design to SDK. Now I am stuck on what the basic function calls (in C) are to simply interface with the device and read the X,Y, and Z angular rates. I know the general that you must:

LookupConfig
Initialize

Start
send slave address + write
..receive acknowledge(?)
send register address
..receive acknowledge(?)
slave address + read
??
Stop

I am just confused as to what function call each step utilizes (what function and where it comes from eg: XIic_MasterRecv from xiic.h)
and what happens after we send slave address and attempt to receive a byte.

Any help would be appreciated! Thank you.
 

Hi,

I am working on a project that uses the Virtex 5 board. I have been researching everywhere on how to interface with the Digilent PMOD GYRO (L3G4200D) through I2C core. I have set up the I2C core in the Xilinx EDK and exported the design to SDK. Now I am stuck on what the basic function calls (in C) are to simply interface with the device and read the X,Y, and Z angular rates. I know the general that you must:

LookupConfig
Initialize

Start
send slave address + write
..receive acknowledge(?)
send register address
..receive acknowledge(?)
slave address + read
??
Stop

I am just confused as to what function call each step utilizes (what function and where it comes from eg: XIic_MasterRecv from xiic.h)
and what happens after we send slave address and attempt to receive a byte.

Any help would be appreciated! Thank you.

1. have a look at your Xilinx\"version"\ISE_DS\EDK\sw\XilinxProcessorIPLib\drivers\iic_"version"\examples

2. i think the relevant example for you is : xiic_repeated_start_example.c

3. if you are stuck you can implement the i2c hw yourself and use gpio to control it.
 

1. have a look at your Xilinx\"version"\ISE_DS\EDK\sw\XilinxProcessorIPLib\drivers\iic_"version"\examples

2. i think the relevant example for you is : xiic_repeated_start_example.c

3. if you are stuck you can implement the i2c hw yourself and use gpio to control it.


Thank you very much for your quick and helpful reply.

I think I have that down, so if I'm correct it looks like I:
set the address of the slave
start
perform a master_send with the register address that I want to eventually read from and the 'read' bit at the end.
set repeated start option
then master_rec to grab the value off the bus
and again to get next value
stop.


And just to make sure I added the I2C core properly in EDK, maybe you could help me through those steps? So I had a previous hardware setup with a plb bus containing low speed peripherals (Push buttons, LEDs, etc):
I then added an IIC device and connected it to this existing bus.
Then I went to ports and set the scl and sda to external
I also set up the interupt
In the ucf I connected the external scl and sda pin to connect to the appropriate
pin on the JA pmod.

A few questions:
1) Is it ok that I added the device to an existing bus with different peripherals?
Or should I need to create a new bus?
2) Either way, does the bus clk need to be the clk speed that the Pmod gyro requires? ie 100Khz or 400Khz. Right now it is set up as 125Mhz I believe.


Thank you again.
 

Thank you very much for your quick and helpful reply.

I think I have that down, so if I'm correct it looks like I:
set the address of the slave
start
perform a master_send with the register address that I want to eventually read from and the 'read' bit at the end.
set repeated start option
then master_rec to grab the value off the bus
and again to get next value
stop.


And just to make sure I added the I2C core properly in EDK, maybe you could help me through those steps? So I had a previous hardware setup with a plb bus containing low speed peripherals (Push buttons, LEDs, etc):
I then added an IIC device and connected it to this existing bus.
Then I went to ports and set the scl and sda to external
I also set up the interupt
In the ucf I connected the external scl and sda pin to connect to the appropriate
pin on the JA pmod.

A few questions:
1) Is it ok that I added the device to an existing bus with different peripherals?
Or should I need to create a new bus?
2) Either way, does the bus clk need to be the clk speed that the Pmod gyro requires? ie 100Khz or 400Khz. Right now it is set up as 125Mhz I believe.


Thank you again.

1. it is ok.
2. use the bus clock rate 125mhz...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top