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.

MSP430FR2633: CapTivate 64 button touch

Part Number: MSP430FR2633
Other Parts Discussed in Thread: TIDM-CAPTIVATE-64-BUTTON

Hello Everyone,

                I am new to this MSP430FR2633 controller to touch 64 capacitve touch button. I got the source code from ti sites and its flashed successfuly and basic code runs successfully while i touch on the 64 button any one the led1 will be blink if i multi touch an board both led 1 and led 2 are blink now i want that touch sense data in UART. Wright now i get the UART value but it not related on touch sense it may be a garbage value on it i need a touch output in UART (with BuadRate) please any one give me a solution for this issues ASAP

  • Hi Vivek,

    I think the UART code example may help you.

    msp430fr243x_euscia0_uart_01.c
    /* --COPYRIGHT--,BSD_EX
     * Copyright (c) 2014, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     *******************************************************************************
     * 
     *                       MSP430 CODE EXAMPLE DISCLAIMER
     *
     * MSP430 code examples are self-contained low-level programs that typically
     * demonstrate a single peripheral function or device feature in a highly
     * concise manner. For this the code may rely on the device's power-on default
     * register values and settings such as the clock configuration and care must
     * be taken when combining code from several examples to avoid potential side
     * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
     * for an API functional library-approach to peripheral configuration.
     *
     * --/COPYRIGHT--*/
    //******************************************************************************
    //   MSP430FR243x Demo - eUSCI_A0 UART echo at 9600 baud using BRCLK = 8MHz
    //
    //  Description: This demo echoes back characters received via a PC serial port.
    //  SMCLK/ DCO is used as a clock source and the device is put in LPM3
    //  The auto-clock enable feature is used by the eUSCI and SMCLK is turned off
    //  when the UART is idle and turned on when a receive edge is detected.
    //  Note that level shifter hardware is needed to shift between RS232 and MSP
    //  voltage levels.
    //
    //  The example code shows proper initialization of registers
    //  and interrupts to receive and transmit data.
    //  To test code in LPM3, disconnect the debugger.
    //
    //  ACLK = REFO = 32768Hz, MCLK = DCODIV = SMCLK = 8MHz.
    //
    //                MSP430FR2433
    //             -----------------
    //         /|\|                 |
    //          | |                 |
    //          --|RST              |
    //            |                 |
    //            |                 |
    //            |     P1.4/UCA0TXD|----> PC (echo)
    //            |     P1.5/UCA0RXD|<---- PC
    //            |                 |
    //
    //   Darren Lu
    //   Texas Instruments Inc.
    //   June 2014
    //   Built with IAR Embedded Workbench v6.20 & Code Composer Studio v6.0.1
    //******************************************************************************
    
    #include <msp430.h>
    
    void Init_GPIO();
    
    int main(void)
    {
      WDTCTL = WDTPW | WDTHOLD;                // Stop watchdog timer
    
      // Configure GPIO
      Init_GPIO();
      PM5CTL0 &= ~LOCKLPM5;                    // Disable the GPIO power-on default high-impedance mode
                                               // to activate 1previously configured port settings
    
      __bis_SR_register(SCG0);                 // disable FLL
      CSCTL3 |= SELREF__REFOCLK;               // Set REFO as FLL reference source
      CSCTL0 = 0;                              // clear DCO and MOD registers
      CSCTL1 &= ~(DCORSEL_7);                  // Clear DCO frequency select bits first
      CSCTL1 |= DCORSEL_3;                     // Set DCO = 8MHz
      CSCTL2 = FLLD_0 + 243;                   // DCODIV = 8MHz
      __delay_cycles(3);
      __bic_SR_register(SCG0);                 // enable FLL
      while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)); // Poll until FLL is locked
    
      CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; // set default REFO(~32768Hz) as ACLK source, ACLK = 32768Hz
                                               // default DCODIV as MCLK and SMCLK source
    
      // Configure UART pins
      P1SEL0 |= BIT4 | BIT5;                    // set 2-UART pin as second function
    
      // Configure UART
      UCA0CTLW0 |= UCSWRST;
      UCA0CTLW0 |= UCSSEL__SMCLK;
      
      // Baud Rate calculation
      // 8000000/(16*9600) = 52.083
      // Fractional portion = 0.083
      // User's Guide Table 14-4: UCBRSx = 0x49
      // UCBRFx = int ( (52.083-52)*16) = 1
      UCA0BR0 = 52;                             // 8000000/16/9600
      UCA0BR1 = 0x00;
      UCA0MCTLW = 0x4900 | UCOS16 | UCBRF_1;
    
      UCA0CTLW0 &= ~UCSWRST;                    // Initialize eUSCI
      UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt
    
      __bis_SR_register(LPM3_bits|GIE);         // Enter LPM3, interrupts enabled
      __no_operation();                         // For debugger
    }
    
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=USCI_A0_VECTOR
    __interrupt void USCI_A0_ISR(void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
      switch(__even_in_range(UCA0IV,USCI_UART_UCTXCPTIFG))
      {
        case USCI_NONE: break;
        case USCI_UART_UCRXIFG:
          while(!(UCA0IFG&UCTXIFG));
          UCA0TXBUF = UCA0RXBUF;
          __no_operation();
          break;
        case USCI_UART_UCTXIFG: break;
        case USCI_UART_UCSTTIFG: break;
        case USCI_UART_UCTXCPTIFG: break;
        default: break;
      }
    }
    
    void Init_GPIO()
    {
        P1DIR = 0xFF; P2DIR = 0xFF; P3DIR = 0xFF;
        P1REN = 0xFF; P2REN = 0xFF; P3REN = 0xFF;
        P1OUT = 0x00; P2OUT = 0x00; P3OUT = 0x00;
    }

    Best regards,

    Cash Hao

  • Hi Cash Hao,

       Thanks for your reply,

        Acutally I have get the serial output (UART) separately but its not work on the 64 button captivate touch sense it may be any clock issues are there.

    The below code is UART code and its working fine.

    #include <msp430.h>

    #define RXD BIT5 //Check your launchpad rev to make sure this is the case. Set jumpers to hardware uart.
    #define TXD BIT4 // TXD with respect to what your sending to the computer. Sent data will appear on this line


    void UART_TX(char * tx_data); // Function Prototype for TX

    void main(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // Stop Watch dog timer

    // BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1 MHz
    // DCOCTL = CALDCO_1MHZ;

    P1SEL0 = RXD + TXD ; // Select TX and RX functionality for P1.1 & P1.2
    // P1SEL0 = RXD + TXD ; //

    UCA0CTL1 |= UCSSEL_2; // Have USCI use System Master Clock: AKA core clk 1MHz

    UCA0BR0 = 104; // 1MHz 9600, see user manual
    UCA0BR1 = 0; //

    UCA0MCTLW = UCBRS0; // Modulation UCBRSx = 1
    UCA0CTL1 &= ~UCSWRST; // Start USCI state machine

    while(1) // While 1 is equal to 1 (forever)
    {
    // if(!((P1IN & BUTTON)==BUTTON)) // Was button pressed?
    {
    UART_TX("VIVEK! \r\n"); // If yes, Transmit message & drink beer
    __delay_cycles(100000); //Debounce button so signal is not sent multiple times
    }
    }

    }

    void UART_TX(char * tx_data) // Define a function which accepts a character pointer to an array
    {
    unsigned int i=0;
    while(tx_data[i]) // Increment through array, look for null pointer (0) at end of string
    {
    while ((UCA0STATW & UCBUSY)); // Wait if line TX/RX module is busy with data
    UCA0TXBUF = tx_data[i]; // Send out element i of tx_data array on UART bus
    i++; // Increment variable for array address
    }
    }

    but 64 touch button source i didn't get proper UART output so i am struggle on that source only  TIDM-CAPTIVATE-64-BUTTON Software  

     

  • Hello,

    Is there any update about the above question?

    with Regards,
    Vivek
  • Hi Vivek,
    Since you can run the stand alone UART code correctly. I suppose it is something wrong on your code. You can start with checking the clock source of UART setting.

    Best regards,
    Cash Hao
  • Hi Cash,
    I am using TIDM-CAPTIVATE-64-BUTTON Software -> Basic Demo code that i get from the Ti sites there have a UART Interface but I'm not getting proper data from uart. Even without touch of keypad (CAPTIVATE-64-BUTTON) it continuously sends data but it not belong of the touch sense data. So please support for this issues.
  • Hello,

    Is there any update about the above question?

    with Regards,
    Vivek
  • Hi Vivek,

    Could you send me your code with this issue?

    Best regards,

    Cash Hao

  • please send me you mail id Cash Hao
  • Hi Vivek,

    I couldn't find your email address. Could you please send the code to cash-hao@ti.com. Thanks!

    Best regards,

    Cash Hao

**Attention** This is a public forum