From a696b807fb2a896bf503dea5b0dffb2002b29fae Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 21 Dec 2015 14:00:25 -0600 Subject: [PATCH] PCF65263: Correct readback verification of seconds register --- arch | 2 +- drivers/timers/pcf85263.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch b/arch index f9a3a1463b..a8666b5bb6 160000 --- a/arch +++ b/arch @@ -1 +1 @@ -Subproject commit f9a3a1463b24b8da63f2a7577d0b4ce0131a1069 +Subproject commit a8666b5bb6841d514d1fccedb0071df38d78217a diff --git a/drivers/timers/pcf85263.c b/drivers/timers/pcf85263.c index 8d5db98e6d..ab89fd4715 100644 --- a/drivers/timers/pcf85263.c +++ b/drivers/timers/pcf85263.c @@ -408,6 +408,7 @@ int up_rtc_settime(FAR const struct timespec *tp) struct tm newtm; time_t newtime; uint8_t buffer[9]; + uint8_t cmd; uint8_t seconds; int ret; @@ -449,7 +450,7 @@ int up_rtc_settime(FAR const struct timespec *tp) rtc_dumptime(&tm, "New time"); /* Construct the message */ - /* Write starting with the seconds regiser */ + /* Write starting with the 100ths of seconds register */ buffer[0] = PCF85263_RTC_100TH_SECONDS; @@ -498,9 +499,11 @@ int up_rtc_settime(FAR const struct timespec *tp) /* Read back the seconds register */ + cmd = PCF85263_RTC_SECONDS; + msg[1].addr = PCF85263_I2C_ADDRESS; msg[1].flags = 0; - msg[1].buffer = buffer; + msg[1].buffer = &cmd; msg[1].length = 1; msg[2].addr = PCF85263_I2C_ADDRESS;