Skip to content

Commit 6525b8e

Browse files
committed
[LPC1549] Improve AnalogIn Performance
Modified the LPC1549 AnalogIn implementation to use the ADCs in synchronous mode, which is consistent with the LPC11U68 implementation. This improves performance, and allows the IRC oscillator to be powered down if necessary.
1 parent 8081c39 commit 6525b8e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC15XX/analogin_api.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ void analogin_init(analogin_t *obj, PinName pin) {
7777
LPC_SYSCON->SYSAHBCLKCTRL0 |= (1 << 28);
7878
}
7979

80-
// select IRC as asynchronous clock, divided by 1
81-
LPC_SYSCON->ADCASYNCCLKSEL = 0;
82-
LPC_SYSCON->ADCASYNCCLKDIV = 1;
83-
8480
__IO LPC_ADC0_Type *adc_reg = (obj->adc < ADC1_0) ? (__IO LPC_ADC0_Type*)(LPC_ADC0) : (__IO LPC_ADC0_Type*)(LPC_ADC1);
8581

8682
// determine the system clock divider for a 500kHz ADC clock during calibration
@@ -90,8 +86,8 @@ void analogin_init(analogin_t *obj, PinName pin) {
9086
adc_reg->CTRL = (1UL << 30) | (clkdiv & 0xFF);
9187
while ((adc_reg->CTRL & (1UL << 30)) != 0);
9288

93-
// switch to asynchronous mode
94-
adc_reg->CTRL = (1UL << 8);
89+
// Sampling clock: SystemClock divided by 1
90+
adc_reg->CTRL = 0;
9591
}
9692

9793
static inline uint32_t adc_read(analogin_t *obj) {

0 commit comments

Comments
 (0)