How can I make bcm20732s sleep and wake it up by GPIO interrupt?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I use bcm20732s module, I want to use its low power mode, the scenario is like this:

  • If 20732s is out of connection, it should go into sleep mode, not deep sleep mode. I want to register a GPIO interrupt: if rising edge, put module into sleep mode, if falling edge, wake up the module. So the question:

               Can pin 39 of bcm20732s, GPIO: P13, wake up module from sleep mode by interrupt?

               If module is waken, is there any callback function to tell firmware workflow that the process of wakeup is successfully?

               How can I enable GPIO: P13’s interrupt function?

               How can I register a GPIO interrupt routine?

               Which function can make module goto sleep?

  • If 20732s is connected, how can I make it sleep? Does it lose connection if sleep? Or, it can maintain the connection automatically by stack?

Is there any sample code for low power application?


0 Likes
1 Solution

# Master control for sleep enable/disable

ENTRY "Sleep Mode Configuration"

{

    # Internal name for the sleep mode. This is the only valid sleep mode for 2073x.

    "Sleep mode" = "HIDD"

    # Master sleep control. 1 = enable sleep; 0 = never allow sleep.

    "Sleep enable" = 1

}

# Timed wake from deep sleep

ENTRY "Device LPM Configuration"

{

   "Disconnect Low Power Mode" = "HID_OFF"

    # Time in milliseconds to automatically wake from hid-off. 0 = don't wake.

    # Will be rounded to 64mS multiples when clock source is 128KHz and 256mS

    # when clock source is 32KHz external crystal.

   "wakeFromHidoffInMs" = 0

   # Reference clock source to use; TIMED_WAKE_CLK_SRC_128KHZ = internal 128KHz LPO

   # TIMED_WAKE_CLK_SRC_32KHZ = external 32KHz LPO if available.

   "wakeFromHidoffRefClk" = "TIMED_WAKE_CLK_SRC_128KHZ"      

}

# Master control for deep sleep

ENTRY "BLE App Hid-off config"

{

     # Only valid configuration.

    "Hid-off allowed" = 0x17

}

View solution in original post

9 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

In hello_sensor.c we refer to LPM and call devlpm_init(); - Study this to know how to WAKE on a GPIO.  Enter and exit sleep modes.


http://community.broadcom.com/message/1667#1667
– This post has a good summary of sleep and deep sleep under certain BLE conditions.

JT has also created an excellent sleep blog here:

WICED Smart Video BLOG: Experts Interview - Sleep Deep_Sleep and Advertising - Part 1

0 Likes
Anonymous
Not applicable

I have read the hello_sensor.c  in uart_firmware_upgrade, I just find this:

if(!hello_sensor_cfg.powersave_timeout)

  {

  devlpm_init();

  devlpm_enableWakeFrom(DEV_LPM_WAKE_SOURCE_GPIO);

  }


Could you please tell me the detail about GPIO interrupt register, callback register, which function is the sleep function.

0 Likes

For all GPIO functions, see <SDK>/include/Drivers/gpiodriver.h

For the simplest sample app that configures GPIO interrupts, see i2c_temperature_sensor sample app in SDK 2.0.1 and look at code that gets compiled in when LM73_ALERTS_ENABLED is defined. You can look at spi_comm_* sample apps too. All GPIO interrupts are capable of waking the device from sleep or deep sleep.

An application cannot force the device into sleep, but it can participate in sleep time decisions and these are discussed in the video blog mwf_mmfae posted the link to above.

> GPIO: P13, wake up module from sleep mode by interrupt?

Yes. All/any GPIO configured as an interrupt source can wake the chip.

> If module is waken, is there any callback function to tell firmware workflow that the process of wakeup is successfully?

The fact that the interrupt handler is invoked is sufficient to infer that the device woke up (or no if the interrupt arrived when the device was already awake).

> If 20732s is connected, how can I make it sleep? Does it lose connection if sleep?

The FW chooses the best/most optimal power modes, so the app does not get an API to force sleep. All RF activity including connections will be maintained because the schedule of these activities are known and the FW will choose the most optimal power modes (sleep or pause) to use between connection events.

0 Likes
Anonymous
Not applicable

An application cannot force the device into sleep, but it can participate in sleep time decisions and these are discussed in the video blog mwf_mmfae posted the link to above.

The speech speed of expert is so fast, I can't get the meaning clearly.


> If 20732s is connected, how can I make it sleep? Does it lose connection if sleep?

The FW chooses the best/most optimal power modes, so the app does not get an API to force sleep. All RF activity including connections will be maintained because the schedule of these activities are known and the FW will choose the most optimal power modes (sleep or pause) to use between connection events.

So, I want to know how application can choose the power mode(sleep or pause)?

0 Likes

The application does not get such fine control of the low power modes, so it cannot choose which sleep mode to use (other than forcing deep sleep, in which case all state information will be lost and connections will be lost). Sleep and pause are always decided by the firmware below the app. The app only gets to tell how long it will allow the device to sleep (or not at all).

Anonymous
Not applicable

Sleep and pause are always decided by the firmware below the app.

Ok, if it's below the application firmware, what configuration should be setup before compiling?

The app only gets to tell how long it will allow the device to sleep (or not at all).

Can you provide code snippet for that? I think you can provide an application note about sleep mode like you had done an article,  "how to write wiced smart applications". That can simplify your work about sleep mode question.

> what configuration should be setup before compiling?

With SDK 1.1.0 and 2.x, no configuration is needed.

> Can you provide code snippet for that?

See j.t's blog at Sleep Deep_Sleep Explanation and Techniques

Also see Unit of the DeviceLpmQueriableMethodCallback return value

Anonymous
Not applicable

In platform.cgs, I found this, is it to determine the low power mode for disconnect or connect? What is that meaning?

################################################################################

#  Low power configuration

################################################################################

ENTRY "Sleep Mode Configuration"

{

    "Sleep mode" = "HIDD"

    "Sleep enable" = 1

}

ENTRY "Device LPM Configuration"

{

   "Disconnect Low Power Mode" = "HID_OFF"

   "wakeFromHidoffInMs" = 0                               # Time in milliseconds to automatically wake from hid-off. 0 = don't wake.

   "wakeFromHidoffRefClk" = "TIMED_WAKE_CLK_SRC_128KHZ"       # Reference clock source

}

ENTRY "BLE App Hid-off config"

{

    "Hid-off allowed" = 0x17

}

0 Likes

# Master control for sleep enable/disable

ENTRY "Sleep Mode Configuration"

{

    # Internal name for the sleep mode. This is the only valid sleep mode for 2073x.

    "Sleep mode" = "HIDD"

    # Master sleep control. 1 = enable sleep; 0 = never allow sleep.

    "Sleep enable" = 1

}

# Timed wake from deep sleep

ENTRY "Device LPM Configuration"

{

   "Disconnect Low Power Mode" = "HID_OFF"

    # Time in milliseconds to automatically wake from hid-off. 0 = don't wake.

    # Will be rounded to 64mS multiples when clock source is 128KHz and 256mS

    # when clock source is 32KHz external crystal.

   "wakeFromHidoffInMs" = 0

   # Reference clock source to use; TIMED_WAKE_CLK_SRC_128KHZ = internal 128KHz LPO

   # TIMED_WAKE_CLK_SRC_32KHZ = external 32KHz LPO if available.

   "wakeFromHidoffRefClk" = "TIMED_WAKE_CLK_SRC_128KHZ"      

}

# Master control for deep sleep

ENTRY "BLE App Hid-off config"

{

     # Only valid configuration.

    "Hid-off allowed" = 0x17

}