2016-09-08 03:47 AM
Hi
I am trying to write some data to RTC register(say, day register) but unable to do so. If anyone knows,please provide some useful suggestions regarding what is the problem with the below code. // writing code part. void RTC_Write(uint8_t addr, uint8_t data) { while(I2C_GetFlagStatus(I2C2, I2C_ISR_BUSY)==RESET); I2C_GenerateSTART(I2C2, ENABLE); I2C_SendData(I2C2,SLAVE_ADDR); I2C_SendData(I2C2,(uint8_t)addr); while(I2C_GetFlagStatus(I2C2, I2C_ISR_TC) == RESET); I2C_SendData(I2C2,(uint8_t)data); while(I2C_GetFlagStatus(I2C2, I2C_ISR_TC) == RESET); I2C_GenerateSTOP(I2C2, ENABLE); while(I2C_GetFlagStatus(I2C2, I2C_FLAG_STOPF)==RESET); } void main() { time.day=RTC_Write(DAY_ADD,(uint8_t)0x01); //0x01= sunday. printf(''Day: %x\r\n'',time.day); } Regards, Kapil.2016-09-08 04:28 AM
Hi,
You can review RTC examples under the firmware package: STM32Cube_FW_F0_V1.6.0\Projects\STM32091C_EVAL\Examples\RTCThis will help you to develop and configure your project.Regards
2016-09-08 09:40 PM
whatever you had given me the link , that is for internal rtc. i am looking to interface external rtc to stm32f030 using i2c. if anyone have some sample code related to it , please share with me.
Regards, Kapil.