cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with I2c and STM32F103

niek_ebbers
Associate II
Posted on September 05, 2008 at 08:20

Problem with I2c and STM32F103

4 REPLIES 4
niek_ebbers
Associate II
Posted on May 17, 2011 at 12:43

I'm trying to use the I2C with a m24c64-wmn6 EERPOM. I'm using pb8 and pb9 for I2C output, so I've remapped the peripheral to these pins.

The START command works fine, but when I send the Address, the ADDR bit is never set.

The scope tells me that the data isn't send in the proper way. The SDA-pin changes state on the falling flank of SCL, not on the rising. The NACK from the EEPROM is written on the rising flank.

I'm not using the libraries provided with the controller, but I've wrote my own.

Has anyone encountered this problem before?

If necessary, I can post my code.

[ This message was edited by: niek_ebbers on 04-09-2008 16:37 ]

jaroslaw2
Associate II
Posted on May 17, 2011 at 12:43

Did you check if you send address twice (in two bytes)? The library example send only one byte address. I have used it with lib v1.1 and it works now I am working with lib v2.0 but I didn't check it if this works with lib 2.0 as well.

[ This message was edited by: jaroslaw.oska on 05-09-2008 09:01 ]

[ This message was edited by: jaroslaw.oska on 05-09-2008 09:02 ]

niek_ebbers
Associate II
Posted on May 17, 2011 at 12:43

I'm using 7 bit addressing mode so one byte should be enough.

The main problem is that the SDA line sends it's bits on the rising flank of SCL, but I need it to send it on the falling edge.

lanchon
Associate II
Posted on May 17, 2011 at 12:43

I've posted master mode i2c code that works and a couple of posts detailing limitations of the i2c macrocell, look them up if you want.