I have a problem, I use a microcontroller and RTC STM32L052K8U DS3232M and I can not connect via I2C with RTC, using the HAL library. From the watch constantly comes NACK. The wizard sends the correct address (I'm sure of that, but just in case I also ran queries in a loop to addresses from 0x00 to 0xFF). Tightening on the I2C line is (there are resistors on 1 kΩ, voltage 3.3 V), on the power bus hours as 3.3 V, no batteries. Timing filed with MSI, and HSI, and PLLCLK (32 MHz). Below are screenshots of the settings. For what reason can the RTC not respond?

This is the datasheet of the clock

int main(void){


  while (1)  {
    uint8_t aTxBuffer[8];
    stat = HAL_I2C_Mem_Read( &hi2c1, 0x68 << 1, 0x0E, 
                          I2C_MEMADD_SIZE_16BIT, aTxBuffer, 1, 1000 );



I2C configuration

Here's what happens on the feet of a clock:

Clock output waveform

The part of the device circuit responsible for power and communication over I2C.

And this pattern is observed on the line Vcc, SDA, SCL.enter image description here

enter image description here enter image description here

  • Do you have a schematic ? Your signal doesn't look clean, it seems VDD is varying. – Damien Sep 14 at 7:16
  • Indeed, Vcc is noisy. Apparently this is due to the fact that there is no VD in the scheme (and not brought from the store). I attach a piece of the circuit responsible for power and I2C communication. Is it possible that the cause is Vcc noise? – Egor Vasilyev Sep 14 at 8:33
  • It doesn't look like noise on VCC but rather a bad voltage regulation, lack of decoupling capacitor perhaps. – Damien Sep 14 at 8:49
  • Are you sure about your schematic ? PB6/7 are directly connected to VDD, this wouldn't work. Also I2C you need pullup resistors to VDD, here it is in the line in serie. – Damien Sep 14 at 8:51
  • It's my fault for hurrying while I was drawing the diagram. Indeed, the resistors are not connected to the SCL and SDA lines, but as VDD suspenders. I am confident in the scheme, because it was developed by a person with extensive experience in this business. – Egor Vasilyev Sep 14 at 8:59

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.