I am trying to interface STM32F091Rc with MCP79411 through i2c bus, i am able to get Unique ID from the chip(MCP79411) but not able to set or get RTC date and time from the chip.
I am using CUBEMX to generate I2C initialization and other required files also i am using freertos and eclipse IDE.
Cant seem to find any libraries relating to RTC chip. Any help would be useful.
EDIT :(working)Code used for retriving Unique ID from MCP79411 chip.
I2c Declaration are done through STMCubeMX generation.
uint8_t UID_Address_register[]={0xF2,0xF3,0xF4,0xF5,0xF6,0xF7};
uint8_t Receive_buffer[6];
for(int k=0;k<6;k++)
{
HAL_I2C_Master_Transmit(&hi2c1,0xAE,(uint8_t*)&UID_Address_register[k],1,100);
HAL_I2C_Master_Receive(&hi2c1,0xAF,(uint8_t*)&Receive_buffer[k],1,100);
}
Code used in intention of retrieving RTC date and time but failed.
uint8_t RTC_Date_Time_Registers[]={0x00,0x01,0x02,0x03,0x04,0x05};
uint8_t DnT_rec_Buf[6];
for(int k=0;k<6;k++)
{
HAL_I2C_Master_Transmit(&hi2c1,0xDE,(uint8_t*)&RTC_Date_Time_Registers[k],1,100);
HAL_I2C_Master_Receive(&hi2c1,0xDF,(uint8_t*)&DnT_rec_Buf[k],1,100);
}
*Binary to decimal conversion operation done to convert incoming read bytes. But only read "000000".
Thanks in advance.