Other Parts Discussed in Thread: MSP430G2553, ENERGIA
I have been working with the MSP430FR2676 using the programmer and debug modules and have a design of a typical diamond pattern 8x8 mutual capacitance array. I am wanting to figure out how to get the filtered count of every sensor of this array and constantly stream that information through the UART. I have been directed towards the MSP430FR2676 backchannel UART demo that's found inside the captivate design studio. I have opened this project and loaded it onto my board and I have the terminal open in CCS hoping to see the information being sent out but have not been able to get this work. From what I have gathered this particular example is only suppose to output information when a button is pressed and only outputs that one specific buttons filtered count to the terminal (although haven't seen this working yet). I have been using this http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430Ware/3_70_00_05/exports/MSP430Ware_3_70_00_05/captivate/docs/api_guide/FR2633/html/group__CAPT__Buttons.html as a reference and I see the three functions listed under CAPT_Buttons seem to only have support for finding the dominant button that's being pressed, not allowing for me to access all the buttons filtered count? Is there any example code out there for further examples of this type of thing, or any resources that might help? From my current understanding I create my project in the Captivate Design Studio and tune my sensors then generate source code for CCS and then add the code regarding the UART communication into this and upload it to the board. I have attached some images of my current project in the captivate design studio (I have been able to successfully tune my sensor). My only experience with working with "embedded systems" was programming MSP430G2553's using Energia which I don't believe is supported for captivate devices, CCS is fairly abstract to me. These are the current resources that I have been utilizing thus far:
https://www.ti.com/lit/ug/slau445i/slau445i.pdf
Here is the example code Texas Instruments provides in the demo (the part im focused on):
//############################################################################# // //! \file Backchannel_UART_demo.c // // Group: MSP // Target Devices: MSP430FR2633 // // (C) Copyright 2018, Texas Instruments, Inc. //############################################################################# // TI Release: 1.83.00.05 // Release Date: May 15, 2020 //############################################################################# //***************************************************************************** // Includes //***************************************************************************** #include "demo.h" //***************************************************************************** // Definitions //***************************************************************************** //***************************************************************************** // Global Variables //***************************************************************************** //***************************************************************************** // Function Prototypes //***************************************************************************** //***************************************************************************** // Function Implementations //***************************************************************************** //callback function for keypad buttons void keypad_callback(tSensor* pSensor){ //trigger once when the button is touched if(((pSensor->bSensorTouch)) && (!(pSensor->bSensorPrevTouch))){ //decode the dominant button number uint8_t myButtonNumber = CAPT_getDominantButton(pSensor); uint8_t loopCounter = 0; uint8_t cycleCounter = 0; uint8_t elementCounter = 0; uint8_t myCycle; uint8_t myElement; //go through each cycle pointer, and within it each element pointer to find element that corresponds to the dominant button for(cycleCounter = 0; cycleCounter < pSensor->ui8NrOfCycles; ++cycleCounter){ for(elementCounter = 0; elementCounter < pSensor->pCycle[cycleCounter]->ui8NrOfElements; ++elementCounter){ //get the cycle and element numbers from the dominant button if(loopCounter == myButtonNumber){ myCycle = cycleCounter; myElement = elementCounter; } loopCounter++; } } //placeholder for output data, must be static to ensure that it is available & unchanged across function calls static uint8_t str[100]; //access the element's raw count //CAPT_getDominantButton() returns 0x00 for button #1, 0x01 for button #2... etc uint16_t rawCount = pSensor->pCycle[myCycle]->pElements[myElement]->pRawCount[0]; //extract the filtered count, NOTE this truncates to the nearest natural number uint16_t filteredCount = pSensor->pCycle[myCycle]->pElements[myElement]->filterCount.ui16Natural ; //get the length of the output string, insert int data into output string uint8_t str_length = sprintf((char*)str, "Button Pressed: %d\tRaw Count: %d\tFiltered Count: %d\n\r", myButtonNumber + 1, rawCount, filteredCount); //transmit data UART_transmitBuffer(str, str_length); } } //Sets all the parameters for UART transmission const tUARTPort UARTPort = { //does not receive messages, so no callback needed .pbReceiveCallback = NULL, //does not receive messages, so no callback needed .pbErrorCallback = 0, //choose clock source .peripheralParameters.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK, //clockPrescalar is UCBRx = int(N / 16), where N = clock_frequency / baud_rate //int(N / 16) = int(2000000 / 9600 / 16) = int(13.02) = 13; .peripheralParameters.clockPrescalar = SMCLK_FREQ_MHZ * 1000000 / 9600 / 16, //controls UCBRF bits for oversampling mode //UCBRF = int(((N/16) - int(N/16)) * 16) = int(((208.3333/16) - int(208.3333/16)) * 16) = int(0.3333) = 0 .peripheralParameters.firstModReg = 0, //consult table 22-4 in the user's guide to find the register value corresponding to UCBRF number //fraction portion of N = 0.3333 //in the table, 0.3333 <---> 0x49 .peripheralParameters.secondModReg = 0x49, //controls parity bit - NOTE the eZ-FET does not support a parity bit .peripheralParameters.parity = EUSCI_A_UART_NO_PARITY, //least or most significant bit first .peripheralParameters.msborLsbFirst = EUSCI_A_UART_LSB_FIRST, //select either one or two stop bits .peripheralParameters.numberofStopBits = EUSCI_A_UART_ONE_STOP_BIT, //select whether to use multiprocessor/autobaud modes .peripheralParameters.uartMode = EUSCI_A_UART_MODE, //selects oversampling vs low-freq baud rate modes .peripheralParameters.overSampling = EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION };