cancel
Showing results for 
Search instead for 
Did you mean: 

I2C slave cannot trigger STOP

ann_lee
Associate II
Posted on December 27, 2007 at 16:11

I2C slave cannot trigger STOP

3 REPLIES 3
ann_lee
Associate II
Posted on August 28, 2007 at 05:31

Hi

I have a problem. I cannot get stop event trigger when I2C slave is transmitter. But ok if I2C slave is receiver.

After ''I2C_EVENT_SLAVE_ACK_FAILURE'' trigger,

and I send ''I2C_SendData(0xFF);''

I get a event trigger said I2C_SR1 = 0xB8 and I2C_SR2 = 0.

And I found SDA line cannot be controlled when master send STOP.

Below is a part of my code in 75x_it.c. Almost same as sample code.

void I2C_IRQHandler(void)

{

switch (I2C_GetLastEvent())

{

case I2C_EVENT_SLAVE_ADDRESS_MATCHED:

RX_ptr = 0;

break;

case I2C_EVENT_SLAVE_BYTE_RECEIVED:

RX_rbuf[RX_ptr++] = I2C_ReceiveData();

break;

case I2C_EVENT_SLAVE_BYTE_TRANSMITTED:

I2C_SendData(RX_wbuf[RX_ptr++]);

break;

case I2C_EVENT_SLAVE_ACK_FAILURE:

I2C_SendData(0xFF);

break;

case I2C_EVENT_SLAVE_STOP_DETECTED:

break;

default:

break;

}

}

Appreciate any comment.

An

ann_lee
Associate II
Posted on August 29, 2007 at 00:03

Hi

Now it work well!!

I changed master.

Before...

All my event responses is same as below from somebody using ARM9

http://mcu.st.com/mcu/modules.php?mop=modload&name=Splatt_Forums&file=viewtopic&topic=5061&forum=21

I cannot get STOP event trigger.

I used two GPIO pin as sw I2C master.

And set hw I2C as slave.

In the face it work well when master send data (hw I2C (slave) as receiver). I can get all event trigger include addr, byte RX and stop.

When master get data from slave, only STOP event cannot trigger.

Then I changed another external master device, it work well.

An

ucoskun
Associate II
Posted on December 27, 2007 at 16:11

Hello,

I have a problem with STR752 slave operation. Your and my interrupt routines are same. But I think my code doesn't occur I2C interrupt. Can you please send me I2C configuration (main) code. Thank you in advance.

Happy new year 2008.

Best regards.

Ugur