Hi,
I am using the DS1307 library for STM32L152. The original library for STM32F429 is at here: stm32f4-discovery.com/.../
It seems a complete library however after few modification to STM32L I cant read/write DS1307. what ever is received is 1.
int main(void) { TM_DS1307_Time_t tim; SystemCoreClockSetHSI(); GPIO_RCC_configuration(); GPIO_configuration(); Init_SPI(); uart1_configuration(); I2C2_init(); TIM4_configuration(); TM_DS1307_SetDateTime(&tim); while(1) { tim.seconds=TM_DS1307_GetSeconds(); sprintf(str," \r\ns=%u",tim.seconds); uart_out_str(str); delay_ms(1000); } }
result is
s=1 s=1 s=1 s=1 s=1 s=1
I see signals in scope and there is a delay about 200ms when reading from DS1307 (reading timeout). when I debug, DR changes between 0xD0 and 0xD1. How can I find where the problem is?