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 low power mode wake on prox and a GPIO

Part Number: MSP430FR2633


Hello all,

I am pretty new to MSP430FR2633 captivate design and I have generated my code from Captivate Design Center. Everything is fine on captivate side, it raises and interrupt on touch events, it wakes up from LPM with proximity but I want to add a GPIO input to the code which also should wake the device up same as touch buttons do and generate an interrupt on the same IRQ pin with the touch buttons. Can anybody send me some example code and where to add it? This GPIO (P1.6) should wake the device up when it transitions from HIGH to LOW and raise and interrupt like touch events to the host controller on IRQ pin (P1.1). After that host will try to read the MSP430FR2633 because it thinks there is a touch event but the MSP will return no touch flags. that is OK so far.

Thank you in advance,

With kind regards

  • Hi 

    I didn't fully understand your question. What does P1.6 generate IRQ on P1.1 mean?

  • Hi,

    P1.6 is a GPIO input with interrupt capability and while the MSP430FR2633 is in LPM, if there is a transition from HIGH to LOW on P1.6, the device should wake up and raise an interrupt output on P1.1(I2C request signal). I am using this P1.1 to raise an interrupt to the host controller on touch events. So, the external GPIO P1.6 input also should wake the device and generate and interrupt (I2C REQ) on P1.1

    Normally, the device wakes on proximity and if there is a touch, it raises an interrupt (I2C REQ) on P1.1. 

    I hope this makes it clear. 

    Thanks, for your quick reply.

    Best regards 

  • Hi Ahmet,

    It is clear now. Is there any problems in your project? You could refer to the example code.

    dev.ti.com/.../node

  • Hi Allen,

    I implemented this part but I have another question now. I also implemented an edit on I2C communication and added a new command to change the threshold levels on run-time. But i want to check if the conversion is ended and it is a suitable time to update the threshold levels of the buttons. Can I check the g_bDetectionFlag and if it is true, then does that mean there is no conversion and i can update the touch threshold levels?

    Best regards

  • Hi Allen,

    In CAPT_Interface.c file I have added these line into the CAPT_I2CRegisterReceiveHandler method. 

    else if (g_ui8I2CDataBuffer[TL_PCKT_CMD_FIELD] == 0x20)
    {
    //uint8_t i=0,k=0;
    uint8_t id = 0;
    uint8_t threshold = 10;
    id = g_ui8I2CDataBuffer[TL_PCKT_CMD_FIELD+2];
    threshold = g_ui8I2CDataBuffer[TL_PCKT_CMD_FIELD+3];

    // Treat this as a custom CMD to get raw data
    //g_bConvTimerFlag
    //if( g_bConvTimerFlag==false)
    if( (g_bEndOfConversionFlag==true) && (threshold > 5))
    {
    MAP_CAPT_stopTimer();
    MAP_CAPT_clearTimer();
    switch (id)
    {
    case 0:
    pSensor->pCycle[1]->pElements[0]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 1:
    pSensor->pCycle[3]->pElements[0]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 2:
    pSensor->pCycle[3]->pElements[1]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 3:
    pSensor->pCycle[2]->pElements[0]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 4:
    pSensor->pCycle[0]->pElements[0]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 5:
    pSensor->pCycle[3]->pElements[2]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 6:
    pSensor->pCycle[2]->pElements[1]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 7:
    pSensor->pCycle[2]->pElements[2]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 8:
    pSensor->pCycle[1]->pElements[1]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 9:
    pSensor->pCycle[3]->pElements[3]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 10:
    pSensor->pCycle[1]->pElements[2]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 11:
    pSensor->pCycle[2]->pElements[3]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 12:
    pSensor->pCycle[0]->pElements[1]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 13:
    pSensor->pCycle[0]->pElements[2]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    case 14:
    pSensor->pCycle[0]->pElements[3]->ui8TouchThreshold = threshold;
    // __delay_cycles(8000);
    break;
    // case 15:
    // pSensor->ui16ConversionCount=threshold;
    // break;
    // case 16:
    // pSensor->ui16ConversionGain=threshold;
    // break;
    // case 17:
    // pSensor->ui16ProxThreshold=threshold;
    // break;
    default:
    break;
    }
    g_ui8I2CDataBuffer[TL_PCKT_CMD_FIELD+2]=0xAA; //success
    //CAPT_calibrateUI(&g_uiApp);
    MAP_CAPT_startTimer();
    }

    else
    {
    g_ui8I2CDataBuffer[TL_PCKT_CMD_FIELD+2]=0xFF; //fail
    // MAP_CAPT_stopTimer();
    // MAP_CAPT_clearTimer();
    // CAPT_calibrateUI(&g_uiApp);
    // MAP_CAPT_startTimer();
    }

    }

    this is my code and I am returning a FAIL or SUCCESS message to the host. I used some of the tickets in the forum. I am sending 4 bytes of data from the host to the MSP430FR2633 which includes 1st byte is command, 2nd byte is sensor id, 3rd byte is element id and 4th byte is threshold level. I commented out CAPT_calibrateUI(&g_uiApp) function because it creates some problem, the MSP430 does not work after this command. 

    Can you check if there is a problem with this code and something to fix. 

    With kind regards

  • Hi 

    What problem cause MSP doesn't work? Can you descript it more detailly. The conversion will not influence setting the threshold. You can have a try to change the threshold when you need instead of waiting for conversion end.

  • Hi Allen,

    I am normally checking the endofconversion flag and if it is set, I am updating the parameters. If I uncomment the CAPT_calibrateUI part, the endofconversion flag is never set, and also i don't get a touch interrupt anymore. I don't know why but it looks like timer is not starting again, maybe it is because i didn't reload the timer.

    Best regards,

  • Hi 

    This may be because you commented out the MAP_CAPT_startTimer().  

    You can refer to these two guide.

**Attention** This is a public forum