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.

MSP430f5338: RTC Supercap Charging Discharging issue

Part Number: MSP430F5338
Other Parts Discussed in Thread: MSP430F6638

Hi,

We are trying to use Supercap as a backup for RTC at VBAT pin. In MSP430F5338, A12 channel (in ADC) is specifically allocated for Monitoring the supercap voltage. What is the voltage source for ADC (A12) while working for VBAT Measurement and what registers need to configure to use A12 channel for battery measurement? (We enabled VBAT Measurement reg in BAKCTL register)

Without connecting Supercap to A12 Externally, Supercap charging not happening. 

  • Hello,

    The following E2E post should help you out. Just like the MSP430F6638, the MSP430F5338 has the VBAT measurement at ADC12 channel 12. The voltage source for the ADC is AVCC, which in most applications is tied to DVCC. The connection to ADC12, Channel 12 will not charge the supercap, only measure its voltage level at ~1/3 the voltage.

    e2e.ti.com/.../863845
  • Hi JH,

    Thanks for the response. Do we need to set any register for connecting AVCC to A12 or BAKADC setting alone is enough?

    Also we are facing issue like rtc_b module working only under VCC supply. Cannot switch to VBAT in automatic switching mode. We are configuring BBS registers properly. Any other registers do we need to consider? Also pls suggest SVSH settings for this if needed. We are using 3.3V VCC and Super Cap can charge up to 3.3V

  • Hello,

    I will have to look into this as I do not currently see a good example of doing this.
  • Hello,

    Here is some example code to configure the ADC to measure VBAT.

    //                MSP430F5338
    //             -----------------
    //         /|\|                 |
    //          | |                 | Supercap
    //          --|RST         Vbat |---||---+
    //            |                 |        |
    //            |                 |        V
    //
    //   Built with Code Composer Studio V7.3
    //******************************************************************************
    #include <msp430.h>
    
    #define VRP     3.3
    #define VRN     0
    
    int main(void)
    {
      WDTCTL = WDTPW | WDTHOLD;             // Stop watchdog timer
    
      BAKCTL = BAKADC;                      // Vbat ADC measurement enabled
    
      ADC12CTL0 = ADC12SHT12 | ADC12ON;     // Sample-and-hold time of 16 ADC12CLK cycles
                                            // Trigger by ADC12SC
                                            // Turn on ADC12
    
      ADC12CTL1 = ADC12SHP;                 // Use sampling timer
    
      // Initialize input channel A12 conversion to ADC12MEM0
      ADC12MCTL0 = ADC12INCH_12;            // Vr+=AVcc and Vr-=AVss
                                            // Input Channel A12
    
      ADC12IE = ADC12IE0;                   // Enable interrupt for ADC12MEM0
      ADC12CTL0 |= ADC12ENC;                // Enable conversions
    
      while (1)
      {
        ADC12CTL0 |= ADC12SC;               // Start conversion
    
        __bis_SR_register(LPM0_bits + GIE); // LPM0, ADC12_ISR will force exit
        __no_operation();                   // For debugger
      }
    }
    
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector = ADC12_VECTOR
    __interrupt void ADC12_ISR(void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(ADC12_VECTOR))) ADC12_ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
      volatile float vbat;
    
      switch(__even_in_range(ADC12IV,36))
      {
      case  0: break;                           // Vector  0:  No interrupt
      case  2: break;                           // Vector  2:  ADC overflow
      case  4: break;                           // Vector  4:  ADC timing overflow
      case  6:                                  // Vector  6:  ADC12IFG0
        vbat = 3*ADC12MEM0*(VRP - VRN)/4095 + VRN;
        __bic_SR_register_on_exit(LPM0_bits);   // Exit active CPU
        break;
      case  8: break;                           // Vector  8:  ADC12IFG1
      case 10: break;                           // Vector 10:  ADC12IFG2
      case 12: break;                           // Vector 12:  ADC12IFG3
      case 14: break;                           // Vector 14:  ADC12IFG4
      case 16: break;                           // Vector 16:  ADC12IFG5
      case 18: break;                           // Vector 18:  ADC12IFG6
      case 20: break;                           // Vector 20:  ADC12IFG7
      case 22: break;                           // Vector 22:  ADC12IFG8
      case 24: break;                           // Vector 24:  ADC12IFG9
      case 26: break;                           // Vector 26:  ADC12IFG10
      case 28: break;                           // Vector 28:  ADC12IFG11
      case 30: break;                           // Vector 30:  ADC12IFG12
      case 32: break;                           // Vector 32:  ADC12IFG13
      case 34: break;                           // Vector 34:  ADC12IFG14
      case 36: break;                           // Vector 34:  ADC12IFG15
      default: break;
      }
    }

    Have you had a chance to look at the application report describing how to use the RTC_B module with battery backup supply? It can be found here. It recommends to use driver lib to set the device Vcore level which will also set the proper SVSH value. The document also has example code for using the RTC_B module.

    Regards, 

    Ryan

**Attention** This is a public forum