I2C set stop condition after read does not work

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

cross mob
Anonymous
Not applicable

Hello,

I am reading values via I2C from an RTC (RX8010SJ) in Master mode.

This works so far, but the I2C Stop Condition is not set. Subsequent I2cStart then returns error -2 (Timeout).

I am using the command "pstcI2c->IBCR = 0x01;" from mb9bfxxx_l3-v19.

When I configure SDA and SCL as inputs manually, the Stop Condition is set and recognized by the slave.

There are no examples for I2C master mode in Cypress' PDL 2.0.1, only for slave mode.....

Any hints?

Best regards,

Falk

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

If you are not using MDK-KEIL, please ignore following.

The problem I encountered at the thread

I2C read hangs with MDK (PDL 2.1.0, PSoC Creator 4.0)

was not (last) ACK/NACK problem.

It was when assigning a byte to byte struct which comprises

multiple volatile bit fields  (having ~8 x 1_bit bit fields) type/struct,

GCC, IAR  spit a few mnemonics since it is an assignment of a byte,

but MDK-KEIL generates dozens of mnemonics since assigning

multiple volatile fields are prohibited.

(I think it was about 40~50 mnemonics)

And this made i2c timeout.

How about trying

(1) only assigning a bit field

pstcI2c->IBCR.SCC = 0x01;

(2) follow similar workaround shown in the thread

I2C read hangs with MDK (PDL 2.1.0, PSoC Creator 4.0)

moto

View solution in original post

0 Likes
3 Replies
GeonaP_26
Moderator
Moderator
Moderator
250 solutions authored 100 solutions authored 50 solutions authored

Please confirm whether this thread is helpful Bug in PDL v2.1.0 | mfs.c | I2C | Mfs_I2c_ConfigAck

0 Likes
Anonymous
Not applicable

No it is not helpful as it refers to (last) ACK/NACK.

This works for me but one clock cycle later the master does not create the Stop Condition.

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

If you are not using MDK-KEIL, please ignore following.

The problem I encountered at the thread

I2C read hangs with MDK (PDL 2.1.0, PSoC Creator 4.0)

was not (last) ACK/NACK problem.

It was when assigning a byte to byte struct which comprises

multiple volatile bit fields  (having ~8 x 1_bit bit fields) type/struct,

GCC, IAR  spit a few mnemonics since it is an assignment of a byte,

but MDK-KEIL generates dozens of mnemonics since assigning

multiple volatile fields are prohibited.

(I think it was about 40~50 mnemonics)

And this made i2c timeout.

How about trying

(1) only assigning a bit field

pstcI2c->IBCR.SCC = 0x01;

(2) follow similar workaround shown in the thread

I2C read hangs with MDK (PDL 2.1.0, PSoC Creator 4.0)

moto

0 Likes