FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
6033 Discussions

CYCLONE V - HPS and I2C Pins on DE1-SoC Board

StefanoMarsi
New Contributor I
882 Views

Hi Community

I'm trying to access an I2C Device connected to the LTC 2x7 connector available
on a DE1-SoC Board.

I would like to communicate with the device using the I2C peripheral registers
available for the HPS embedded in the Cyclone V.

Typically I2C communication requires (both in reading and writing)
- the slave address
- the register address 
- the data (to write or to read)

Looking at the entire documentation I'm not able to find who to pass the REGISTER ADDRESS 
or how the peripheral register must be set!

Thank you in advance for your help!

 

Labels (1)
0 Kudos
1 Solution
StefanoMarsi
New Contributor I
848 Views

Thank you

I've made some steps toward the solution:
I write here to help some others:

INITIALIZATION:

1: Disable Controller  0x6C <-- 0

2: Configure Controller to be a MASTER, set lenght to 7 bit, freq 100kH  0x00 <--63

3: Setting Target Address 0x04 <-- I2C address (for MPU6050 = 68)

4: Enable Controller 0x6C <-- 1

 

WRITE on register 0xXY the data 0xPQ

1: Write Slave address and Register address  on I2C WITHOUT releasing bus (NO send STOP)  0x10 <-- 0xXY

2: Write Data:  0x10 <-- 0xPQ

3: you can continue writing the data for reg. (XY+1) ,  (XY+2) ....

4: to release the bus 0x10 <--0x2PQ  (Write data and generate STOP)

 

READ on register 0XY

1: Write Slave address and Register address  on I2C WITHOUT releasing bus (NO send STOP)  0x10 <-- 0xXY

2: Read Data and generate a STOP 0x10 <-- 3ZZ 

 

Please note that the signals generate (on the oscilloscope)  seams compatible with the protocol and the data
But data read on the Driver Registers are still instable and quasi-Random.

 

 

View solution in original post

0 Kudos
6 Replies
mabdrahi
Employee
863 Views

Hi Stefano,


I try to look information about who to pass the REGISTER ADDRESS 

or how the peripheral register must be set.


currently I dont have instant answer for that yet.

Stay tune


Thank you,

Aliff


0 Kudos
StefanoMarsi
New Contributor I
849 Views

Thank you

I've made some steps toward the solution:
I write here to help some others:

INITIALIZATION:

1: Disable Controller  0x6C <-- 0

2: Configure Controller to be a MASTER, set lenght to 7 bit, freq 100kH  0x00 <--63

3: Setting Target Address 0x04 <-- I2C address (for MPU6050 = 68)

4: Enable Controller 0x6C <-- 1

 

WRITE on register 0xXY the data 0xPQ

1: Write Slave address and Register address  on I2C WITHOUT releasing bus (NO send STOP)  0x10 <-- 0xXY

2: Write Data:  0x10 <-- 0xPQ

3: you can continue writing the data for reg. (XY+1) ,  (XY+2) ....

4: to release the bus 0x10 <--0x2PQ  (Write data and generate STOP)

 

READ on register 0XY

1: Write Slave address and Register address  on I2C WITHOUT releasing bus (NO send STOP)  0x10 <-- 0xXY

2: Read Data and generate a STOP 0x10 <-- 3ZZ 

 

Please note that the signals generate (on the oscilloscope)  seams compatible with the protocol and the data
But data read on the Driver Registers are still instable and quasi-Random.

 

 

0 Kudos
mabdrahi
Employee
796 Views

Hi Stephano,


Below is the link to I2C register map for HPS Cyclone 


https://www.intel.com/content/www/us/en/programmable/hps/cyclone-v/hps.html#sfo1410069829440.html#sfo1410069829440


Before i further investigate, are you using creating application for linux or baremetal?


Thank you,

Aliff



0 Kudos
mabdrahi
Employee
774 Views

Hi Stefano,


Can i have answer from my previous question?


Thank you,

Aliff


0 Kudos
StefanoMarsi
New Contributor I
760 Views

As I've already written above:

I found the correct command sequence to read and write on the I2C bus using the embedded registers of the driver.

As a final note: The proposed sequence of commands works pretty well if provided through a suitable algorithm (for instance written in C) while it does not work if provided,  writing directly on the peripheral interface address location using Altera Monitor Program, may be because this tool is unable to  perform separately the read and write procedure.

0 Kudos
mabdrahi
Employee
753 Views

Hi Stefano,


So, I shall set this case to close pending. If you still need further assistance, you are welcome reopen this case within 20days or open a new case, someone will be right with you.

If you happened to close this case you will receive a survey. If you think you would rank your support experience less than 4 out of 5, please allow me to correct it before closing or if the problem can’t be corrected, please let me know the cause so that I may improve your future service experience.


Thank you,

Aliff



0 Kudos
Reply