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.

CCS/MSP430FR2633: Capacitive touch

Part Number: MSP430FR2633
Other Parts Discussed in Thread: CAPTIVATE-FR2633,

Tool/software: Code Composer Studio

Hello,

I am using Captivate-FR2633 Evaluation board.

I would like to disable the online tuning UART in order to setup my own UART about the position of a wheel sensor.

How could i disable the online tuning UART?

Best Regards!

  • I am sorry, could you please change the thread and title?

    I am using MSP430FR2633.
  • Hi Thanos,

    I edited the posting for you.

    There are two ways to disable the UART.
    1. In the CapTIvate Design Center, open the project that represents your design. Double click on the MCU icon on the canvas to open its view. You should see an area called 'Target Communications'. Change the communications interface to NONE. Click the Generate Source code button, and select 'Update existing project' and point to the location where your CCS project is located.
    2. A simpler way is to simply modify your CAPT_UserConfig.h file, around line #61. Change the #define from __CAPT_UART_INTERFACE__ to __CAPT_NONE_INTERFACE__. Note, this change will be overwritten if in the future you make changes in the CapTIvate Design Center, then generate a project update.
  • Hi Dennis,

    Thank you very much for your information.

    You are right! This parameter disable UART.

    Could you help me to setup the UART(9600,8,N,1) via driverlib?

    Best Regards,
    Thanos

  • I was trying to setup UART using the ACLK 32768Hz  but i cant send data.

    In this code, i am trying to send a byte.

    Could you help me about this issue?

    #include <msp430.h> // Generic MSP430 Device Include
    #include "driverlib.h" // MSPWare Driver Library
    #include "captivate.h" // CapTIvate Touch Software Library
    #include "CAPT_App.h" // CapTIvate Application Code
    #include "CAPT_BSP.h" // CapTIvate EVM Board Support Package

    void main(void)
    {
    //
    // Initialize the MCU
    // BSP_configureMCU() sets up the device IO and clocking
    // The global interrupt enable is set to allow peripherals
    // to wake the MCU.
    //
    WDTCTL = WDTPW | WDTHOLD;

    BSP_configureMCU();

    EUSCI_A_UART_initParam param = {0};
    param.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_ACLK;
    param.clockPrescalar = 13;
    param.firstModReg = 0;
    param.secondModReg = 146;
    param.parity = EUSCI_A_UART_NO_PARITY;
    param.msborLsbFirst = EUSCI_A_UART_LSB_FIRST;
    param.numberofStopBits = EUSCI_A_UART_ONE_STOP_BIT;
    param.uartMode = EUSCI_A_UART_MODE;
    param.overSampling = EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION;

    EUSCI_A_UART_init(EUSCI_A0_BASE, &param);

    EUSCI_A_UART_enable(EUSCI_A0_BASE);

    __bis_SR_register(GIE);


    //
    // Start the CapTIvate application
    //
    CAPT_appStart();

    //
    // Background Loop
    //
    while(1)
    {

    EUSCI_A_UART_transmitData(EUSCI_A0_BASE,'F');
    //
    // Run the captivate application handler.
    // Set LED1 while the app handler is running,
    // and set LED2 if proximity is detected
    // on any sensor.
    //
    if(CAPT_appHandler()==true)
    LED2_ON;
    else
    LED2_OFF;

    uint16_t value1 = 0;

    if(WHL00.bSensorTouch == true)
    {

    value1 = ((tSliderSensorParams*)WHL00.pSensorParams)->SliderPosition.ui16Natural;

    if(value1 >= 50)
    {
    LED1_ON;
    }
    else
    {
    LED1_OFF;
    }

    }


    CAPT_appSleep();

    } // End background loop
    } // End main()

  • Hi Thanos,

    I jotted some notes and attached as a pdf.

    How to configure Captivate Library to use UART with host MCU.pdf

    I don't know what your desired baud rate or other system clocks frequencies so you will have to refer to the MSP430FR2xx4xx family users guide, chapter 22 (table 22-5) to determine the UART settings.

    Let me know if you need further assistance.

  • Thank you again!!

    I appreciate your notes! They are very helpful.

    One more question, in my above code there is a variable named by me , value which is stored the slider position.

    This value is 16bit how could I use to send via UART? ( Uart is 8bit standard).

    I read somewhere that I have to use unions.

    Do you have an example of doing something like this or any other suggested solution?

    Best Regards!

  • Hi Thanos,

    Very good question!

    You will need to break up the 16-bit value into (2) 8-bit values; one for the upper byte and one for the lower byte, then transmit the two bytes.
    Here are a couple of macros you can use to make it easy to understand.
    Put these two macros at the beginning of the file where they will be used to convert your 16-bit value into (2) 8-bit values.

    #define LO_BYTE(x) (x & 0xFF)
    #define HI_BYTE(x) ((x & 0xFF00) >> 8)

    Here is example how to use:

    uint16_t wheelPosition = 0;

    wheelPosition = ((tSliderSensorParams*)(pSensor->pSensorParams))->SliderPosition.ui16Natural;

    // or you could use the built-in function

    wheelPosition = MAP_CAPT_getSensorPosition(&MySlider);


    // Populate the buffer used by the UART
    TXBuffer[0] = LO_BYTE(wheelPosition);
    TXBuffer[1] = HI_BYTE(wheelPosition);

    Now make sure that the device that this data is being sent to knows to read the data LSB first, then MSB next.

  • Thank you very much Dennis!

    This solved my issue!

    Best Regards!
  • Excellent! Glad to hear.
  • Hello Dennis,

    Could you please tell me how could i enable the Detection Interrupt for my wheel sensor?

    I would like to make my device send data via UART only if the sensor is touched. ( make the device asychronous).

  • Hi Thanos,

    Sure - this is a very good question.
    I'll refer to the 'CodeSizeOptimized_OneButton' example that comes with the CapTIvate Design Center.

    In that example's main code, you will find at the bottom of the file a callback function, named 'buttonHandler', that gets called each time the sensor is scanned and updated. In that callback, the code shows how you can test if the sensor is being touched and perform a different action based on the test result.

    I copied that function here for convenience.
    You see that LED1 is turn on when the sensor is touched and turned off when the sensor is not touched.

    void buttonHandler(tSensor* pSensor)
    {
    //
    // If the button is currently being touched,
    // illuminate LED1.
    //
    if (pSensor->bSensorTouch==true)
    {
    P1OUT |= LED1;

    //
    // If a completely new touch was detected,
    // toggle the state of LED2.
    //
    if (pSensor->bSensorPrevTouch==false)
    {
    P1OUT ^= LED2;
    }
    }
    else
    {
    P1OUT &= ~LED1;
    }
    }

    To make it a little more clear as to the test being performed, I use these descriptive macros that should be helpful. Put these macros in the appropriate place so your callback can access them.

    #define FIRST_TOUCH (pSensor->bSensorTouch == true) && (pSensor->bSensorPrevTouch == false)
    #define TOUCH (pSensor->bSensorTouch == true)
    #define EXIT_TOUCH (pSensor->bSensorTouch == false) && (pSensor->bSensorPrevTouch == true)
    #define NO_TOUCH (pSensor->bSensorTouch == false) && (pSensor->bSensorPrevTouch == false)

    Let me know if that works for you.
  • How could I do that?

    Any suggestion?
  • Could you please delete the above message?

    Thank you!

**Attention** This is a public forum