cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Slave Transmitter

bala_jss
Associate II
Posted on August 20, 2008 at 11:47

I2C Slave Transmitter

6 REPLIES 6
bala_jss
Associate II
Posted on May 17, 2011 at 12:16

I am using a STM32F103 and trying to write (interrupt driven) code for a slave transmitter. (slave receiver works fine). I get the I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED event in the ISR, and read I2C_GetLastEvent (reads SR1, SR2 to clear ADDR), and TXE is 1 before I send data. When I try to send data, I dont see anything on the master. Am I missing anything?

Do you have any sample code fo the I2c slave in Tx mode /combined (Rx to Tx) mode ?

Any help will be greatly appreciated.

16-32micros
Associate III
Posted on May 17, 2011 at 12:16

Dear bala_jss ,

You can refer to the

http://www.st.com/stonline/products/support/micro/files/um0427.zip

there are 5 examples for I2C :

Example1 : Transfer a data buffer from I2C1 to I2C2 using interrupts.

Example2 : Transfer two data buffer from I2C1 to I2C2 through its two addresses in the same application.

Example3 : Send an ARP command from I2C1 to I2C2 in SMBus mode.

Example4 : Transfer a data buffer from I2C1 to I2C2 in 10-bit addressing mode..

Example5 : Use the I2C firmware library and an associate I2C EEPROM driver to communicate with an M24C08 EEPROM.

Regards,

STOne-32.

[ This message was edited by: STOne-32 on 12-10-2007 22:24 ]

bala_jss
Associate II
Posted on May 17, 2011 at 12:16

Thanks for the links - they use the I2C in Master TX /Slave RX mode. I dont see any in Slave TX mode.

skeating
Associate
Posted on May 17, 2011 at 12:16

Hi bala_jss,

Have you been able to resolve the problem? I'm currently in the same situation. I have taken Example 1 of the ST sample code and attempted to re-write it to perform a basic Master receiver (I2C1) - Slave transmitter (I2C2) but have been unsuccessful at this point. I too see the I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED occur but I never get to the I2C_EVENT_SLAVE_BYTE_TRANSMITTED event.

Regards,

skeating

sajris
Associate
Posted on May 17, 2011 at 12:16

Hi skeating

I have a similar problem - did you find a solution to your problem with the I2c slave transmit?

Regards

sajris

skeating
Associate
Posted on May 17, 2011 at 12:16

sajris,

The I2C_EVENT_SLAVE_BYTE_TRANSMITTED event requires the BTF bit to be asserted. This never occurred in my case. I worked with one of the ST app engineers on this but I've not gotten a response back yet. An easy fix for me was to generate a new event which excludes the BTF and that seems to work fine.

Regards,

skeating