cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103CB with ST25DV04 using I2C2 bus

Jacek Pieczaba
Associate II

Hello,

When we use the APB1 clock 2MHz for peripherals I don't see any problem with communications between memory and MCU. However I would like to increase the APB1 clock to around 16MHz for my final application do the the fact that other devices needed it. However when I increase the APB1 clock rate to i.e 4MHz I already see data line corrupted on I2C bus.

I am using 10k pull-up resistors to drive on SDA and SCL lines.

I would like to ask you if you have faced with the similar problem and if yes do you have any suggestion to resolve it?

Thank you in advance

Jacek Pieczaba

1 ACCEPTED SOLUTION

Accepted Solutions
Ronald B.
Associate III

​Hi,

To complement Rene's comment:

  1. Please check also the value of the CCR I2C register
  2. Check as well the GPIO_InitTypeDef Speed that is set in your project for the I2C IOs. You may try a higher Speed configuration.

Regards.

View solution in original post

4 REPLIES 4
Rene Lenerve
ST Employee

Hi Jacek,

The I²C in the MCU is working in standard mode and fast mode. If you have programmed it for standard mode, I thing that your 10k pull-up resistors are good values.

If you are using the Cube environment for your firmware normally you should not have to do something, it is managed by the HAL driver. Just setting the I²C speed is needed.

In case you don't use Cube, take care to have updated the I2C_CR2 register (more specifically the FREQ bit-field according to your new Peripheral Clock frequency). You can refer to the reference manual "https://www.st.com/content/ccc/resource/technical/document/reference_manual/59/b9/ba/7f/11/af/43/d5/CD00171190.pdf/files/CD00171190.pdf/jcr:content/translations/en.CD00171190.pdf" section 26.3.3 and 26.6 (for register mapping).

Regards.

Ronald B.
Associate III

​Hi,

To complement Rene's comment:

  1. Please check also the value of the CCR I2C register
  2. Check as well the GPIO_InitTypeDef Speed that is set in your project for the I2C IOs. You may try a higher Speed configuration.

Regards.

Jacek Pieczaba
Associate II

Good morning,

Thank you very much for fast suggestions. I will test it right away today.. I will keep you posted about progress...

Thank you again

Jacek

Jacek Pieczaba
Associate II

Hello,

I have tried the High Speed Configuration and it looks that is works exactly how I wanted. Thank you again for suggestions.

With Best Regards,

Jacek Pieczaba