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.

A0, A1 input does not work (MSP430F479)

Other Parts Discussed in Thread: MSP430F479, MSP-TS430PN80, MSP430F478, MSP430FG479

 

I am testing ADC of MSP430F479. I could success in using A3, and A4 analog input

reading from the DAC output.

However, the similar program does not work for A0 and A1 analog input. A0 and A1

are assigned to P6.0, 6.1 and P6.3 and 6.4. The value obtained from them are

very small value instead of 0.6V.

I connected A0- and A1- to the GND same as the A4- to the GND.

 

Following is the program used to check the analog A1 input.. Does someone

find some mistake in this?

 

-----------------------------------------------------

#include "msp430xG47x.h"

#define   Num_of_Results   8

unsigned int results[Num_of_Results];

float g_ad;

void main(void)
{
  volatile unsigned int i;                  // Use volatile to prevent removal
                                            // by compiler optimization

  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  SD16CTL = SD16REFON;           

  for (i = 0; i < 10000; i++);              // Delay for 32 kHz crystal

  DAC12_0CTL = DAC12IR + DAC12SREF_3 + DAC12AMP_5 +  // SD16 Ref,
        DAC12OPS + DAC12ENC + DAC12CALON;

  FLL_CTL0 |= XCAP14PF;                     // Configure load caps
 
  P1SEL |= 0x40; // DAC P1.6
  P1SEL |= 0x04 + 0x08; // AD4 P1.2, 1.3
  P6SEL |= 0x01 + 0x02; // AD1 P6.0, 6.1
  P6SEL |= 0x08 + 0x10; // AD0 P6.3, 6.4
 
  for (i = 0; i < 10000; i++);              // Delay for 32 kHz crystal to
                                            // stabilize

  SD16CTL = SD16REFON + SD16SSEL0;            // 1.2V ref, SMCLK

  SD16CCTL0 |= SD16IE + SD16UNI ;    

  SD16INCTL0 |= SD16INTDLY_0 + SD16INCH_1; // INCH_0,1,4  
 
  _EINT();

  for (i = 0; i < 0x3600; i++);             // Delay for 1.2V ref startup

  SD16CCTL0 |= SD16SC;                      // Set bit to start conversion
 
  DAC12_0DAT = 0x800;  // 2048h
 
  for(;;) {
    __bis_SR_register(LPM0_bits+GIE);       
  }
   
}

#pragma vector=SD16A_VECTOR
__interrupt void SD16ISR(void)
{
  static unsigned int index = 0;

  switch (SD16IV)
  {
  case 2:                                   // SD16MEM Overflow
    break;

  case 4:                                   // SD16MEM0 IFG
    results[index] = SD16MEM0;                 
    g_ad = results[index] * 0.6 / 0xFFFF;  // unipolar
   
    if (++index == Num_of_Results)
    {
      index = 0;                           
    }
    break;
  }

  __bic_SR_register_on_exit(LPM0_bits);         // Enter LPM0

}

  • OKY,

    I would suggest double-checking your HW setup first. When configuring your code for A1 operation, can you put a multimeter directly on the device pins 63 and 64 to measure the voltage there? Is it as expected?

    If this doesn't help, I would suggest using one of our MSP430F479 SD16_A code examples as-is while applying an external voltage. The file "msp430F(G)47x_sd16a_09.c" could be used (http://www.ti.com/lit/zip/slac258).

    Regards,
    Andreas

  • Thank you for your reply, Andreas.

     

    >I would suggest double-checking your HW setup first. When configuring your code for A1 operation, can you put a >multimeter directly on the device pins 63 and 64 to measure the voltage there? Is it as expected?

    Yes. This was as expected. I checked that at least the voltage arrives at the pins.

    Also, I tested whether the pins of the evaluation board (MSP-TS430PN80) are connected to MSP430 pings

    by setting P6OUT and checking the Vcc (3.3V)  is seen by the digital voltmeter when I set

    P6DIR |= 0x08 and P6OUT |= 0x08. 

     

    >If this doesn't help, I would suggest using one of our MSP430F479 SD16_A code examples as-is while applying an >external voltage. The file "msp430F(G)47x_sd16a_09.c" could be used (http://www.ti.com/lit/zip/slac258).

    I also checked as you suggested in this. However, the A0 and A1 do not have the expected voltages.

     

    I checked by changing MCU from MSP430F479 to MSP430F478 to see whether there is some problem

    in the MCU itself. However, both MCUs still do not have the voltage on A0 and A1 analog input, but A3 and A4

    works OK for both MCUs.

     

    Is this possibly some trouble with the evaluation board  (MSP-TS430PN80)? At least, P1OUT can be

    seen at the pins of the board. When the GPIO is OK and analog input module is not OK, is this problem of

    MCU, or MSP-TS430PN80, or some definition of registers by the compiler (IAR EW I use now)?

     

     

      

  • OKY,

    thanks for trying it out. One more thing. Can you confirm that you have also tried A1 without setting any P6SEL bits at all (basically, just like the code example?)

    Regards,
    Andreas

  • Thank you for your question.

     

    I tested A3 with P1SEL off and of settings. Both gives me similar results (0.6V input). On the other hand,

    when I test A0 with P6SEL off and on settings, both gives me values close to 0V.

     

    About PxSEL, I thought it should be on (e.g. PxSEL |= 0x03) for analog input as written in "msp430F(G)47x_sd16a_03.c".

    However in other code examples (msp430F(G)47x_sd16a_04-09.c), PxSEL  is not set. I wonder whether this setting

    is not necessary for analog input or not?

     

  • OKY,

    thanks for the feedback, that's exactly what I wanted to know. If everything is as described, it looks like there could indeed be an issue with the device or the documentation. I'll start an internal investigation regarding this right away.

    Regarding your specific issue, in order to move forward I would recommend one of the two following options:

    1. Use an MSP430FG479 device instead. These devices should be a drop-in replacement. I'm pretty confident that on the "FG" devices the analog inputs work as advertised, or
    2. Don't use the inputs that you identified as NG on port 6. Try to use other inputs if your system allows.

    Regarding your question with the PxSEL bits. Yes although not necessary to be able to use the pin as an analog input, it is highly recommended. This will prevent parasitic cross-currents across the digital CMOS input buffer that's connected on the same pin. In case of any doubts, the data sheets always have a section called "pin schematics" which should provide great detail on how to configure pins to certain functions.

    Regards,
    Andreas

  • Dear

     

    Thank you for your suggestion.

    I have ordered MSP430FG479 sample just before. About the option 2, I need several analog inputs

    for my application. So it is better that I can use analog inputs more than 2 (not only A3 and A4) with

    1 DAC available (multiplexed with A2 pin).

  • Dear Andreas

     

    I have tested MSP430FG479 just before. However, the situation is same. Both with F479 and FG479, the A0 and A1 analog input does not get the voltage I input. The value is just 0. On the other hand, A3 and A4 can get the voltage without problem.

     

    Then, is this problem of the evaluation board I use? I have checked the connection of A6 pins on the evalualtion board. Up to now, I do not find any strangeness in the evaluation board.

     

     

  • Hello,

    Thank you for bringing this issue to our attention. The code examples have incorrectly left out the port initialization for Port6.

    When using channels A0 and A1 - P6SEL directly influences the behavior of the SD16 channels.

    The PxSEL bits for both Ax+ and Ax- need to be set for proper operation.

    Also it is a must to externally ground the Ax- pin. I suspect this was the reason you are seeing incorrect conversion results.

    For the other channels e.g. A2-  it is not required to ground the pin externally when SD16AE.x = 0 (this is the default setting on power up).

    Hence with the negative terminal grounded internally on A2-/A3- you are able to see the correct conversion result.

    Please use the code example attached to this post.

    The example initializes A0+ and A0- as recommended in the D/s and performs a conversion on this channel.

    Note: Remember to connect pin 66 (A0-) to GND externally.

    The code example has been tested on both F479 and FG479 with a TI evaluation board and teh correct conversion results were observed.

    Note that the TI evaluation board does not have the SD16 Vref cap populated on it and requires a 100nF cap to be on pin 60 for correct operation.

    Please let us know if you are able to get this working.

    Regards,

    Priya

    F47x_test.zip
  • Thank you for your reply, Priya.

     

    I have tested with your code. For A0 test, A0- is connected to the GND. For A3 test, A3- is connected to the GND.

    The 100nF cap is connected between pin 53(AV_SS) and pin 60(V_REF). MSP430FG479 is used.

    I tested using unipolar and bipolar setting of the ADC. The voltage is input using external voltage which I can

    set any voltage.

    For each voltage input, I have confirmed the voltage between Ax+ and GND.

     

    Following is the values (in decimal format) of the variable [result] in your code, obtained from the test.

    -----------

    [A0 analog input]

       0.3V input  --  around 32801 (bipolar), between 0 and 140 (unipolar)

       0.15V input  -- around 32746 (bipolar), between 0 and 40 (unipolar)

       0V input  -- around 32713 (bipolar), between 0 and 40 (unipolar)

    [A4 analog input]

       0.3V input -- around 48700 (bipolar), around 31691 (unipolar)

       0.15V input -- around 40534 (bipolar), around 15758 (unipolar)

       0V input -- around 32474 (bipolar), around 0 (unipolar)

    -----------

    I can see the linearity for A4, but not for A0.

     

     

    I only changed

    SD16CCTL0 |= SD16SNGL+ SD16IE + SD16UNI;

    SD16CCTL0 |= SD16SNGL+ SD16IE;

    and

    SD16INCTL0 =SD16INCH_0;

    SD16INCTL0 =SD16INCH_4;

     

  • OKY,

    from your description it seems like you are doing the right things. However I wonder if there maybe is an issue with your target board (the device socket not making good contact?), so that "A0-" (pin 66) isn't properly connected to GND? Can you please double-check the continuity of the signals connected to "A0-" (pin 66) and "A0+" (pin 67)? You can toggle these pins from SW or by using the debugger. Then, connect externally a resistor from the pin to GND to provide some load (to make sure there really is a good conducting path), and measure the pin voltage. It should follow exactly whenever you set PxOUT to '1' or '0'.

    Regards,
    Andreas

  • Thank you for your suggestion, Andreas.

     

    > Then, connect externally a resistor from the pin to GND ...

        Do you mean to connect a resistor between A0- and GND?

     

     

     

  •  

    I have succeeded to get analog input of A0. The reason of the problem was my mistake to

    take GND.

     

    Followings are connections I have tested. Vext is external voltage. J5 is jumper pin 5 (having 3 connections

    of Vcc, GND, GND).

     

    [Connection 1]

      GND(pin10) ---- A0-

      Vext+ ---- A0+

      Vext- ----- GND (@ J5)

     

    [Connection 2]

      Vext+ ---- A0+

      Vext- ----- A0-

     

    [Connection 3]

      GND(@ J5) ---- A0-

      Vext+ ---- A0+

      Vext- ----- GND (@ J5)

     

    I have tested using connection 1. I thought GND (pin 10) and GND (@J5) are same.

    Connection 2 and Connection 3 both produce correct results using code from Priya.

     

    I connected A0- to GND so that I can consider single-end analog input (not differential input).

    Then, I made mistake in connecting the other line (from Vext- to GND).

     

    Thank you very much for your help.

     

     

**Attention** This is a public forum