Hi,
I am working on ncs 2.9.1 @ nRF54L15.
I followed this academy course to add a single channel saadc in simple mode:
/* STEP 5.1 - Connect ADC interrupt to nrfx interrupt handler */ IRQ_CONNECT(DT_IRQN(DT_NODELABEL(adc)), DT_IRQ(DT_NODELABEL(adc), priority), nrfx_isr, nrfx_saadc_irq_handler, 0); /* STEP 5.2 - Initialize the nrfx_SAADC driver */ nrfx_err_t err = nrfx_saadc_init(DT_IRQ(DT_NODELABEL(adc), priority)); if (err != NRFX_SUCCESS) { LOG_ERR("nrfx_saadc_mode_trigger error: %08x", err); return -1; } /* STEP 5.3 - Configure the SAADC channel */ channel.channel_config.gain = NRF_SAADC_GAIN1_4; err = nrfx_saadc_channels_config(&channel, 1); if (err != NRFX_SUCCESS) { LOG_ERR("nrfx_saadc_channels_config error: %08x", err); return -1; } /* STEP 5.4 - Configure nrfx_SAADC driver in simple and blocking mode */ err = nrfx_saadc_simple_mode_set(nrfx_saadc_channels_configured_get(), NRF_SAADC_RESOLUTION_12BIT, NRF_SAADC_OVERSAMPLE_DISABLED, NULL); if (err != NRFX_SUCCESS) { LOG_ERR("nrfx_saadc_simple_mode_set error: %08x", err); return -1; } /* STEP 5.5 - Set buffer where sample will be stored */ err = nrfx_saadc_buffer_set(&sample, 1); if (err != NRFX_SUCCESS) { LOG_ERR("nrfx_saadc_buffer_set error: %08x", err); return -1; } err = nrfx_saadc_offset_calibrate(NULL); if (err != NRFX_SUCCESS) { LOG_ERR("nrfx_saadc_offset_calibrate error: %08x", err); return rc; } /* Step 7.2 - Trigger the sampling */ err = nrfx_saadc_mode_trigger(); if (err != NRFX_SUCCESS) { LOG_ERR("nrfx_saadc_mode_trigger error: %08x", err); return rc; } /* STEP 7.3 - Calculate and print voltage */ int adc_voltage = ((900 * 4) * sample) / ((1<<12)); int battery_voltage = adc_voltage * 1220 / 220; LOG_DBG("SAADC sample: %d Battery Voltage: %d mV", sample, battery_voltage);
ADC read works properly, but the current read from PPK2 raised from 30uA to 1.3mA when nrfx_saadc_mode_trigger been called.
How to disable saadc after sampling is triggered?
I tried call nrfx_saadc_abort but the current is still high
Regards,
Anthony