cancel
Showing results for 
Search instead for 
Did you mean: 

adc resolution

swiggers9
Associate II
Posted on September 21, 2006 at 06:03

adc resolution

11 REPLIES 11
swiggers9
Associate II
Posted on September 19, 2006 at 10:52

Hello,

I am working with a STR710FZ2 (on an evaluation kit from Keil, MCBSTR7) and have some problems with the adc resolution.

I supply a voltage of 1.5000 volts to adc0 and use a sample frequentie of 1 kHz. When I monitor the adc registers the value varies with 5 counts.

(5/4096 * 2.5 = 3,05 mV). since the there is not that much noise on the input signal, I would expect the adc value to be stable.

Is there something I can do to get a better resolution?

hichem2
Associate II
Posted on September 19, 2006 at 11:12

Hello,

With the STR71x software library there is an ADC example (polling example).

This example shows how to use and calibrate the ADC12 in single channel conversion mode.

Could you please try it in your board and let me khnow of the conversion result stability, normaly it could be stable like on the MB393B ST demo board.

With best regards,

Hich

swiggers9
Associate II
Posted on September 19, 2006 at 11:21

I have tried that example allready, and it also gives varying values.

I haven't calibrated the adc, but I don't need the correct value. It only has to give a stable value.

I think the only solution is to use a better external adc. :-[

hichem2
Associate II
Posted on September 19, 2006 at 12:08

Hi,

Are you sure that the noise is not due to your analog input?

regards,

Hich

swiggers9
Associate II
Posted on September 19, 2006 at 12:18

yes I'm sure. the analog input is very stable. I did the same test with a different microcontroller and the results were fine.

Here is some code of the initialisation and the interrupt handler

Code:

/*************************** FUNCTION ************************************/

bool init_adc_module(void)

/*************************** INFO ****************************************

**

** DESCRIPTION : Init adc module.

**

** INPUT :

**

** OUTPUT :

**

** RETURN : TRUE, initialisation was successfully.

**************************************************************************/

{

uint16 Tmp;

uint8 cnt;

for(cnt=0; cnt < MAX_ADC_INPUTS; cnt++)

{

adc_data[cnt].adc_active = FALSE;

adc_data[cnt].adc_delayint_active = FALSE;

adc_data[cnt].adc_delayint_samples = 0;

}

config_gpio_port(PORT_1, 1, GPIO_INPUT_ANALOG);

config_irq_channel_priority(IRQ_CHANNEL_ADC, IRQ_PRIORITY_ADC);

config_irq_channel(IRQ_CHANNEL_ADC, ENABLE);

config_interrupts(ENABLE);

ADC12->CSR = 0x0000; // reset status register

ADC12->CPR = 0x0010; // set prescaler

ADC12->CSR |= 0x0F00; // enable interrupts for all channels

PCU->BOOTCR |= 0x0020; // set adc_en bit

do

{

Tmp=ADC12->CSR;

}

while((Tmp & 0x000F) == 0);

enable_timer_process(TMR_handle_adc_inputs);

return(TRUE);

}

/*************************** FUNCTION ************************************/

void adc_isr(void)__arm

/*************************** INFO ****************************************

**

** DESCRIPTION : adc interrupt for all channels

**

** INPUT :

**

** OUTPUT :

**

** RETURN :

**************************************************************************/

{

static uint8 adc_cnt = 1;

uint8 cnt;

sint16 adc_sample;

ADC_DATA_REC *adc;

for(cnt = 0; cnt < MAX_ADC_INPUTS; cnt++)

{

if(ADC12->CSR & (0x01 << cnt))

{

ADC12->CSR &= ~(0x01 << cnt);

switch(cnt)

{

case INP_ADC0:

adc_sample = (ADC12->DATA0);

break;

case INP_ADC1:

adc_sample = ADC12->DATA1;

break;

case INP_ADC2:

adc_sample = ADC12->DATA2;

break;

case INP_ADC3:

adc_sample = ADC12->DATA3;

break;

}

adc_sample = (uint16)(adc_sample >> 4);

adc = &(adc_data[cnt]);

adc->adc_buf[adc->adc_buf_write_point] = adc_sample;

adc->adc_buf_write_point++;

if(adc->adc_buf_write_point >= ADC_BUFLEN)

{

adc->adc_buf_write_point = 0;

}

if(adc->adc_delayint_active && (--adc_cnt) == 0)

{

adc_cnt = adc->adc_delayint_samples;

delayed_int = TRUE;

}

}

}

}

kleshov
Associate II
Posted on September 19, 2006 at 15:44

How do you supply AVDD? The datasheet says that power to the ADC should be filtered.

swiggers9
Associate II
Posted on September 20, 2006 at 06:13

attached you find a schematic of my power supply. I think it is filtered enough :)

________________

Attachments :

power_supply.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Ht9o&d=%2Fa%2F0X0000000aJi%2F.LC0aiPXAKXjmirP43Ai9V04EQD7Jj0UFw.UVHIKi18&asPdf=false
kleshov
Associate II
Posted on September 20, 2006 at 14:00

I have had problems with LC networks as filters for power supply. I never got around to finding out what was wrong exactly. Try a simple RC network, say 10 Ohms and 1 uF.

swiggers9
Associate II
Posted on September 21, 2006 at 05:05

after some more research I found that the problem has something to do with the RS232 connection. I have a program which polls parameters via rs232 every 10 msec. When I haven't started the connection everything works fine and I see a noise of about 1 mVolts which is ok.

But after making connection the noise increases on the entire board with about 3 mVolts. so this explains the difference of 5 counts in my adc ((0.003/2,5) * 4096 = 4.9)

but I still haven't found the cause of the extra noise.

here are the board I'm using and the schematics.

If you have any suggestions I would love to here it.

http://keil.com/arm/mcbstr7/mcbstr7-schematics.pdf

0690X00000602eHQAQ.jpg