This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PWM current / power consumption

FormerMember
FormerMember

Hello,

I need help,

I'am using uvision V5.17, SDK 9.0.0 and SD130.

First problem is solved,

If I don't declare app_pwm_init() in app_pwm.h, the current is 0.4mAh steadily,

but If I declare app_pwm_init() the current increase to 1.6mAh.

So I reference from this blog I found the answer.

but it's not perfect.

static void start_servo(void)
{				
    nrf_drv_gpiote_out_task_enable(SERVO_PIN);

    /* Initialize and enable PWM. */
    uint32_t err_code = app_pwm_init(m_pwm_t, m_pwm1_cfg, servo_ready_callback);
    APP_ERROR_CHECK(err_code);

    app_pwm_enable(m_pwm_t);
}

-----------------------------after above start_servo() the current becomes 1.6mAh

static void stop_servo(void)
{	
	app_pwm_disable(m_pwm_t);
	nrf_drv_gpiote_out_task_disable(SERVO_PIN);

	uint32_t err_code = app_pwm_uninit(m_pwm_t);
	APP_ERROR_CHECK(err_code);

	nrf_gpio_cfg_output(SERVO_PIN);
	nrf_gpio_pin_set(SERVO_PIN);		
}

-----------------------------after above stop_servo() the current becomes 0.3 to 0.9mAh

The problem is that before I declare start_servo() first time,

the current maintain 0.4mAh steadily, but after start_servo() and stop_servo(),

the current maintain 0.3mAh to 0.9mAh rapidly.

I wanna get 0.4mAh or less when I don't use servo. How can I fix it?

Parents
  • The SDK 9 driver has some known issues regarding app_pwm_uninit() and app_pwm_disable(). I will therefore suggest that you use the SDK 10 driver. You only need to call app_pwm_disable(), as this will stop the timer and reduce the current consumption. app_pwm_uninit() is for deallocate the resources used by the pwm and are therefore not necessary to call in your case. You should also remove the nrf_drv_gpiote calls, this is fixed by the driver. Doing nrf_drv_gpiote calls on the pwm pin may create issues with the pwm driver.

    If you don't want to migrate the project to SDK 10, it should be possible to only include the app_pwm.c and app_pwm.h files.

  • How high and how short? You can only start the PWM and comment out all other code to only measure PWM.

Reply Children
No Data
Related