I2C Memory Address and Stop and start bit selection in FX-3 Cypress.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ThM_3776866
Level 4
Level 4
First like received First like given Welcome!

Hi all,

I am working on Cypess FX-3 I2C interface .My slave device is EEPROM his memory address length is varying depends on function. how to select the control mask value if different memory address length read and write operation.

Read operation:

given example code

if 1 byte --- ctrlMask=0x02

if 2 byte ---- ctrlMask = 0x04

Q1. Therefore what is the value of ctrlMask in 3-byte, 4-byte and 5-byte address?.

Q2. what is value of ctrlMask in case of repeated Write operation.?

Thank you.

Best regards,

Thrimurthi M

srntabgaprbd

0 Likes
1 Solution

Hi Thrimurthi,

Q1. Therefore what is the value of ctrlMask in 3-byte, 4-byte and 5-byte address?

an I2C EEPROM read requires the byte address for the read to be written first.

A.3- byte addressing mode with random read operation:

preamble.buffer[0] = SlaveAddr; /* Slave address: Write operation */

preamble.buffer[1] = (uint8_t)(( ByteAddr & 0Xff0000) >> 16);

preamble.buffer[2] = (uint8_t)( ByteAddr & 0x00ff00)

preamble.buffer[3] = (uint8_t)( ByteAddr & 0x0000ff)

preamble.buffer[4] = SlaveAddr | 0x1; /* Slave address: Read operation */

preamble.length = 5;

preamble.ctrlMask = 0x0008;

CyU3PI2cReceiveBytes (&preamble, testbuf, 1,0)

ctrlMask field will be 0x0008 as a start bit is required after the 4th byte (fourth bit is set)

B.3-byte addressing mode with random read operation:

The buffer field shall hold the 4 bytes, the length field shall be 4, and the ctrlMask field is zero as no additional start/stop conditions are needed.

-- 4-byte addressing mode with random read operation ctrlMask field will be 0x0010 as a start bit is required after the 5th byte (5th bit is set).

--5--byte addressing mode with random read operation ctrlMask field will be 0x0020 as a start bit is required after the 6th byte (6th bit is set).

--Only write operation ctrlMask field will be 0x0000.

Regards,

Anil Srinivas.

View solution in original post

0 Likes
3 Replies
alamandaa_16
Moderator
Moderator
Moderator
10 likes received First like received

Hi Thrimurthi,

Please go through the following link which speaks about I2C Memory addressing

"www.cypress.com/file/50506/download"

Regards,

Anil Srinivas.

0 Likes
ThM_3776866
Level 4
Level 4
First like received First like given Welcome!

Thanks for your replay..

Given "FX3_I2C_DETAILS" doc they mention only 2 byte memory address. they are not specifying 3,4,5 byte of memory address.

0nly Read operation the control mask is changing, but in Write operation control mask is always "0x0000" what is region?

Thank you

Best regards.

Thrimurthi M

0 Likes

Hi Thrimurthi,

Q1. Therefore what is the value of ctrlMask in 3-byte, 4-byte and 5-byte address?

an I2C EEPROM read requires the byte address for the read to be written first.

A.3- byte addressing mode with random read operation:

preamble.buffer[0] = SlaveAddr; /* Slave address: Write operation */

preamble.buffer[1] = (uint8_t)(( ByteAddr & 0Xff0000) >> 16);

preamble.buffer[2] = (uint8_t)( ByteAddr & 0x00ff00)

preamble.buffer[3] = (uint8_t)( ByteAddr & 0x0000ff)

preamble.buffer[4] = SlaveAddr | 0x1; /* Slave address: Read operation */

preamble.length = 5;

preamble.ctrlMask = 0x0008;

CyU3PI2cReceiveBytes (&preamble, testbuf, 1,0)

ctrlMask field will be 0x0008 as a start bit is required after the 4th byte (fourth bit is set)

B.3-byte addressing mode with random read operation:

The buffer field shall hold the 4 bytes, the length field shall be 4, and the ctrlMask field is zero as no additional start/stop conditions are needed.

-- 4-byte addressing mode with random read operation ctrlMask field will be 0x0010 as a start bit is required after the 5th byte (5th bit is set).

--5--byte addressing mode with random read operation ctrlMask field will be 0x0020 as a start bit is required after the 6th byte (6th bit is set).

--Only write operation ctrlMask field will be 0x0000.

Regards,

Anil Srinivas.

0 Likes