Hi,
HW:customized nRF52840 board
SW: nRF5_SDK_15.2.0_9412b96
Application: modified blinky_rtc_freertos example (PWM led + freeRTOS task)
Q1) How to verify my application has enter sleep mode? My freeRTOS task PWM stop working after runs for a few second.
Q2) If my application enter sleep mode, I want to know which sleep mode I enter(softdevice deep sleep? Or FreeRTOS tickless idle mode/Sleep) as my code always at while loop inside the task.
Q3) How do I ensure when PWM led is running the device won't enter sleepmode for softdevice/FreeRTOS tickless idle?
void demo1 (void * pvParameter)
{
UNUSED_PARAMETER(pvParameter);
/*
* This demo plays back a sequence with different values for individual
* channels (LED 1 - LED 4). Only four values are used (one per channel).
* Every time the values are loaded into the compare registers, they are
* updated in the provided event handler. The values are updated in such
* a way that increase and decrease of the light intensity can be observed
* continuously on succeeding channels (one second per channel).
*/
nrf_drv_pwm_config_t const config0 =
{
.output_pins =
{
LED_RED | NRF_DRV_PWM_PIN_INVERTED, // channel 0
LED_BLU | NRF_DRV_PWM_PIN_INVERTED, // channel 1
LED_GRN | NRF_DRV_PWM_PIN_INVERTED, // channel 2
// BSP_LED_0 | NRF_DRV_PWM_PIN_INVERTED, // channel 0
// BSP_LED_1 | NRF_DRV_PWM_PIN_INVERTED, // channel 1
// BSP_LED_3 | NRF_DRV_PWM_PIN_INVERTED, // channel 2
NRF_DRV_PWM_PIN_NOT_USED // channel 3
},
.irq_priority = APP_IRQ_PRIORITY_LOWEST,
.base_clock = NRF_PWM_CLK_2MHz,
.count_mode = NRF_PWM_MODE_UP,
.top_value = m_demo1_top,
.load_mode = NRF_PWM_LOAD_COMMON,
.step_mode = NRF_PWM_STEP_AUTO
};
nrf_drv_pwm_uninit(&m_pwm0);
APP_ERROR_CHECK(nrf_drv_pwm_init(&m_pwm0, &config0, demo1_handler));
m_used |= USED_PWM(0);
m_demo1_seq_values.channel_0 = 0;
m_demo1_seq_values.channel_1 = 0;
m_demo1_seq_values.channel_2 = 0;
m_demo1_seq_values.channel_3 = 0;
m_demo1_phase = 0;
(void)nrf_drv_pwm_simple_playback(&m_pwm0, &m_demo1_seq, 1,
NRF_DRV_PWM_FLAG_LOOP);
uint8_t sample_data;
uint8_t config = 0x06;
while(1)
{
};
}