EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

VHDL I2c burst read

Ask a question - edaboard.com

elektroda.net NewsGroups Forum Index - FPGA - VHDL I2c burst read


Guest

Thu Jan 05, 2017 1:36 pm   



Dear All, please help with VHDL, i connected MPU6050 to my FPGA board.

I used www.eewiki.com tutorial, can anybody exlpain me how to read burst data 16 bits from 2 registers or 6 regsiters ? by only one operation ?

I use https://eewiki.net/pages/viewpage.action?pageId=11042934#SPItoI2CBridge(VHDL)-CodeDownload but reads only 1 byte .

any suggestion would be appreciated/


Guest

Thu Jan 05, 2017 3:21 pm   



On Thursday, January 5, 2017 at 6:33:36 PM UTC+6, rickman wrote:
Quote:
On 1/5/2017 6:36 AM, abirov_at_gmail.com wrote:
Dear All, please help with VHDL, i connected MPU6050 to my FPGA board.

I used www.eewiki.com tutorial, can anybody exlpain me how to read burst data 16 bits from 2 registers or 6 regsiters ? by only one operation ?

I use https://eewiki.net/pages/viewpage.action?pageId=11042934#SPItoI2CBridge(VHDL)-CodeDownload but reads only 1 byte .

any suggestion would be appreciated/

The eewiki page is about connecting an SPI master to an I2C slave
through an FPGA. Is that what you are doing?

The intro says the bridge will read 8 bit I2C registers. It doesn't say
anything about reading multiple registers in one SPI operation. In
fact, the SPI Mode section says the SPI interface must receive a 33 bit
command to transfer a single 8 bit byte from the I2C slave to the SPI
master.

I think if you want to do large transfers in one operation you will need
to substantially change the SPI interface in the FPGA and possibly the
rest of the design as well.

--

Rick C


Yes it is, i try to change i2c_to_spi conversion to i2c_to_PWM for servo, so I need 16 bit word from 2 register.


Guest

Thu Jan 05, 2017 3:25 pm   



On Thursday, January 5, 2017 at 6:33:36 PM UTC+6, rickman wrote:
Quote:
On 1/5/2017 6:36 AM, abirov_at_gmail.com wrote:
Dear All, please help with VHDL, i connected MPU6050 to my FPGA board.

I used www.eewiki.com tutorial, can anybody exlpain me how to read burst data 16 bits from 2 registers or 6 regsiters ? by only one operation ?

I use https://eewiki.net/pages/viewpage.action?pageId=11042934#SPItoI2CBridge(VHDL)-CodeDownload but reads only 1 byte .

any suggestion would be appreciated/

The eewiki page is about connecting an SPI master to an I2C slave
through an FPGA. Is that what you are doing?

The intro says the bridge will read 8 bit I2C registers. It doesn't say
anything about reading multiple registers in one SPI operation. In
fact, the SPI Mode section says the SPI interface must receive a 33 bit
command to transfer a single 8 bit byte from the I2C slave to the SPI
master.

I think if you want to do large transfers in one operation you will need
to substantially change the SPI interface in the FPGA and possibly the
rest of the design as well.

--

Rick C


I made register map file where is just puts device address, register address and value to make write or read operation and it write some value to initial device and reads results, but only 8 bits .
I think somewhere in I2C master or user logic file need to make edition. But my knowledge of VHDL is limited and cannot develop it more ))).

rickman
Guest

Thu Jan 05, 2017 7:33 pm   



On 1/5/2017 6:36 AM, abirov_at_gmail.com wrote:
Quote:
Dear All, please help with VHDL, i connected MPU6050 to my FPGA board.

I used www.eewiki.com tutorial, can anybody exlpain me how to read burst data 16 bits from 2 registers or 6 regsiters ? by only one operation ?

I use https://eewiki.net/pages/viewpage.action?pageId=11042934#SPItoI2CBridge(VHDL)-CodeDownload but reads only 1 byte .

any suggestion would be appreciated/


The eewiki page is about connecting an SPI master to an I2C slave
through an FPGA. Is that what you are doing?

The intro says the bridge will read 8 bit I2C registers. It doesn't say
anything about reading multiple registers in one SPI operation. In
fact, the SPI Mode section says the SPI interface must receive a 33 bit
command to transfer a single 8 bit byte from the I2C slave to the SPI
master.

I think if you want to do large transfers in one operation you will need
to substantially change the SPI interface in the FPGA and possibly the
rest of the design as well.

--

Rick C

rickman
Guest

Thu Jan 05, 2017 8:47 pm   



On 1/5/2017 8:25 AM, abirov_at_gmail.com wrote:
Quote:
On Thursday, January 5, 2017 at 6:33:36 PM UTC+6, rickman wrote:

The eewiki page is about connecting an SPI master to an I2C slave
through an FPGA. Is that what you are doing?

The intro says the bridge will read 8 bit I2C registers. It doesn't say
anything about reading multiple registers in one SPI operation. In
fact, the SPI Mode section says the SPI interface must receive a 33 bit
command to transfer a single 8 bit byte from the I2C slave to the SPI
master.

I think if you want to do large transfers in one operation you will need
to substantially change the SPI interface in the FPGA and possibly the
rest of the design as well.

I made register map file where is just puts device address, register address and value to make write or read operation and it write some value to initial device and reads results, but only 8 bits .
I think somewhere in I2C master or user logic file need to make edition. But my knowledge of VHDL is limited and cannot develop it more ))).


VHDL isn't the issue until you understand how to use the I2C bus. Your
other post seemed to indicate you are using an I2C master to control a
servo with a PWM signal. Is that correct? I am no expert on I2C, but I
believe it is not hard to send two bytes in one command. You need to
study the I2C bus spec.

If the entire I2C to PWM design is in your FPGA it should not be hard to
design it to not glitch as the two 8 bit registers are updated
separately. So there are two ways to do this.

--

Rick C

Svenn Are Bjerkem
Guest

Mon Jan 09, 2017 10:03 am   



torsdag 5. januar 2017 12.36.19 UTC+1 skrev abi...@gmail.com følgende:
Quote:
Dear All, please help with VHDL, i connected MPU6050 to my FPGA board.

I used www.eewiki.com tutorial, can anybody exlpain me how to read burst data 16 bits from 2 registers or 6 regsiters ? by only one operation ?

I use https://eewiki.net/pages/viewpage.action?pageId=11042934#SPItoI2CBridge(VHDL)-CodeDownload but reads only 1 byte .

any suggestion would be appreciated/


I learned a lot of I2C from the I2C reference design for picoblaze embedded microcontroller in Xilinx. Picoblaze has a complete tool chain from assembler to VHDL, and the code for the mcu can be downloaded to chip with JTAG to shorten development cycle.


Guest

Sat Jan 14, 2017 12:28 pm   



I modified user logic from eewiki.com if someone need please use code below :

WHEN read_data => ------------------------------------------------

message0 (15 downto 0) <= "0000000000000000";

i2c_busy_prev <= i2c_busy;
IF (i2c_busy_prev = '0' AND i2c_busy = '1') THEN
i2c_busy_cnt := i2c_busy_cnt + 1;
END IF;
CASE i2c_busy_cnt IS
WHEN 0 =>
i2c_ena <= '1';
i2c_addr <= data_in(6 downto 0);
i2c_rw <= '0';
i2c_data_wr <= data_in(14 downto 7);
WHEN 1 =>
i2c_ena <= '1';
i2c_rw <= data_in(15);
i2c_data_wr <= data_in(23 downto 16);
WHEN 2 =>
i2c_ena <= '1';
IF (i2c_busy = '0') THEN
message(15 downto Cool <= i2c_data_rd;
END IF;
WHEN 3 =>
i2c_ena <= '0';
IF (i2c_busy = '0') THEN
message(7 downto 0) <= i2c_data_rd;
message(16) <= i2c_ack_err;
i2c_busy_cnt := 0;
state <= combine;
END IF;
WHEN OTHERS => NULL;

elektroda.net NewsGroups Forum Index - FPGA - VHDL I2c burst read

Ask a question - edaboard.com

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map