• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » Low Power RF Proprietary Software & SimpliciTI Forum » SimpliciTI peer to peer (button problem)
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

SimpliciTI peer to peer (button problem)

SimpliciTI peer to peer (button problem)

This question is not answered
dait tels
Posted by dait tels
on May 06 2012 14:21 PM
Prodigy30 points

Hello,

I'm using the eZ430-Chronos watch and the EM430F6137RF900 board. I took the example code from the board and modified it. First I tried to get the acceleration data from the watch and after that sending a message to the board. This seems to work. But now I'd like to be able to recognize button presses. So if a button1 is pressed the message to be send would be modified before sending. And when the button2 is pressed I'd like to show a number on the display. The problem is when I press a button the watch freezes and I can't to anything. First I had a for-loop (for debouncing the buttonpress) in the ISR and at that point the watch stopped working after the second or third button press. When I replaced the for-loop with my wait-function the watch stopped working when I pushed the button for the Linkto-function (freeze after first press). I found something similar to my problem http://e2e.ti.com/support/low_power_rf/f/156/t/16924.aspx but looking at the code and the schematics I realized that the RF stuff does not use the port2 on my hw. So my best guess is that my ISR or the wait/delay function is really bad. I'm not that experienced in µC programming so any help/hint is welcomed.

here is the code http://pastebin.com/PEBszddd

SimpliciTI peer to peer acceleration ISR button press freeze stop working
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Jason Kriek
    Posted by Jason Kriek
    on May 10 2012 00:10 AM
    Expert3320 points

    Dait,

    Are you able to set a break point and follow the flow inside the ISR?

    Also, your other option is to poll teh GPIO pin such as:

    #define BUTTONS_IN  (P2IN)

    #define BUTTON_RDOWN_PIN   (BIT0)

     #define BUTTON_RUP_PIN   (BIT4)

     #define BUTTON_LUP_PIN   (BIT2)

     #define BUTTON_LDOWN_PIN   (BIT1)

     #define BUTTON_RDOWN_IS_PRESSED ((BUTTONS_IN & BUTTON_RDOWN_PIN) == BUTTON_RDOWN_PIN)

     #define BUTTON_RUP_IS_PRESSED ((BUTTONS_IN & BUTTON_RUP_PIN) == BUTTON_RUP_PIN)

     #define BUTTON_LDOWN_IS_PRESSED ((BUTTONS_IN & BUTTON_LDOWN_PIN) == BUTTON_LDOWN_PIN)

     #define BUTTON_LUP_IS_PRESSED ((BUTTONS_IN & BUTTON_LUP_PIN) == BUTTON_LUP_PIN)

    P2DIR &= ~BUTTON_RDOWN_PIN + BUTTON_LUP_PIN + BUTTON_LDOWN_PIN + BUTTON_RUP_PIN;

       P2OUT &= ~BUTTON_RDOWN_PIN + BUTTON_LUP_PIN + BUTTON_LDOWN_PIN + BUTTON_RUP_PIN;

       P2REN |= BUTTON_RDOWN_PIN + BUTTON_LUP_PIN + BUTTON_LDOWN_PIN + BUTTON_RUP_PIN;

     

    Then you can just do an if test on the buttons.... Do a short delay, check the button again for debounce, and make your decision there.

     

    -Jason

     

     

    ---------------------------------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers your question.
    ---------------------------------------------------------------------------------------------------------

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • dait tels
    Posted by dait tels
    on May 11 2012 05:20 AM
    Prodigy30 points

    That's a nice hint, thanks.

    ".... Do a short delay, check the button again for debounce, and make your decision there."

    Do you mean:

    #pragma vector = PORT2_VECTOR 
    __interrupt void PORT2_ISR(void)
    {
        1. call the wait function for debounce
       2. check the interrupt flags
    }

    I think I fixed one problem. I used

    if ((P2IFG & P2IE) == BIT1) 

    to check for the IR-Flag, but this only works if only one IFG is set.

    The freeze problem is still there. It seems like SimpliciTI does not like my wait function. Cause when I use a for-loop for the debouncing it seems to work.

    (using the wait function before connecting/linking to the other device it seems to work)

    Is it possible that I call the wait function and while this function waits for (TA1CCTL0 & CCIFG) I press a button and the wait function is called a second time. And because the first call of this function is still waiting I get some problems?????

    When the watch freezes and I press the "Pause-Button" (suspend) CCS stops at:

    while(!(TA1CCTL0 & CCIFG));/* Loop till compare interrupt flag is set */

    When I check the Registers (when frozen) TA1R and TA1CCR0 are both 147. But CCIFG (capture/compare interrupt flag) of TA1CCTL0 is not set ->?????

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use