Dear Nordic,
we developed firmware based on S112 and SDK 17.1.0. We have a problem with poweroff routine: at poweroff the status LED is ON.
this is part of our circuit, its very simple:

and the code is short too:
#define PIN_LED_R 22 // PIN 04 (P0.22)
#define PIN_LED_G 23 // PIN 03 (P0.23)
#define PIN_LED_B 24 // PIN 02 (P0.24)
#define LED_PWM_INSTANCE 0 // value PWM instance index.
#define LED_PWM_IRQ_PRIORITY APP_IRQ_PRIORITY_LOWEST // value Interrupt priority.
#define LED_PWM_DUTY_MAX 1000 // value max PWM duty value (800 = 625 Hz; 1000 = 500 Hz)
#define LED_PWM_DUTY_FACTOR 255 // value duty factor for % duty conversion
/* INIT di controllo del LED */
void vInit_StatLED( void ) {
ret_code_t err_code;
static const nrfx_pwm_config_t pwm_config = {
.output_pins = { // Pin numbers for individual output channels
PIN_LED_R,
PIN_LED_G,
PIN_LED_B,
NRFX_PWM_PIN_NOT_USED // Use NRFX_PWM_PIN_NOT_USED if a given output channel is not needed.
},
.irq_priority = LED_PWM_IRQ_PRIORITY, // Interrupt priority.
.base_clock = NRF_PWM_CLK_500kHz, // Base clock frequency.
.count_mode = NRF_PWM_MODE_UP, // Operating mode of the pulse generator c
.top_value = LED_PWM_DUTY_MAX, // Value up to which the pulse generator c
.load_mode = NRF_PWM_LOAD_INDIVIDUAL, // Mode of loading sequence data from RAM: 1st half word (16-bit) used in channel 0; 2nd in channel 1; 3rd in channel 2; 4th in channel 3.
.step_mode = NRF_PWM_STEP_AUTO // Mode of advancing the active sequence.
};
err_code = nrfx_pwm_init( &m_pwm_instance, &pwm_config, NULL );
APP_ERROR_CHECK( err_code );
seq_value.channel_0 = 0; // Duty cycle value for channel 0.
seq_value.channel_1 = 0; // Duty cycle value for channel 1.
seq_value.channel_2 = 0; // Duty cycle value for channel 2.
seq_value.channel_3 = 0; // Duty cycle value for channel 3.
// init dei PIN, stato GPIO
nrf_gpio_pin_write( PIN_LED_R, true );
nrf_gpio_pin_write( PIN_LED_G, true );
nrf_gpio_pin_write( PIN_LED_B, true );
return;
}
/* UNinit di controllo del LED */
void vUNinit_StatLED( void ) {
// deInit PWM
nrfx_pwm_uninit( &m_pwm_instance );
// deInit GPIO
nrf_gpio_cfg_default( PIN_LED_R );
nrf_gpio_cfg_default( PIN_LED_G );
nrf_gpio_cfg_default( PIN_LED_B );
return;
}
/* power off the system */
void vUtil_System_PowerOFF( void ) {
ret_code_t err_code = NRF_SUCCESS;
vUNinit_StatLED();
NRF_LOG_RAW_INFO( "%6ums\t%s(): powering off the system\n", xTaskGetTickCount(), __func__ );
err_code = sd_power_system_off(); // Go to system-off mode (this function will not return; wakeup will cause a reset).
APP_ERROR_CHECK( err_code );
while( 1 );
}
/** MAIN Program **/
int main( void ) {
vInit_StatLED();
ret_code_t err_code;
// Initialize clock
err_code = nrf_drv_clock_init();
APP_ERROR_CHECK( err_code );
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // Activate deep sleep mode.
err_code = nrf_sdh_enable_request(); // Initialize the SoftDevice and the stack event interrupt.
APP_ERROR_CHECK( err_code );
ASSERT( nrf_sdh_is_enabled() ); // sanity check for SoftDevice Initialized
while( 1 ) {
/*
do some stuff
*/
vUtil_System_PowerOFF();
}
}
The issue is that when I call the vUtil_System_PowerOFF() function, the CPU turns off but the LED is turned ON at full bright.
Please could you help me?
Thanks!