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.

eZ430-RF256x read accelerometer with interrupts

Hello,

I´ve just bought eZ430-RF256x Bluetooth evaluation tool. I have no experience with bluetooth, I´m using keyfobdemo example but I need to use interrupts to read data from the accelerometer and I don´t know how.

Can anyone help me? Thanks!!!

Juan

  • Hi,

    thanks for tour attention. I have already installed drivers and downloaded sample code.

    I need to generate an interruption when accelerometer has new data available in order to store the data and execute an algorithm over it. I also need implement a periodic Bluetooth comunication with an android phone.

    I am working with the keyfobdemo sample (it uses accelerometer) but I don´t understand how I must implement accelerometer read using interruptions.

    I have no experiencie either in Bluetooth or TI microcontrolers so it´s being difficult starting.

    Thanks!!

    Juan


    I´m new in Bluetooth

  • Hi,

    Please have a look at the KeyFob Demo code.

    also see http://processors.wiki.ti.com/index.php/CC256x_MSP430_Bluetopia_Basic_KeyFobDemo_APP

    Please see the documentation folder as part of the SDK release, for API details. and for having better understanding on the profile refer to Bluetooth specification.

  • Hi,
     
    thanks!!

    I reviewed the examples and I'm working with code. I want the micro attends interruption generated in the P1.2 port by the accelerometer when it has new data.
    Looking at the code I found  the function to manage P1 port interrupt and everything seems to be configured to handle accelerometer interruption but can not get that to work with my modified code.

    #pragma vector = BT_UART_CTS_IV
    __interrupt CTS_ISR void (void)
    {
        switch (BT_UART_CTS_IVR)
        {
           P1IV_P1IFG2 case:
              / * This is the interrupt pin on the accelerometer so just ez430 * /
              / * Exit If This interrupt LPM3 OCCURS. * /
              LPM3_EXIT;
              break;
           BT_UART_CTS_INT_NUM case:
              if (CtsInterrupt ())
              {
                 / * Exit LPM3 on interrupt exit (RETI). * /
                 LPM3_EXIT;
              }
              break;
        }
    }
     
    It seems that P1.2 port interruption is enable, isn't it?
  • Hi,

    Is the code you have pasted is building?

    #pragma vector = BT_UART_CTS_IV 
    __interrupt CTS_ISR void (void) 
    {
        switch (BT_UART_CTS_IVR) 
        {
           P1IV_P1IFG2 case
              / * This is the interrupt pin on the accelerometer so just ez430 * / 
              / * Exit If This interrupt LPM3 OCCURS. * / 
              LPM3_EXIT; 
              break; 
           BT_UART_CTS_INT_NUM case
              if (CtsInterrupt ()) 
              {
                 / * Exit LPM3 on interrupt exit (RETI). * / 
                 LPM3_EXIT; 
              } 
              break; 
        } 
    }

  • Hi,

    I added a variable for moitoring if I go into this function:

    #pragma vector = BT_UART_CTS_IV 
    __interrupt CTS_ISR void (void) 
    {
        switch (BT_UART_CTS_IVR) 
        {
           P1IV_P1IFG2 case
              / * This is the interrupt pin on the accelerometer so just ez430 * / 
              / * Exit If This interrupt LPM3 OCCURS. * / 

              aux1=1;
              LPM3_EXIT; 

              aux2=2;
              break; 
           BT_UART_CTS_INT_NUM case
              if (CtsInterrupt ()) 
              {
                 / * Exit LPM3 on interrupt exit (RETI). * / 
                 LPM3_EXIT; 
              } 
              break; 
        } 
    }

    This code builds and I stablish a connection with a Smartphone sending this two variables but I have confirmed that these variables (aux1 aux2) don`t change to the assigned valors. So I understand that I don´t got to this ISR.

    To initialize the interruption I have kept the original code, it seems to be right but I still don`t get  into the routine.

    Should I change some of the original code to handle the interruption?
  • Hi,

    Yes. I think If only CTS Pin is Interrupt, you will see this function beeing called. Like entering sleep and exit sleep  (wake up).

    Since none of the sample codes enter into any sleep mode it was not necessary to do anything manual with RTS/CTS because the CPU (host processor ) is never put in a low power state and thus can always receive UART data.

    If you are actually putting the processor into a lower power state you will need to change HCITRANS to manage RTS/CTS when entering a low power mode.  They will probably need to configure RTS/CTS as GPIOs temporarily, rather than being controlled by the UART, during this period.

  • Hi,

    Thanks for your help, Sundeep.

    I´m not actually putting the processor into a lower power state. I need to generate an interruption (in active mode) when accelerometer has new data available in order to store the data and execute an algorithm over it.

    Looking at the code I found  the function to manage P1 port interrupt and I thinked that everything is configured to handle accelerometer interruption. After several test and read your last post I think that P1.2 port interrupt is not triggering in active mode. How can I fix this?

    Thanks,


    Juan