Hi
I am using RTC BQ32000 IC and interfacing it with stm32f030 microcontroller using I2C2
My questions:
[1]
Time (Hr:Min:Sec) , i am able to read it but MSB of Min is always high. I think , it should be low. isn't it ? As per my logic, this MSB flag indicates Oscilator flag, and will be set only when there is oscillator fail. If i am wrong , please correct me.
[2]
I couldn't able to write data into register. Below is my part of code that is for the purpose for writing some values into the register.
struct rtc //Struct that store the time data that is being read/write from the RTC BQ32000
{
uint8_t sec,min,hour,day,date,month,year;
}time;
void RTC_Write(uint8_t addr, unit8_t data)
{
I2C_TransferHandling(I2C2, SLAVE_ADDR, 1, I2C_SoftEnd_Mode, I2C_Generate_Start_Write);
while(I2C_GetFlagStatus(I2C2, I2C_ISR_TXIS) == RESET);
I2C_SendData(I2C2,addr);
while(I2C_GetFlagStatus(I2C2, I2C_ISR_TC) == RESET);
I2C_SendData(I2C2,data);
while(I2C_GetFlagStatus(I2C2, I2C_ISR_TC) == RESET);
I2C_GenerateSTOP(I2C2,ENABLE);
}
void main()
{
/*
* Below four lines of statement is also written for other registers like hours,minute,second...etc
*/
time.day=0x06;
RTC_Write(DAY_REG,time.day);
temp=RTC_Gettime(DAY_REG);
printf("DAY : %X\r\n",temp);
}
After writing day register value 0x06, it is not updating...the day register.
Please suggest some helpful ideas, so that i can write into the registers.
Regards,
Kapil.