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 SPPDemo Trouble using SPP_Data_Write

Hi there,

I am trying to read data from the  accelerometer and send it over the Bluetooth connection. For this i have modified the SPPdemo sendData procedure to use the buffer where I am writing using interrupts the data from the accelerometer. this happens 100 times per second and I read and add to the buffer 3 values, x,y,z, a byte each, in a very quick interrupt service routine and store them in the buffer.

However, when the interrupts are enabled  the sending is very unstable and after a few bytes it breaks altogether .Nothing except restart  cannot recover the connection. When the interrupts from the accelerometer  are disabled everything works fine and I am able to send millions of bytes stored in the buffer.

I am wondering how the interrupts are breaking the bluetopia stack.

I noticed that I am getting ??? on the ez430 console shortly before the sending breaks. i suppose that they are coming from the implementation of  SPP_data_Write but could't find any information on this.    

I have tried with and without LPM3_EXIT but it does not make any difference so I assume it must be something else

Can anyone suggest what to do to avoid breaking the sending of data while getting interrupts and reading accelerometer data?

Thanks

Al

  

  • Alex,

    The ??? means that bytes are being lost because of UART overflow. This could be caused by an ISR handler taking too long too process. Also, The SPP_Data_Write() cannot be called in ISR context. 

    Thanks,

    Stonestreet One.

  • Hi Alex,

    I want to implement accelerometer data reading using interrupt over P1.2 port. I see you have done something like this, can you help me?

    I am working with the keyfobdemo sample (it uses accelerometer) but I don´t understand how I must implement accelerometer read using interruptions. Looking at the code I found  the function to manage P1 port interrupt and P1.2 port interruption seems enabled, isn´t it?

    I`ve also found an ISR function for P1 interruptions but can not get that to work with my modified code.

    This is the original 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. * /
              LPM3_EXIT;
              break;
           BT_UART_CTS_INT_NUM case:
              if (CtsInterrupt ())
              {
                 / * Exit LPM3 on interrupt exit (RETI). * /
                 LPM3_EXIT;
              }
              break;
        }
    }

    I´m not getting into this function never, so I think I must modify the code but I don´t know where.

    Thanks!!!

     

    juan