2018-09-12 04:25 AM
Hi, everybody. I have a problem, can not connect via I2C with RTC. Use a microcontroller and RTC STM32L052K8U DS3232M. Used library HAL. 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 1K, 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?
Datasheet on the clock:https://datasheets.maximintegrated.com/en/ds/DS3232M.pdf
int main(void){
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_ADC_Init();
MX_I2C1_Init();
MX_USART1_UART_Init();
while (1) {
uint8_t aTxBuffer[8];
HAL_I2C_Master_Receive( &hi2c, (0x68 << 1), (uint8_t*) &aTxBuffer, (uint16_t)б uint32_t) 1000 ) != HAL_OK );
}
}
2018-09-12 05:51 AM
Using a scope, have you looked at the I2C pins of the slave device ?
> From the watch constantly comes NACK.
This is not necessarily correct. No response at all is also interpreted as NACK.
2018-09-12 08:10 PM
Да, �? проверил �?игнал на булавках �? о�?циллографом. У мен�? е�?ть 4 одинаковых у�?трой�?тва, и ни один из них не отвечает.
2018-09-12 08:11 PM
Yes, I tested the signal on the clock pins with an oscilloscope. I have 4 identical devices and none of them are not responding.
2018-09-12 09:46 PM
You can't just jam reads like that. You need to select a register within the RTC to be reading.
See figure 10 in your data sheet
2018-09-12 10:10 PM
I also get the same reaction for the other addresses. According to the Datasheet, the value of seconds should be stored at 0x00. I managed to take a picture of the oscillogram.