VHDL I2c burst read

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

I used

formatting link
tutorial, can anybody exlpain me how to read burst data 16 bits from 2 registers or 6 regsiters ? by only one operation ?

I use

formatting link
(VHDL)-CodeDownload but reads only 1 byte .

any suggestion would be appreciated/

Reply to
abirov
Loading thread data ...

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
Reply to
rickman

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.

Reply to
abirov

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 ))).

Reply to
abirov

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
Reply to
rickman

data 16 bits from 2 registers or 6 regsiters ? by only one operation ?

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

Reply to
Svenn Are Bjerkem

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

WHEN read_data => ------------------------------------------------ message0 (15 downto 0)

Reply to
abirov

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.