cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F101T6 i2c issues

Rami Rosenbaum (old)
Associate II
Posted on January 25, 2017 at 08:56

Hi,

I'm working on a STM32F101T6U6ATR, and need to 'talk' with it via i2c (PB6, PB7).

There's an errata (STM32F10xx4 STM32F10xx6 Errata sheet, en.CD00211391.pdf) talking about lot's of i2c issues.

I've created a project with Cube (version 4.19.0), using FW_F1 V1.4.0.

I took i2c example code from the installed Cobe repository (c:\Users\user\STM32Cube\Repository\STM32Cube_FW_F1_V1.4.0\Projects\), but am not sure which board to take as reference, so defaulted to the STM32F103RB-Nucleo.

I have encountered many problems: Master mode stuck on BUSY state, Slave mode stuck after single transaction, etc.

I've set up 2 Discovery boards (STM32F0308-DISCO and STM32F072B-DISCO), connecting their PB6-7 i2c pins, and ran the Cube i2c examples, and they all work fine, seeing the data with an analyzer.

Any help or sample code will be much appreciated.

Thanks

#i2c #stmf101
7 REPLIES 7
Nesrine M_O
Lead II
Posted on January 25, 2017 at 09:50

Hi

Rosenbaum.Rami

,

  1. try to start withI2C examples under the STM32F1 firmware package: STM32Cube_FW_F1_V1.4.0\Projects\STM32F103RB-Nucleo\Examples\I2C
  2. Connect the 4.7k pull-up resistor as it is shown in the figure below

    0690X000006062nQAA.png

-Nesrine-

Posted on January 25, 2017 at 10:14

Thanks for the quick reply.

I can try the HW change in development, but I'm working on a given HW, 2 boards (STM32F101CBT6 master and STM32F101T6U6ATR slave), connected directly via i2c, VCC and GND.

No HW changes possible...

Posted on February 09, 2017 at 10:53

Hi,

Took some time to get the schema.

So I have this funny drawing on the slave STM32F101T6U6ATR side.

I'm not a HW guy, so I roughly understand there's a 4.7 pull-up resistor, but will be glad to understand the details... thanks 🙂

0690X00000606HRQAY.png

I ran the STM32Cube_FW_F1_V1.4.0\Projects\STM32F103RB-Nucleo\Examples\I2C\I2C_TwoBoards_ComIT slave application on the board, connected to the STM32F072B-DISCO master, which sends 10 bytes ''0123456789'', but the slave constantly got stuck after the 8'th byte.

Posted on February 09, 2017 at 11:06

that is a very unusual circuit.

and looks incorrect.

Did you make this circuit ?

or is it on a board that you purchased ?

the part AMP0504 is basically an ESD protection device. protecting the 3v3 rail and the SDA and SCL lines for OFF board connections.

but pin 5 should be connected directly to the rail3v3

and then SCL and SDA should have their own separate pullups.  4k7 or 10k is ok for 100KHz

in the circuit above the SDA line is not pulled up. and therefore is unlikely to run correctly.

the AMP part is not needed if all the signals reside on one board.

Posted on February 09, 2017 at 11:30

It's a new project.

I'm supposed to upgrade the firmware of 2 small stm32-based boards, communicating via i2c.

The HW is given, the company who created them are gone.

I'm a SW programmer, embedded, low-level, with a bit of HW knowledge, but don't know what this is.

I didn't get a chance to sniff the i2c on the original application version, so I don't know if they were using the HW i2c or bit-banging or something else (maybe see from the protocol/speed).

Posted on February 09, 2017 at 11:43

You definitely  need the extra pull-up, that other part is useless in its current form, but it wont stop it working after you add the SDA pullup.

Posted on February 27, 2017 at 16:21

Hi,

I got the i2c to work, standard mode, passed 512-byte buffers both ways. No stress test, so I don't know how stable.

But, I finally got hold of the original applications, and turns out they're talking UART!!!

Thanks for the help.