- nRF52840
- SDK 15.3
- Segger Embedded Studio
I PWM a piezo buzzer (with a transistor) , using the PWM peripheral. The problem I encounter is that before I call the PWM function the power consumption is around 5uA, while after the PWM uninit() from the PWM event handler, the power consumption has increased to ~660uA. I checked that the driver is succesfully disabled, but I guess that the DMA is still on? If I go into shutdown mode with nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_STAY_IN_SYSOFF); the power consumption is reduced to 1.1uA as expected (mostly external hardware connected to the nRF52840).
So is there any way to reduce the power consumption after the PWM has been unitialized or is this not possible and should I use a different methode of PWM generation?
Code:
pwm.c
pwm.h
Addition to nrfx_pwm.c to check if the PWM state is equal to NRFX_DRV_STATE_UNINITIALIZED.