⚠️
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//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
6 posts / 0 new
Last post
powersquare
Offline
Last seen:4 months 2 weeks ago
Joined:2018-12-27 04:15
LED continuous glow

Dear Dialog team,

Thank you for your support.

We have custom board made from DA14683. We have 3 LEDs on this board and they are not tied to any GPIOs. We use LED low level driver APIs turn on them. Below is the reference code:

static timer2_config cfg = {
.frequency = 0,
.pwm2_end = 0,
.pwm2_start = 0,
.pwm3_end = 0,
.pwm3_start = 0,
.pwm4_end = 0,
.pwm4_start = 0,
};
hw_timer2_init(&cfg);
hw_timer2_set_division_factor(HW_TIMER2_DIV_4);
hw_timer2_set_frequency(100);
hw_timer2_set_pwm_duty_cycle(HW_TIMER2_PWM_2, 100);
hw_timer2_enable();
hw_led_set_led1_src(HW_LED_SRC1_PWM2);
hw_led_enable_led1(true);

Is the above code correct to turn on LED?

If yes, then our reference project is BLE peripheral. Our application reads sensors data continuously, stores the data in flash and when app is connected via bluetooth, then sensor data will be transmitted to the app.

We observed that LED turns on, when the board brings up, but turns off, after few seconds. Is this because of setting pm_extended_sleep mode (during advertising mode, board wakesup and goes to sleep after advertising)? If we set to pm_active_mode, then LED glows continuously. If we move the above code (LED code) to periph_init() function, then LED blinks.

If we need to use pm_extended_sleep mode, can you suggest how to glow LED continuously? Also suggest, whether we need to use pm_extended_sleep or pm_active_mode setting for our application. We observed this behaviour in development kit also.

Please let us know for any clarifications.

Best regards

Malli

Keywords:
LED
Device:
CYibin
Offline
Last seen:5 months 4 days ago
Staff
Joined:2017-12-14 02:48
Hi Malli,

Hi Malli,

The power of the perepheral will be shutdown when system enters sleep mode. So the LEDs that using PWM can not work during sleep time.

In my opinion, you can setup a valid flag checking whether the PWM Leds working or not. If yes, then do not enter sleep mode.

BR, Yibin

powersquare
Offline
Last seen:4 months 2 weeks ago
Joined:2018-12-27 04:15
Dear Dialog team,

Dear Dialog team,

Do you have any SDK API, not to enter sleep mode? Because this sleep is caused by SDK advertising mode (pm_extended_sleep).

Best regards

Malli

MHv_Dialog
Offline
Last seen:3 weeks 5 days ago
Staff
Joined:2013-12-06 15:10
Hi powersquare,

Hi powersquare,

The PWM block will be powered down during sleep so if you need the LEDs to be on, you will have to disable sleep (this will not increase the power consumption in any meaningful way as the LEDs will consume the vast majority of the power when lit)

/MHv

powersquare
Offline
Last seen:4 months 2 weeks ago
Joined:2018-12-27 04:15
Dear Dialog team,

Dear Dialog team,

Can you help us, how to disable the sleep?

Best regards

Malli

MHv_Dialog
Offline
Last seen:3 weeks 5 days ago
Staff
Joined:2013-12-06 15:10
Hi Malli,

Hi Malli,

Please see the software reference manual section 9 for details on how to control the power mode of the device://www.xmece.com/sites/default/files/um-b-044-da1468x_software_platform_reference_6v0.pdf

The clock and power manager (CPM) is the key to this type of control. You can tell the CPM that you require the device to stay awake using the provided CPM API.

/MHv