RTC Issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RTC Issue

281 Views
AshBirari
Contributor I

Hello,
I am facing issue while clearing this RF bit . please refer the below code, after writing I am reading the data by sending Read command but it is giving me value as 0x80(i.e RF bit is SET)

Configurations :

Data width : 8

Transfer start : MSB

Baudrate : 1000000(testing purpose)

Code :

Cdd_Rtc_Spi_TxBuff[2] = {0,0}

Cdd_Rtc_Spi_RxBuff[2] = {0,0} 

READ_CMD = 0x90

WRITE_CMD = 0x10

Code To clear the RF bit of Second register :
Cdd_PCAReg.RegSeconds.bit.RF = CDD_RF_CLR;
 Cdd_Rtc_Spi_TxBuff[0]   = WRITE_CMD | REG_SECONDS;
 Cdd_Rtc_Spi_TxBuff[1]   = Cdd_PCAReg.RegSeconds.bit.RF;
RetVal |= Spi_SetupEB(CDD_RTC_SPI_READ_CHNL, &Cdd_Rtc_Spi_TxBuff[INDEX_ZERO], &Cdd_Rtc_Spi_RxBuff[INDEX_ZERO],2);
/*CDD_RTC_SPI_CHNL is ID of the channel which stores the data for transmission. Cdd_Rtc_Spi_TxBuff is Pointer to the buffer which holds the data.
Cdd_Rtc_Spi_RxBuff is Pointer to the buffer which gets the data.  DataIndex is Length to transmit in bytes.*/
/* Send data filled in SPI buffer over SPI */
 RetVal |= Cdd_Rtc_SpiSend_Ab();
 
Code to Read the Second register:
Cdd_Rtc_Spi_TxBuff[1] = 0x00;
Cdd_Rtc_Spi_TxBuff[0] = READ_CMD | Reg_SECOND;
Cdd_Rtc_Spi_TxBuff[1] = (((Cdd_Rtc_Spi_TxBuff[1] & 0x0F)<<4) | ((Cdd_Rtc_Spi_TxBuff[1] & 0xF0)>>4));
RetVal |= Spi_SetupEB(CDD_RTC_SPI_READ_CHNL, &Cdd_Rtc_Spi_TxBuff[INDEX_ZERO], &Cdd_Rtc_Spi_RxBuff[INDEX_ZERO], 2);
RetVal |= Cdd_Rtc_SpiSend_Ab();
 
Similar issue i am facing while clearing POR_OVRD bit.
Will the RTC still show the time data even if POR_OVRD bit is set ?
Please help me to resolve this issue .
Result : 
Cdd_Rtc_Spi_RxBuff[2] = { 0x0 , 0x80}
Cdd_Rtc_Spi_TxBuff[2] = { 0x0, 0x92}
0 Kudos
2 Replies

270 Views
ErikaC
NXP TechSupport
NXP TechSupport

Hello,

Could you please let me know what is the part number you are using?

0 Kudos

220 Views
AshBirari
Contributor I

RTC PCA21125

0 Kudos