FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6343 Discussions

I2C width problem...!

Altera_Forum
Honored Contributor II
1,296 Views

Hello, 

Suppose if slave device data width is 32 bit (means if we want to read it through i2c,slave device will output 32 bit data).But my I2C IP- receive register width is only 8 bit.so reading i2c results only to display 8 bit at a time.then how to get all 32 bits between one START and one STOP condition. 

So,kindly tell me,if i get first 8 bits of data,how to get another 8 bits of data then another.. upto 32 bits? 

In Nios II, I have put "counter" which counts up to four (4 bytes=32 bits),after that it will again reset to 0 and again new START condition which i have put in while(1) loop to read continuously 32 bits(4 bytes). 

Just want to know,will this work or will i get 32 bits data all properly which was actually transmitted from the slave device? or if any other solution,kindly suggest me. 

I have attached the code. 

 

Thanks.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
189 Views

You should refer to the slave device specification for details. Generally, the first byte after a start condition has to be a device address, written by the master.

0 Kudos
Altera_Forum
Honored Contributor II
189 Views

thanks for ur prompt reply but i know that actually i have done that also as u can see from the code attached.My question is after "start+device address+R/W+ACK(from slave)" and then slave will give 32 bit but my IP data width is 8 bit means it can accept only 8 bit at a time.So i should read 4 times,right? 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
189 Views

Yes usually the slaves that give 16 or 32 bit values can be accessed using 2 or 4 8-bit reads without having to specify a new address for each byte. Just continue reading 8-bits values.

0 Kudos
Reply