Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Smart Bluetooth

Anonymous
Not applicable

1.how to config RTC use external 32.768?

   Find in rtc.h,but i can`t find how to config.

2.Is there a function that i can regeist the  RTC interupt for seconds function?

0 Likes
1 Solution
Anonymous
Not applicable

Hello dongzaiq,

Are you using the BCM20732 or BCM20736?

Here is the rtc sample.

  1. You need the external 32K xtal hooked up to P26/P27 or comment out the use 32K #define to use the internal 128K instead – This is not very accurate so it will drift within minutes).
  2. Backup and replace Wiced-Smart/tier2 directory with the files in the attached .zip file.
  3. Create <SDK>/Apps/rtc_sample/ and place the rtc_sample.c and makefile.mk in it.
  4. Create a make target called rtc_sample-BCM92073xTAG_Q32, then build and download.
  5. Hook up P0 to GND

Here is the code:

$ Copyright Broadcom Corporation $
*/

/** @file
*
* RTC Sample
*
* This application provides the sample code for interfacing with
* the on-chip RTC clock. It is highly recommended that an external 32K
* xtal be used when accurate time is to be maintained. The accuracy
* of the time maintained with the an external LPO is an order of magnitude
* better than the internal LPO.
*
*
* Features demonstrated
*  - Use of the on-chip RTC interface.
*  - Use of the external 32 KHz LPO when available for sleep and deep sleep.
*  - Entering deep sleep on demand.
*  - Using the internal or the external LPO (32KHz xtal) for timed wake from deep sleep.
*
* To demonstrate the app, work through the following steps.
* 1. Plug the WICED eval board into your computer
* 2. Build and download the application (to the WICED board)
* 3. Application initializes and RTC and prints time every second.
* 3.a Application programs and enters deepsleep, optionally configuring for a timed wake.
*/
#define CONFIG_IN_NVRAM 1

// Uncomment #define RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE below to enable using
// the external 32K LPO (make sure that R102 and R103 on BCM920737TAG_Q32 is populated
// with a 0 Ohm resistor, else the the behavior is undefined).
#define RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE

// Uncomment the #define RTC_SAMPLE_ENTER_DEEP_SLEEP_AND_ENABLE_TIMED_WAKE below to
// see how to enter deep sleep on demand and also program timed wake using either
// the internal LPO or the external 32KHz xtal (see
// RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE above).
#define RTC_SAMPLE_ENTER_DEEP_SLEEP_AND_ENABLE_TIMED_WAKE

#include "bleprofile.h"
#include "bleapp.h"
#include "gpiodriver.h"
#include "string.h"
#include "stdio.h"
#include "platform.h"
#include "bleappconfig.h"
#include "cfa.h"
#include "rtc.h"
#include "bleapputils.h"
#include "bleapp.h"
#include "devicelpm.h"
#include "miadriver.h"

/******************************************************
*                      Constants
******************************************************/

/******************************************************
*               Function Prototypes
******************************************************/
static void rtc_sample_create(void);
static void rtc_sample_timeout(UINT32 arg);
static void rtc_sample_fine_timeout(UINT32 arg);

/******************************************************
*               Variables Definitions
******************************************************/

// Following structure defines UART configuration
const BLE_PROFILE_PUART_CFG rtc_sample_puart_cfg =
{
    /*.baudrate   =*/ 115200,
    /*.txpin      =*/ GPIO_PIN_UART_TX,
    /*.rxpin      =*/ GPIO_PIN_UART_RX,
};

/******************************************************
*               Function Definitions
******************************************************/

// Application initialization
APPLICATION_INIT()
{
    bleapp_set_cfg(NULL, 0, NULL, (void *)&rtc_sample_puart_cfg, NULL, rtc_sample_create);
}

// Create the RTC sample.
void rtc_sample_create(void)
{
    RtcTime current_time;
char buffer[64];

    ble_trace0("rtc_sample_create()\n");

    if (!mia_isResetReasonPor())
    {
     ble_trace0("Waking from deep sleep because the timer went off or a GPIO triggered while waiting for timer to expire.");
    }
    else
    {
     ble_trace0("Not a timed wake.");
    }

    blecm_configFlag |= BLECM_DBGUART_LOG;

    bleprofile_Init(bleprofile_p_cfg);

#ifdef RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE
// If we need to use the external 32K, then configure the reference
rtcConfig.oscillatorFrequencykHz = RTC_REF_CLOCK_SRC_32KHZ;

// Since the 32K external LPO is connected tp P10, P11, P12, P26 and P27,
// input and putput disable all 5 GPIOs.
gpio_configurePin(0, 10, GPIO_INPUT_DISABLE, 0);
gpio_configurePin(0, 11, GPIO_INPUT_DISABLE, 0);
gpio_configurePin(0, 12, GPIO_INPUT_DISABLE, 0);
gpio_configurePin(1, 10, GPIO_INPUT_DISABLE, 0);
gpio_configurePin(1, 11, GPIO_INPUT_DISABLE, 0);
#endif

    // Initialize the RTC.
    rtc_init();

    memset(buffer, 0x00, sizeof(buffer));
ble_trace0("Time base is:");

// RtcTime of 0x00 is the start of RTC time.
    memset(&current_time, 0x00, sizeof(current_time));
rtc_ctime(&current_time, buffer);
ble_trace0(buffer);

// Let year = 2014.
current_time.year = 2014;
// Let month = april = 3 (jan = 0)
current_time.month = 3;
// Let day = 1st.
current_time.day = 1;
// Let current time be 12:00:00 Noon.
current_time.hour = 12;
current_time.minute = 00;
current_time.second = 0x00;

// If this is a power-on reset, we need to set up the reference time.
if (mia_isResetReasonPor())
{
  // Now set the on-chip RTC.
  if(rtc_setRTCTime(&current_time))
  {
   memset(buffer, 0x00, sizeof(buffer));

   ble_trace0("Power-on reset, set current time to:");
   rtc_ctime(&current_time, buffer);
   ble_trace0(buffer);
  }
  else
  {
   ble_trace0("Unable to set time.");
  }
}
else
{
  // Set up the original reference time instead of using 01/01/2010, 00:00:00 as the reference
  // because this is a wake from deep sleep. The HW clock keeps running in deep sleep so when
  // we wake up, the FW needs to know what was used as the original reference time.
  rtc_setReferenceTime(&current_time);
}

    bleprofile_regTimerCb(rtc_sample_fine_timeout, rtc_sample_timeout);
    bleprofile_StartTimer();

#ifdef RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE
    // Since we have an external 32 KHz LPO, switch to using this during sleep
    // because this will give us a more accurate sleep clock (lower drift than the
    // internal LPO, so the uncertainty window during a receive will be narrower).
    // In general, base sleep current will be lower too.
    // Switching to the external 32K with bleapputils_changeLPOSource without having
    // initialized the RTC, the bonded GPIOs and not having the 32KHz oscillator physically
    // connected to the chip will invoke undefined behavior.
    bleapputils_changeLPOSource(LPO_32KHZ_OSC, FALSE, 250);
#endif

    // Trace out number of bytes free.
    ble_trace1("Number of free bytes in RAM: %d",  cfa_mm_MemFreeBytes());
}

// One second timer expired. Read the time from RTC and print.
void rtc_sample_timeout(UINT32 arg)
{
RtcTime current_time;
UINT32 seconds_since_time_base;
char buffer[64];
tRTC_REAL_TIME_CLOCK raw_clock;

memset(buffer, 0x00, sizeof(buffer));

// Get and print current time.
rtc_getRTCTime(&current_time);
ble_trace0("Current date/time is:");
rtc_ctime(&current_time, buffer);
ble_trace0(buffer);

// Get and print time since time base in seconds.
rtc_RtcTime2Sec(&current_time, &seconds_since_time_base);
ble_trace1("Its been %d seconds since bigbang.", seconds_since_time_base);

// Get and print the raw 48 bit clock value.
rtc_getRTCRawClock(&raw_clock);

ble_trace2("Upper and lower 32 bit values: 0x%08X, 0x%08X\n", raw_clock.reg32map.rtc32[1], raw_clock.reg32map.rtc32[0]);

#ifdef RTC_SAMPLE_ENTER_DEEP_SLEEP_AND_ENABLE_TIMED_WAKE
{
  static UINT32 num_timeouts_since_boot = 0;

  // Demo going into deep sleep with wake after 5s.
  if (num_timeouts_since_boot++ >= 10)
  {
   // If its been ~10s of ADV, configure timed wake and
   // enter deep sleep right now.
   ble_trace0("Entering deep sleep.");

   gpio_configurePin(0, 0, 0x100, 0);

   // Configure the low power manager to enter deep sleep.
   devLpmConfig.disconnectedLowPowerMode = DEV_LPM_DISC_LOW_POWER_MODES_HID_OFF;

   // Configure the wake time in mS.
   devLpmConfig.wakeFromHidoffInMs = 5000;

   // Configure the reference clock to use.

#ifndef RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE
   // Use internal LPO.
   devLpmConfig.wakeFromHidoffRefClk = HID_OFF_TIMED_WAKE_CLK_SRC_128KHZ;
#else
   // Use the external 32k.
   devLpmConfig.wakeFromHidoffRefClk = HID_OFF_TIMED_WAKE_CLK_SRC_32KHZ;
#endif

   gpio_configurePin(0, 0, 0x100, 0);

   // Enter deep-sleep now. Will not return.
   devlpm_enterLowPowerMode();
  }
}
#endif
}

void rtc_sample_fine_timeout(UINT32 arg)
{

}


Results:

  1. Once downloaded, hook up teraterm/hyperterm to HCI uart, disconnect RXd and reset.
  2. You should see something like this:

rtc_sample_create()
Not a timed wake.
020106030304000409bb8104
020a81
Time base is:
Jan 0 00:00:00 0000
Power-on reset, set current time to:
Apr 1 12:00:00 2014
Number of free bytes in RAM: 28436

blecm evt handler:
0e0401082000

blecm evt handler:
0e0401092000
@$*#04FF2EF7009201050000074A05197A732000074E05413E00000007362A0100000400073A2A500000000007522A50000100Current date/time is:
Apr 1 12:00:00 2014                Prints time every 1s.
Its been 134049600 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x00007506
Current date/time is:
Apr 1 12:00:01 2014
Its been 134049601 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x0000D9B7
Current date/time is:
Apr 1 12:00:02 2014
Its been 134049602 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x00015183
….                                             Continues to print time every 1s for 10s.
Current date/time is:
Apr 1 12:00:10 2014
Its been 134049610 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x00054DD0
Entering deep sleep.        After 10s of printing time, enters hid-off for 5s. Measure Vio and you should see ~5uA.
rtc_sample_create()
Waking from deep sleep because the timer went off or a GPIO triggered while waiting for timer to expire.         On wake up after 5s in hid-off, detects that this is a timed wake and not a PoR. So uses a different API to initialize reference time.
020106030304000409bb8104
020a81
Time base is:
Jan 0 00:00:00 0000
Number of free bytes in RAM: 28436

blecm evt handler:
0e0401082000

blecm evt handler:
0e0401092000
@$*#04FF2EF7009201050000074A05197A732000074E05413E00000007362A0100000400073A2A500000000007522A50000100Current date/time is:
Apr 1 12:00:16 2014          Continues to print time every 1s, starting from where we left off. Its off by 1s because there is a ~1s delay before the app timer goes off + boot time. Compare with wall clock and this will still be correct.
Its been 134049616 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x000850F4
Current date/time is:
Apr 1 12:00:17 2014
Its been 134049617 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x0008C8C1
…              Continues same sequence forever.

Make file if you need it:

#
# $ Copyright Broadcom Corporation $
#

########################################################################
# Application sources.
########################################################################
APP_SRC = rtc_sample.c

########################################################################
################ DO NOT MODIFY FILE BELOW THIS LINE ####################
########################################################################
APP_PATCHES_AND_LIBS += rtc_api.a

Let me know if this helps.

JT

View solution in original post

0 Likes
18 Replies
Anonymous
Not applicable

Hello dongzaiq,

Look at the rtc.h in the SDK Directory:

..\WICED\WICED-Smart-SDK-x.x.x\WICED-Smart-SDK\include\Drivers\rtc.h

You may also want to look at similar posts that address the RTC:

Internal vs. External Oscillator

Let me know if this helps.

JT

0 Likes
Anonymous
Not applicable

rtc.h

enum

{

    RTC_REF_CLOCK_SRC_32KHZ  = 32,

    RTC_REF_CLOCK_SRC_128KHZ = 128

};

This  is only a enum.

But I can`t find where used it.

According to the normal way: RTC_REF_CLOCK_SRC_32KHZ or RTC_REF_CLOCK_SRC_128KHZ shoud be input  parameter!

j.t

0 Likes
Anonymous
Not applicable

Hello dongzaiq,

Are you using the BCM20732 or BCM20736?

Here is the rtc sample.

  1. You need the external 32K xtal hooked up to P26/P27 or comment out the use 32K #define to use the internal 128K instead – This is not very accurate so it will drift within minutes).
  2. Backup and replace Wiced-Smart/tier2 directory with the files in the attached .zip file.
  3. Create <SDK>/Apps/rtc_sample/ and place the rtc_sample.c and makefile.mk in it.
  4. Create a make target called rtc_sample-BCM92073xTAG_Q32, then build and download.
  5. Hook up P0 to GND

Here is the code:

$ Copyright Broadcom Corporation $
*/

/** @file
*
* RTC Sample
*
* This application provides the sample code for interfacing with
* the on-chip RTC clock. It is highly recommended that an external 32K
* xtal be used when accurate time is to be maintained. The accuracy
* of the time maintained with the an external LPO is an order of magnitude
* better than the internal LPO.
*
*
* Features demonstrated
*  - Use of the on-chip RTC interface.
*  - Use of the external 32 KHz LPO when available for sleep and deep sleep.
*  - Entering deep sleep on demand.
*  - Using the internal or the external LPO (32KHz xtal) for timed wake from deep sleep.
*
* To demonstrate the app, work through the following steps.
* 1. Plug the WICED eval board into your computer
* 2. Build and download the application (to the WICED board)
* 3. Application initializes and RTC and prints time every second.
* 3.a Application programs and enters deepsleep, optionally configuring for a timed wake.
*/
#define CONFIG_IN_NVRAM 1

// Uncomment #define RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE below to enable using
// the external 32K LPO (make sure that R102 and R103 on BCM920737TAG_Q32 is populated
// with a 0 Ohm resistor, else the the behavior is undefined).
#define RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE

// Uncomment the #define RTC_SAMPLE_ENTER_DEEP_SLEEP_AND_ENABLE_TIMED_WAKE below to
// see how to enter deep sleep on demand and also program timed wake using either
// the internal LPO or the external 32KHz xtal (see
// RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE above).
#define RTC_SAMPLE_ENTER_DEEP_SLEEP_AND_ENABLE_TIMED_WAKE

#include "bleprofile.h"
#include "bleapp.h"
#include "gpiodriver.h"
#include "string.h"
#include "stdio.h"
#include "platform.h"
#include "bleappconfig.h"
#include "cfa.h"
#include "rtc.h"
#include "bleapputils.h"
#include "bleapp.h"
#include "devicelpm.h"
#include "miadriver.h"

/******************************************************
*                      Constants
******************************************************/

/******************************************************
*               Function Prototypes
******************************************************/
static void rtc_sample_create(void);
static void rtc_sample_timeout(UINT32 arg);
static void rtc_sample_fine_timeout(UINT32 arg);

/******************************************************
*               Variables Definitions
******************************************************/

// Following structure defines UART configuration
const BLE_PROFILE_PUART_CFG rtc_sample_puart_cfg =
{
    /*.baudrate   =*/ 115200,
    /*.txpin      =*/ GPIO_PIN_UART_TX,
    /*.rxpin      =*/ GPIO_PIN_UART_RX,
};

/******************************************************
*               Function Definitions
******************************************************/

// Application initialization
APPLICATION_INIT()
{
    bleapp_set_cfg(NULL, 0, NULL, (void *)&rtc_sample_puart_cfg, NULL, rtc_sample_create);
}

// Create the RTC sample.
void rtc_sample_create(void)
{
    RtcTime current_time;
char buffer[64];

    ble_trace0("rtc_sample_create()\n");

    if (!mia_isResetReasonPor())
    {
     ble_trace0("Waking from deep sleep because the timer went off or a GPIO triggered while waiting for timer to expire.");
    }
    else
    {
     ble_trace0("Not a timed wake.");
    }

    blecm_configFlag |= BLECM_DBGUART_LOG;

    bleprofile_Init(bleprofile_p_cfg);

#ifdef RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE
// If we need to use the external 32K, then configure the reference
rtcConfig.oscillatorFrequencykHz = RTC_REF_CLOCK_SRC_32KHZ;

// Since the 32K external LPO is connected tp P10, P11, P12, P26 and P27,
// input and putput disable all 5 GPIOs.
gpio_configurePin(0, 10, GPIO_INPUT_DISABLE, 0);
gpio_configurePin(0, 11, GPIO_INPUT_DISABLE, 0);
gpio_configurePin(0, 12, GPIO_INPUT_DISABLE, 0);
gpio_configurePin(1, 10, GPIO_INPUT_DISABLE, 0);
gpio_configurePin(1, 11, GPIO_INPUT_DISABLE, 0);
#endif

    // Initialize the RTC.
    rtc_init();

    memset(buffer, 0x00, sizeof(buffer));
ble_trace0("Time base is:");

// RtcTime of 0x00 is the start of RTC time.
    memset(&current_time, 0x00, sizeof(current_time));
rtc_ctime(&current_time, buffer);
ble_trace0(buffer);

// Let year = 2014.
current_time.year = 2014;
// Let month = april = 3 (jan = 0)
current_time.month = 3;
// Let day = 1st.
current_time.day = 1;
// Let current time be 12:00:00 Noon.
current_time.hour = 12;
current_time.minute = 00;
current_time.second = 0x00;

// If this is a power-on reset, we need to set up the reference time.
if (mia_isResetReasonPor())
{
  // Now set the on-chip RTC.
  if(rtc_setRTCTime(&current_time))
  {
   memset(buffer, 0x00, sizeof(buffer));

   ble_trace0("Power-on reset, set current time to:");
   rtc_ctime(&current_time, buffer);
   ble_trace0(buffer);
  }
  else
  {
   ble_trace0("Unable to set time.");
  }
}
else
{
  // Set up the original reference time instead of using 01/01/2010, 00:00:00 as the reference
  // because this is a wake from deep sleep. The HW clock keeps running in deep sleep so when
  // we wake up, the FW needs to know what was used as the original reference time.
  rtc_setReferenceTime(&current_time);
}

    bleprofile_regTimerCb(rtc_sample_fine_timeout, rtc_sample_timeout);
    bleprofile_StartTimer();

#ifdef RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE
    // Since we have an external 32 KHz LPO, switch to using this during sleep
    // because this will give us a more accurate sleep clock (lower drift than the
    // internal LPO, so the uncertainty window during a receive will be narrower).
    // In general, base sleep current will be lower too.
    // Switching to the external 32K with bleapputils_changeLPOSource without having
    // initialized the RTC, the bonded GPIOs and not having the 32KHz oscillator physically
    // connected to the chip will invoke undefined behavior.
    bleapputils_changeLPOSource(LPO_32KHZ_OSC, FALSE, 250);
#endif

    // Trace out number of bytes free.
    ble_trace1("Number of free bytes in RAM: %d",  cfa_mm_MemFreeBytes());
}

// One second timer expired. Read the time from RTC and print.
void rtc_sample_timeout(UINT32 arg)
{
RtcTime current_time;
UINT32 seconds_since_time_base;
char buffer[64];
tRTC_REAL_TIME_CLOCK raw_clock;

memset(buffer, 0x00, sizeof(buffer));

// Get and print current time.
rtc_getRTCTime(&current_time);
ble_trace0("Current date/time is:");
rtc_ctime(&current_time, buffer);
ble_trace0(buffer);

// Get and print time since time base in seconds.
rtc_RtcTime2Sec(&current_time, &seconds_since_time_base);
ble_trace1("Its been %d seconds since bigbang.", seconds_since_time_base);

// Get and print the raw 48 bit clock value.
rtc_getRTCRawClock(&raw_clock);

ble_trace2("Upper and lower 32 bit values: 0x%08X, 0x%08X\n", raw_clock.reg32map.rtc32[1], raw_clock.reg32map.rtc32[0]);

#ifdef RTC_SAMPLE_ENTER_DEEP_SLEEP_AND_ENABLE_TIMED_WAKE
{
  static UINT32 num_timeouts_since_boot = 0;

  // Demo going into deep sleep with wake after 5s.
  if (num_timeouts_since_boot++ >= 10)
  {
   // If its been ~10s of ADV, configure timed wake and
   // enter deep sleep right now.
   ble_trace0("Entering deep sleep.");

   gpio_configurePin(0, 0, 0x100, 0);

   // Configure the low power manager to enter deep sleep.
   devLpmConfig.disconnectedLowPowerMode = DEV_LPM_DISC_LOW_POWER_MODES_HID_OFF;

   // Configure the wake time in mS.
   devLpmConfig.wakeFromHidoffInMs = 5000;

   // Configure the reference clock to use.

#ifndef RTC_SAMPLE_USE_EXSTERNAL_32K_OSC_REFERENCE
   // Use internal LPO.
   devLpmConfig.wakeFromHidoffRefClk = HID_OFF_TIMED_WAKE_CLK_SRC_128KHZ;
#else
   // Use the external 32k.
   devLpmConfig.wakeFromHidoffRefClk = HID_OFF_TIMED_WAKE_CLK_SRC_32KHZ;
#endif

   gpio_configurePin(0, 0, 0x100, 0);

   // Enter deep-sleep now. Will not return.
   devlpm_enterLowPowerMode();
  }
}
#endif
}

void rtc_sample_fine_timeout(UINT32 arg)
{

}


Results:

  1. Once downloaded, hook up teraterm/hyperterm to HCI uart, disconnect RXd and reset.
  2. You should see something like this:

rtc_sample_create()
Not a timed wake.
020106030304000409bb8104
020a81
Time base is:
Jan 0 00:00:00 0000
Power-on reset, set current time to:
Apr 1 12:00:00 2014
Number of free bytes in RAM: 28436

blecm evt handler:
0e0401082000

blecm evt handler:
0e0401092000
@$*#04FF2EF7009201050000074A05197A732000074E05413E00000007362A0100000400073A2A500000000007522A50000100Current date/time is:
Apr 1 12:00:00 2014                Prints time every 1s.
Its been 134049600 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x00007506
Current date/time is:
Apr 1 12:00:01 2014
Its been 134049601 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x0000D9B7
Current date/time is:
Apr 1 12:00:02 2014
Its been 134049602 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x00015183
….                                             Continues to print time every 1s for 10s.
Current date/time is:
Apr 1 12:00:10 2014
Its been 134049610 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x00054DD0
Entering deep sleep.        After 10s of printing time, enters hid-off for 5s. Measure Vio and you should see ~5uA.
rtc_sample_create()
Waking from deep sleep because the timer went off or a GPIO triggered while waiting for timer to expire.         On wake up after 5s in hid-off, detects that this is a timed wake and not a PoR. So uses a different API to initialize reference time.
020106030304000409bb8104
020a81
Time base is:
Jan 0 00:00:00 0000
Number of free bytes in RAM: 28436

blecm evt handler:
0e0401082000

blecm evt handler:
0e0401092000
@$*#04FF2EF7009201050000074A05197A732000074E05413E00000007362A0100000400073A2A500000000007522A50000100Current date/time is:
Apr 1 12:00:16 2014          Continues to print time every 1s, starting from where we left off. Its off by 1s because there is a ~1s delay before the app timer goes off + boot time. Compare with wall clock and this will still be correct.
Its been 134049616 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x000850F4
Current date/time is:
Apr 1 12:00:17 2014
Its been 134049617 seconds since bigbang.
Upper and lower 32 bit values: 0x00000000, 0x0008C8C1
…              Continues same sequence forever.

Make file if you need it:

#
# $ Copyright Broadcom Corporation $
#

########################################################################
# Application sources.
########################################################################
APP_SRC = rtc_sample.c

########################################################################
################ DO NOT MODIFY FILE BELOW THIS LINE ####################
########################################################################
APP_PATCHES_AND_LIBS += rtc_api.a

Let me know if this helps.

JT

View solution in original post

0 Likes
Anonymous
Not applicable

Thank you very much ! It is very helpful!

0 Likes
Anonymous
Not applicable

1.

rtc_setReferenceTime(&current_time);

I use BCM20732 , SDK1.1.0 Do not have this(rtc_setReferenceTime(&current_time);) function?

Is there miadriver.h , devicelpm.h , cfa.h  detailed functions description ?

2.

rtcConfig.oscillatorFrequencykHz = RTC_REF_CLOCK_SRC_32KHZ at here wo have config use a extenal 32K, why we need to use

bleapputils_changeLPOSource(LPO_32KHZ_OSC, FALSE, 250); to chang to extenal 32K?

0 Likes
Anonymous
Not applicable

Let me check

0 Likes
Anonymous
Not applicable

Entering deep sleep. when it wake up,the RTC value will be reset!

But for you output info,you RTC is not reset! Is there a methor that when into sleep, the RTC be retain and not be close?

Is it because my RTC  use the RTC_REF_CLOCK_SRC_128KHZ,so it will be reset when boot_up?

0 Likes
Anonymous
Not applicable

Hi j.t ,

Yes, would you know if there is an RTC function on the BCM20732S ?

Thanks

Mark

0 Likes
SuLe_1710756
Contributor

Hi J.T

You described above like this ,

"2. Backup and replace Wiced-Smart/tier2 directory with the files in the attached .zip file."

However, I can't find *.zip file anywhere. Could you provide this file asap?

Thanks,

SM

0 Likes
Anonymous
Not applicable

Hi J.t,

because of "rtc_api.a", i had a compile error.

where can i get "rtc_api.a".

(my sdk version is "WICED-Smart-SDK-2.0.1")

Thanks,

GyoungBo Min.

0 Likes
Anonymous
Not applicable

Hello GyoungBo Min,

We adding a few changes to the rtc_api.a and it will be released in our next SDK.

We will let you know when it is available.

Thank you

JT

0 Likes
Anonymous
Not applicable

Hi JT,

Thanks for your answer.

let me know when will you release next SDK as soon as possible?
could i get test version(rtc_api.a or SDK)?

Thanks,

GyoungBo Min

0 Likes
Anonymous
Not applicable

Hello GyoungBo,

The SDK 2.1.0 has just been released: WICED Smart Documents &amp; Downloads

Thanks

JT

0 Likes
Anonymous
Not applicable

hello JT

thanks for your inform.

i had a install problem.(check attached a file.)

install_error.jpg

please let me know what is the problem.(previous version works well.)

Thanks

GyoungBo Min

0 Likes
Anonymous
Not applicable

hello JT

the SDK Installation problem was solved.

install_error_solve.jpg

change setting form Windows XP(service pack 3) to Windows 7.

Thanks,

GyoungBo Min

0 Likes
Anonymous
Not applicable

Hello GyoungBo,

My Chinese is not very good, but it looks like you are up and running

Let us know if you need further help

Thanks

JT

0 Likes
Anonymous
Not applicable

I use WICED-Smart-SDK-2.1.1.

1:How to set up the software to an external 32.768KHz crystal?

2:If you use an external 32.768KHz crystal. In the sleep mode power consumption can save much?

Thanks.

Libo

0 Likes
MichaelF_56
Moderator
Moderator

1.

It appears that the source for accomplishing such was included above.

2.

Power measurements have never been taken within this scenario, but in theory, an external oscillator should improve power consumption as noted in other posts

0 Likes