Part Number: MSP-CAPT-FR2633
Tool/software: Code Composer Studio
Hi,
Before I describe my problem, I will explain how I got there. I am developing a product that requires capacitive touch. I have generated code from the captivate design center to trigger an LED on the dev board as a starter. Then I made a version to not use UART or Bulk_I2C with PC, therefore standalone turn on the onboard LED upon touching a CAPTIVATE-BSWP pad button. Also changed the clock to 16MHz. It detected touch in the while loop, perfect!
Next I added code software that drives a WS2812 based RGB LED strip. It has a timer interrupt that ticks a counter. In the continuous loop a function checks if the timer ticks are greater than or equal to a particular amount, and outputs a pattern to the LED Strip via UCA0TXBUF of UCA0SIMO in SPI mode. Next I implemented a capacitive touch to trigger the start of this application, like an on button. So in the main(), after performing the initialisation functions of the RGB LED strip and and Capacitive module, and before entering the while(1) continuous loop, I have
CAPT_appStart();
CAPT_appSleep();
While(CAPT_appHandler() != true); // wait till button is pressed to proceed.
START_TIMERA2; // vector=TIMER2_A0_VECTOR Timer 2 A2 CC0
while(1)
{
RGB_LED_Pattern(); // Output pattern to WS2812 RGB LED strip
}
On detecting a touch, it proceeds to run the LED strip pattern in the loop. My problem is, if I add capacitive sensing in the while(1) loop (see below) it will run once and halt. As a side note, I noticed timer interrupts are still running in TIMER2_A0_VECTOR ISR when I put a break point.
while(1)
{
if(CAPT_appHandler() == true) //if touch is detected
{
LED1_ON; // turn on board LED
__no_operation();
}
else LED1_OFF;
RGB_LED_Pattern(); //Output pattern to WS2812 RGB LED strip
}
What is confusing is if I take my LED routine out of the while loop and just keep the capacitive touch check, the capacitive touch responds and loops to keep checking.
I have narrowed down that something happens in CAPT_updateUI(&g_uiApp) in CAPT_appHandler() function which I call in the while(1) loop, but I am unable to solve this and couldn’t understand why I can’t run both my LED function and CAPT_appHandler() check in the continuous loop. It may be a low power mode issue that is a simple fix, which I couldn't find in the CapTIvate Design Center generated code. Anyone who could help me solve this, I appreciate it. Thank you in advance!