Forums

SD16_A ADC reference voltage?

Started by Leon July 24, 2007
I'm just starting to play with the SD16_A ADC on the 'F2013, and can't get
the internal reference to output on pin 5. It should be 1.2V. I've set bits
3 and 2 (VMIDON and REFON) in the SD16CTL register, which should do it
according to the User's Guide. Has anyone got any idea what I'm doing wrong?

Leon
--
Leon Heller
Amateur radio call-sign G1HSM
Yaesu FT-817ND and FT-857D transceivers
Suzuki SV1000S motorcycle
l...@btinternet.com
http://webspace.webring.com/people/jl/leon_heller/

Beginning Microcontrollers with the MSP430

If you examine the "P1 pin functions" table in the data-sheet, you
will see that you need to set P1SEL.3=1 and SD16AE.3=0/

--- In m..., "Leon" wrote:
>
> I'm just starting to play with the SD16_A ADC on the 'F2013, and
can't get
> the internal reference to output on pin 5. It should be 1.2V. I've
set bits
> 3 and 2 (VMIDON and REFON) in the SD16CTL register, which should do it
> according to the User's Guide. Has anyone got any idea what I'm
doing wrong?
>
> Leon
> --
> Leon Heller
> Amateur radio call-sign G1HSM
> Yaesu FT-817ND and FT-857D transceivers
> Suzuki SV1000S motorcycle
> leon355@...
> http://webspace.webring.com/people/jl/leon_heller/
>
--- In m..., "old_cow_yellow"
wrote:
>
> If you examine the "P1 pin functions" table in the data-sheet, you
> will see that you need to set P1SEL.3=1 and SD16AE.3=0/

Thanks, I found I needed the P1SEL, but I didn't notice the SD16AE. I
think I also need to make the pin an output. Why can't they put all
that stuff in one place?

Leon
There are 2*2*2=8 different combinations for P1DIR.3=0/1, P1SEL.3=0/1
and SD16AE.3=0/1. But pin 5 has only 4 different functions, P1.3-in,
P1.3-out, VREF, and A0-. Somehow TI decided that:

(a) If SD16AE.3=1 then pin 5 is A0-. (P1SEL.3 and P1DIR are ignored.)
(b) If SD16AE.3=0 and P1SEL.3=1 then pin 5 is VREF. (P1DIR.3 is ignored.)
(c) If SD16AE.3=0, P1SEL.3=0 and P1DIR=1, then pin 5 is P1.3-out.
(d) If SD16AE.3=0, P1SEL.3=0 and P1DIR=0, then pin 5 is P1.3-in.

After POR, SD16AE.3=0, P1SEL.3=0, and P1DIR.3=0. Thus pin 5 is P1.3-in
by default.

If you want pin 5 to become P1.3-out from its default, you only need
to change P1OUT.3 to 1. You do not need to change P1SEL.3 or SD16AE.3.

If you want pin 5 to become VREF from its default, you only need to
change P1SEL.3 to 1. You do not need to change P1DIR.3 or SD16AE.3.

If you want pin 5 to become A0- from its default, you only need to
change SD16AD.3 to 1. You do not need to change P1DIR.3 or P1SEL.3.

I told you that you need to set P1SEL.3=1 and SD16AE.3=0 because I do
not know if SD16AE.3 still has its default POR setting of 0. If you
never touched it, you do not need to set it to 0 again. You only need
to set P1SEL.3=1.

According to the data-sheet, when SD16AE.3=0 and P1SEL.3=1 pin 5 is
VREF independent of P1DIR.3 setting. Did you find that this is not true?

--- In m..., "Leon Heller" wrote:
>
> --- In m..., "old_cow_yellow"
> wrote:
> >
> > If you examine the "P1 pin functions" table in the data-sheet, you
> > will see that you need to set P1SEL.3=1 and SD16AE.3=0/
>
> Thanks, I found I needed the P1SEL, but I didn't notice the SD16AE. I
> think I also need to make the pin an output. Why can't they put all
> that stuff in one place?
>
> Leon
>
----- Original Message -----
From: "old_cow_yellow"
To:
Sent: Thursday, July 26, 2007 12:24 AM
Subject: [msp430] Re: SD16_A ADC reference voltage?

> According to the data-sheet, when SD16AE.3=0 and P1SEL.3=1 pin 5 is
> VREF independent of P1DIR.3 setting. Did you find that this is not true?
I tried that and it didn't help. I checked the bits in the debugger to make
sure I hadn't done anything silly and they were OK.

Leon
I tried the following code:

void main(void)
{
WDTCTL = WDTPA | WDTHOLD;
SD16CTL |= SD16REFON;
P1SEL |= BIT3;
while (1) {};
}

Pin 5 shows 1.2VDC as expected. I use the debugger to examine the
registers. P1OUT.3 is 0 due to POR. When I change it to 1, pin 5 still
show 1.2VDC as expected. SD16AE.3 is also 0 due to POR. When I change
it to 1, pin 5 drops to 0V as expected. So far all agree with what the
data-sheet says.

HOWEVER, if I set the SD16VMIDON bit to 1, pin 5 starts to oscillate.
The frequency is ~6MHz with 2.4V peak to peak. The average DC bias
voltage is about 1.2V. Do I need a big capacitor there?

--- In m..., "Leon" wrote:
>
> ----- Original Message -----
> From: "old_cow_yellow"
> To:
> Sent: Thursday, July 26, 2007 12:24 AM
> Subject: [msp430] Re: SD16_A ADC reference voltage?
>
> > According to the data-sheet, when SD16AE.3=0 and P1SEL.3=1 pin 5 is
> > VREF independent of P1DIR.3 setting. Did you find that this is not
true?
> I tried that and it didn't help. I checked the bits in the debugger
to make
> sure I hadn't done anything silly and they were OK.
>
> Leon
>
--- In m..., "old_cow_yellow"
wrote:
>
> I tried the following code:
>
> void main(void)
> {
> WDTCTL = WDTPA | WDTHOLD;
> SD16CTL |= SD16REFON;
> P1SEL |= BIT3;
> while (1) {};
> }
>
> Pin 5 shows 1.2VDC as expected. I use the debugger to examine the
> registers. P1OUT.3 is 0 due to POR. When I change it to 1, pin 5
still
> show 1.2VDC as expected. SD16AE.3 is also 0 due to POR. When I
change
> it to 1, pin 5 drops to 0V as expected. So far all agree with what
the
> data-sheet says.
>
> HOWEVER, if I set the SD16VMIDON bit to 1, pin 5 starts to
oscillate.
> The frequency is ~6MHz with 2.4V peak to peak. The average DC bias
> voltage is about 1.2V. Do I need a big capacitor there?

I got it to work with some similar code. I actually get 1.174V, which
is within the spec.

Leon
--- In m..., "old_cow_yellow"
wrote:
>
> I tried the following code:
>
> void main(void)
> {
> WDTCTL = WDTPA | WDTHOLD;
> SD16CTL |= SD16REFON;
> P1SEL |= BIT3;
> while (1) {};
> }
>
> Pin 5 shows 1.2VDC as expected. I use the debugger to examine the
> registers. P1OUT.3 is 0 due to POR. When I change it to 1, pin 5
still
> show 1.2VDC as expected. SD16AE.3 is also 0 due to POR. When I
change
> it to 1, pin 5 drops to 0V as expected. So far all agree with what
the
> data-sheet says.
>
> HOWEVER, if I set the SD16VMIDON bit to 1, pin 5 starts to
oscillate.
> The frequency is ~6MHz with 2.4V peak to peak. The average DC bias
> voltage is about 1.2V. Do I need a big capacitor there?
>

Yes, > 470nF. The buffer is probably oscillating without it.
According to page 47 of the data sheet bit SD16VMIDON has to be 1 for
the voltage to be output, but we both get it with the bit set to zero
which is rather strange.

Leon