ble_app_sleepmode and LED

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at https://www.dialog-semiconductor.com/support . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
6 posts / 0 new
Last post
3hl3rt
Offline
Last seen: 8 months 3 weeks ago
Joined: 2021-01-23 10:57
ble_app_sleepmode and LED

Hey,

 

I am working on the ble_app_sleepmode example on a custom board.

I have one button and two LEDs - the button wakes up the device, it stays awak for 10s, and goes back to sleep - all is good.

now I just wanted to make a very simple addition to this, to ahve one LED light up when the button is pressed, and have the other stay lit as long as they device is awake.

(this is not the real usecase, but I am just trying to get it to work.

I try: 

void user_app_adv_start(void)
{
		GPIO_SetActive(GPIO_LED_PORT, GPIO_LED_RED);

and

static void app_button_press_cb(void)
{
GPIO_SetActive(GPIO_LED_PORT, GPIO_LED_GRN);

my issues is, that no matter what I try, the LED's are shut off after about 0.75second.

I am unsure what is doing this...

configuration:

void GPIO_reservations(void)
{
/*
    i.e. to reserve P0_1 as Generic Purpose I/O:
    RESERVE_GPIO(DESCRIPTIVE_NAME, GPIO_PORT_0, GPIO_PIN_1, PID_GPIO);
*/

    RESERVE_GPIO(PUSH_BUTTON, GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, PID_GPIO);
 //   RESERVE_GPIO(PWM0, GPIO_LED_PORT, GPIO_LED1_PIN, PID_PWM0);
//	  RESERVE_GPIO(PWM0, GPIO_LED_PORT, GPIO_LED2_PIN, PID_PWM0);
	  RESERVE_GPIO(PWM0, GPIO_LED_PORT, GPIO_LED_RED, PID_GPIO);
	  RESERVE_GPIO(PWM0, GPIO_LED_PORT, GPIO_LED_GRN, PID_GPIO);


void set_pad_functions(void)
{
/*
    i.e. to set P0_1 as Generic purpose Output:
    GPIO_ConfigurePin(GPIO_PORT_0, GPIO_PIN_1, OUTPUT, PID_GPIO, false);
*/

#if defined (__DA14586__)
    // Disallow spontaneous DA14586 SPI Flash wake-up
    GPIO_ConfigurePin(GPIO_PORT_2, GPIO_PIN_3, OUTPUT, PID_GPIO, true);
#else
    // Disallow spontaneous SPI Flash wake-up
    GPIO_ConfigurePin(SPI_EN_PORT, SPI_EN_PIN, OUTPUT, PID_SPI_EN, true);
#endif

    GPIO_ConfigurePin(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, INPUT_PULLUP, PID_GPIO, false);
	
	    // Configure LED pin functionality
    GPIO_ConfigurePin(GPIO_LED_PORT, GPIO_LED_RED, OUTPUT, PID_GPIO, false);
	  GPIO_ConfigurePin(GPIO_LED_PORT, GPIO_LED_GRN, OUTPUT, PID_GPIO, false);


#if defined (CFG_PRINTF_UART2)
    // Configure UART2 TX Pad
    GPIO_ConfigurePin(UART2_TX_PORT, UART2_TX_PIN, OUTPUT, PID_UART2_TX, false);
#endif
}

 

PM_Dialog
Offline
Last seen: 1 month 1 week ago
Staff
Joined: 2018-02-08 11:03
Hi There,

Hi There,

Thanks for your question on our public BLE forums and for your interest in our TINY module solution.

Since you are using the ble_app_sleepmode example as a starting point, can you please check what is the value of the app_default_sleep_mode variable in user_config.h file?

If it is ARCH_EXT_SLEEP_ON, then it means that the device will go into sleep mode between advertising or connection intervals. Please keep in mind that when the device sleeps, all the peripheral domains are power-down.

Thanks, PM_Dialog

3hl3rt
Offline
Last seen: 8 months 3 weeks ago
Joined: 2021-01-23 10:57
I have:

I have:

static const sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_OTP_COPY_ON;

but this issues should be caused by this, as I want the LED's on while the device is awake.
 

what happens is:

  • device is sleeping
  • I press the button, the device wakes
  • The LED turns on
  • after aprox 0.75s, the LED turns off
  • after 10s (as I have defined) the devices goes to sleep

    so the LED turns off while the device is awake

 

PM_Dialog
Offline
Last seen: 1 month 1 week ago
Staff
Joined: 2018-02-08 11:03
Hi There,

Hi There,

Can you please try to disable the sleep ?

static const sleep_state_t app_default_sleep_mode = ARCH_SLEEP_OFF;

Thanks, PM_Dialog

3hl3rt
Offline
Last seen: 8 months 3 weeks ago
Joined: 2021-01-23 10:57
it didnt make any diffrence

it didnt make any diffrence

PM_Dialog
Offline
Last seen: 1 month 1 week ago
Staff
Joined: 2018-02-08 11:03
Hi There,

Hi There,

In the user_app_adv_start(), does the device go to sleep during advertising?

If yes, can you please comment out the arch_set_extended_sleep(false); ?

Thanks, PM_Dialog