From a17eeaa938324bda52b446b1482cad4902b69645 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 6 Apr 2015 16:26:59 -0600 Subject: STM32 RTCC: Make back-up register and magic value used by RTCC configurable. From David Sidrane --- nuttx/arch/arm/src/stm32/Kconfig | 11 +++++++++++ nuttx/arch/arm/src/stm32/stm32_rtcc.c | 19 ++++++++++++++----- nuttx/configs/samv71-xult/README.txt | 11 ++++++----- 3 files changed, 31 insertions(+), 10 deletions(-) (limited to 'nuttx') diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig index d1b2fa41f..a6de361c5 100644 --- a/nuttx/arch/arm/src/stm32/Kconfig +++ b/nuttx/arch/arm/src/stm32/Kconfig @@ -3406,6 +3406,17 @@ config STM32_HAVE_RTC_SUBSECONDS bool default n +config RTC_MAGIC_REG + int "The BKP register used to store/check the Magic value to determine if RTC is set already" + default 0 + range 0 19 + depends on RTC + +config RTC_MAGIC + hex "Value used as Magic to determine if RTC is set already" + default 0xfacefeee + depends on RTC + choice prompt "RTC clock source" default RTC_LSECLOCK diff --git a/nuttx/arch/arm/src/stm32/stm32_rtcc.c b/nuttx/arch/arm/src/stm32/stm32_rtcc.c index a520b3b74..b731b0e0f 100644 --- a/nuttx/arch/arm/src/stm32/stm32_rtcc.c +++ b/nuttx/arch/arm/src/stm32/stm32_rtcc.c @@ -87,11 +87,20 @@ # endif #endif +#if !defined(CONFIG_RTC_MAGIC) +# define CONFIG_RTC_MAGIC (0xfacefeee) +#endif + +#if !defined(CONFIG_RTC_MAGIC_REG) +# define CONFIG_RTC_MAGIC_REG STM32_RTC_BKR(0) +#endif + /* Constants ************************************************************************/ #define SYNCHRO_TIMEOUT (0x00020000) #define INITMODE_TIMEOUT (0x00010000) -#define RTC_MAGIC (0xfacefeee) +#define RTC_MAGIC CONFIG_RTC_MAGIC +#define RTC_MAGIC_REG CONFIG_RTC_MAGIC_REG /* Proxy definitions to make the same code work for all the STM32 series ************/ @@ -189,7 +198,7 @@ static void rtc_dumpregs(FAR const char *msg) rtclldbg(" TAFCR: %08x\n", getreg32(STM32_RTC_TAFCR)); rtclldbg("ALRMASSR: %08x\n", getreg32(STM32_RTC_ALRMASSR)); rtclldbg("ALRMBSSR: %08x\n", getreg32(STM32_RTC_ALRMBSSR)); - rtclldbg(" BK0: %08x\n", getreg32(STM32_RTC_BK0R)); + rtclldbg("MAGICREG: %08x\n", getreg32(RTC_MAGIC_REG)); } #else # define rtc_dumpregs(msg) @@ -616,7 +625,7 @@ int up_rtcinitialize(void) /* Select the clock source */ /* Save the token before losing it when resetting */ - regval = getreg32(STM32_RTC_BK0R); + regval = getreg32(RTC_MAGIC_REG); stm32_pwr_enablebkp(true); @@ -688,7 +697,7 @@ int up_rtcinitialize(void) /* Remember that the RTC is initialized */ - putreg32(RTC_MAGIC, STM32_RTC_BK0R); + putreg32(RTC_MAGIC, RTC_MAGIC_REG); /* Enable the RTC Clock by setting the RTCEN bit in the RCC register */ @@ -751,7 +760,7 @@ int up_rtcinitialize(void) /* Remember that the RTC is initialized */ - putreg32(RTC_MAGIC, STM32_RTC_BK0R); + putreg32(RTC_MAGIC, RTC_MAGIC_REG); } else { diff --git a/nuttx/configs/samv71-xult/README.txt b/nuttx/configs/samv71-xult/README.txt index 9b1ca7968..a9209f1b1 100644 --- a/nuttx/configs/samv71-xult/README.txt +++ b/nuttx/configs/samv71-xult/README.txt @@ -103,12 +103,13 @@ The BASIC nsh configuration is fully function (as desribed below under At this point, work has stopped because I am stuck. The problem is that bus events are not occurring: Nothing is detected by the USBHS when the host is connected; no activity is seen on the bus by a USB analyzer when - the host is connected. Possibilities: (1) the pullups on DM and DP are + the host is connected. Possibilities: (1) the pull-ups on DM and DP are not working. This would prevent the host from detecting the presence of - the device. the DETACH bit is, however, being correctly cleared or (2) - some issue with clocking or configuration of the UTMI. I see nothing - wrong this this case. I have done extensive comparison of the Atmel - sample code and study of the data sheet, but I have not found the key to + the device. The DETACH bit is, however, being correctly cleared and the + USB is in the suspend sate. Or (2) some issue with clocking or + configuration of the UTMI. I see nothing wrong in this case. I have + done extensive comparison of the Atmel sample code and study of the data + sheet, but I have not found the key to solving this. 6. Partial support for the maXTouch Xplained Pro LCD is in place. The -- cgit v1.2.3