Spurious ADC values

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Spurious ADC values

1,772 次查看
chrispflieger
Contributor IV

LPC 1227 running at 36 MHz and I need to sample a DC signal, so roughly 1/10 second will be fine, no IRQ required.

The problem is I see a lot of spurious values coming from the ADC - I have a buffer of 36 recent values, and nine are just way out of bounds - like should be ~24600 but some are ~32000 and some below 1000.

The setup code:

   LPC_IOCON->R_PIO0_30 = 0x00000003;
   LPC_SYSCON->PDRUNCFG      &= ~( 1ul <<  4 ); // Power up ADC block
   LPC_SYSCON->SYSAHBCLKCTRL |=  ( 1ul << 14 ); // Enable PCLK to ADC
   LPC_ADC->CR = 0x001010400 | (ENABLED_CHANNELS);     // set for burst mode with a 36MHz clock.

The sample code:

    while ((LPC_ADC->GDR & 0x80000000) == 0);
    result = (uint16_t)((LPC_ADC->GDR & 0x0000FFC0) >> 6);

I assume there's some weird sampling problem because of burst mode, but is there something I need to do to synchronize sampling?

标签 (1)
2 回复数

1,563 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi Chris Pflieger,

Thank you for your interest in NXP Semiconductor products and 
for the opportunity to serve you.

To provide the fastest possible support, I've attached a ADC demo and please refer to it for details.

Have a great day,
TIC

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,563 次查看
chrispflieger
Contributor IV

There's my problem. Even though I'm only looking at one channel, LPC_ADC->GDR gives wonky values, but LPC_ADC->DR[0] doesn't.

0 项奖励
回复