This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5659: ADC functionality with VeREF-

Part Number: MSP430F5659


Hi all,

I just started working on a project written by a collegue who left, and I am still pretty beginner with MSP430. I am trying to use his code with a newer version of a PCB that has a different connection layout with the onboard MSP430.

There used to be a voltage divider analog input reading on pin 4, but it switched to pin 10 on the new PCB (I dont think they did that on purpose). This is the VeREF- pin on the datasheet... Is there any way I can read an analog input from there or I will need to patch the PCBs? thanks!!

  • It looks like you can read Veref- using ADC channel 9 [Ref User Guide (SLAU208Q) Table 28-8].

  • How would that be setup in the firmware? because in the datasheet, A0:7 pins setup is very easy referring to table 9-62

    but reading from pin 10 only seems to let you set an external Vref for the ADC on table 9-60. no Analog input pin here, right?

  • UG Table 28-8 seems to say that you should configure the pin as Veref- (PSEL=1, REFOUT=0) then set ADC12INCH=9. Data Sheet (SLAS700E) Table 9-60 Note (5) assures that it will be configured appropriate to an Analog pin.

    Data sheet Sec 8.43 seems to limit Veref- to <1.2V, but Note (3) says that limit only applies if you're actually using it as Veref-.

    Stating the obvious: It's probably not useful to use pin 10 as an actual Veref-, i.e. you're limited to ADC12SREF<4.

  • I am not so familiar with ADC operations. I tried setting pin 10 as analog input and I

    P5DIR |= ANALOG_TEMP_BIT; P5SEL |= ANALOG_TEMP_BIT; P5REN &= ~ANALOG_TEMP_BIT;

    ADC12MCTL9 = 0b00001001;

    I am not sure that is the right thing to do, especially setting 9 to the bits 3:0 of the ADC12MCTL9 to 9, I am trying to activate ADC channel 9, but something is wrong and redundant in setting 0x9 to register #9... Would you be able to help me with that?? thanks!

  • Example msp430f665x_adc_08.c does something similar to what you want.

    https://dev.ti.com/tirex/explore/node?node=AKvzYkIK23d9zfxaMA-NXQ__IOGqZri__LATEST

    Curiously enough, the Example doesn't even set P5SEL (seems like it should). You shouldn't set P5DIR, though it might not matter.

  • I have not been able to make it work yet. The MSP stays stock in the ADC isr vector for ever and I dont understand why. 

    The purpose of the example is to turn the Vref pins as analog inputss, and set VCC and VSS as the new ADC references? thanks again for your help

  • The Example uses CONSEQ=3 and MSC=1, so the ADC is (autonomously) converting the channels as fast as it can. You probably won't do this, but I suppose it makes a convenient demonstration. You can look at results[] (Expressions window) or ADC12MEM1 (Registers window) to see the converted value.

    As you say, it uses SREF=0 (Vcc/Vss). Looking at User Guide (SLAU208Q) Fig 28-1, I don't see any reason you couldn't use the internal reference (1.5/2.0/2.5V) by setting ADC12SREF_1.

    This is probably a good time to find the ADC code in your current code base, which probably looks similar to the Example. I suspect all you need to do is change the ADC12INCH setting for the channel the previous board was using.

    Besides the PSEL thing I mentioned before, the other thing I noticed about this Example is that the sample/hold time SHT0 is set to 15, or 1024 ticks, which is really quite a long time -- with ADC clock ADC12SSEL=0 (5MHz), that's more than 200usec. I'm going to suppose that that is just for the demonstration, since Fig 28-1 doesn't show anything which would interfere with the signal on its way in. I expect you can use whatever SHT0 value the previous code used.

**Attention** This is a public forum