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.

Sending date through Bluetooth using the EZ430-RF2560



I am trying to send data from a sensor to the EZ430-RF2560 and then to a Samsung tablet. I was able to establish communication between the EZ430 and the tablet and I was able to send simple strings of data to the tablet when SW2 on the EZ430 is pressed. 

I successfully sent data from the sensor to the EZ430 and then to a computer, through the UART port, but now I would like to send the sensor data to the tablet using Bluetooth. I am working with the accelerometer demo files that came with the EZ430, but I am not able to figure out where I need to make the necessary changes. Is the appl_spp.c the only file I need to worry about to get this working? As I said before, I have the working code that transmits the data from the sensor to the EZ430 and then to a laptop through the USB, but I want to make it send the data to the tablet using Bluetooth.

I have searched online for solutions, but there is very little information on the EZ430-RF2560 bluetooth aspect (except for the developers guide).

Thanks in advance for any suggestions.

  • The appl_send_spp_data() function in the appl_sdk.c reads the accelerometer data and sends it  via bluetooth. Also please note that the accelerometer sends a small amount of data. So to change the size of the data being sent change the PAYLOAD_SIZE and the checksum index. I am struggling with the frequency which it needs to send the data. If you can figure out where I can send the data at a faster rate it would be cool.

  • Please see below.

  • My appl_send_spp_data() function looks as follows:

    void appl_send_spp_data(UCHAR dev_index)
    {
        sdk_spp_data_read(appl_spp_data_buffer, sizeof(appl_spp_data_buffer)
           );

    I don't understand how this code reads the data from the accelerometer and sends it.

            

  • sdk_spp_data_read reads the data from the accelerometer. The function to is present in sdk_pl.c . The accelerometer data is being read using I2C. The data to be sent via bluetooth is being done by appl_spp_write(...) in file appl_spp.c which essentially does the same thing above. You can try by writing some fixed pattern in the appl_spp_data_buffer array to see if the data is being sent fine and commenting out sdk_spp_data_read(...).

    Are you using any external sensor? Is the UART communication being done between the sensor and MSP430?

  • Yes Gautam, the UART communication is being done between an external sensor and the MSP430.

  • You can use the same code, but I am not sure about the interrupts. You can poll the data out from your sensor and then send it. As far as I understand the appl_send_spp_data(..) is scheduled to run every few milliseconds. I am still trying to find how to increase or decrease the frequency though. If you still want to enable interrupts just set up a buffer and then simply send the data from the buffer in the appl_send_spp_data(..).

  • Gautam, I think you need to increase the throughput in your case. Look on page 172 of the developers guide. It might help you.

    I'm going to start modifying the  appl_send_spp_data and see if I can make it work.

  • Simple.

    void appl_send_spp_data(UCHAR dev_index)
    {
        /* sdk_spp_data_read(appl_spp_data_buffer, sizeof(appl_spp_data_buffer) );*/

       appl_spp_data_buffer[0]  = 'T';

       appl_spp_data_buffer[1] = 'E';

       appl_spp_data_buffer[2] = 'S';

       appl_spp_data_buffer[3] = 'T';


        appl_spp_write(dev_index, appl_spp_data_buffer, sizeof(appl_spp_data_buffer)
            );
    }

    You should be able to see "TEST" in your hyper-terminal.

  • Hi Emanuel,

     I am giving you some tips to control the appl_send_spp_data() sensor data.

    1. comment out appl_send_spp_data function call in all your ez430 workspace.

    2. use timer to read sensor data periodically(ex. timer A is configured for 180ms, so every 180ms once call sensor_read function)

    3. once read the sensor data , you could send the same data through bluetooth using  appl_send_spp_data()  function call, for that you may use same timer or some other timer or user task message posting as well.

    in appl_spp.c 

    case SPP_CONNECT_CNF and  case SPP_CONNECT_IND:->  bluetooth connection confirmation and connection indication , place where you could put a break point and see able to connect with samsung tablet.

    SPP_SEND_CNF -> data send  confirmation.

    SPP_RECVD_DATA_IND -> data received from remote device through bluetooth.

     

    Regards

     

  • Thanks for the info. Could you expand a little on your second point regarding the timer? Is there some sample code I can look at that uses the timer to read the sensor data? I'm confused on how to do this.

    Also, you said to comment out the out appl_send_spp_data function call, but isn't this what I will be using to send the data through bluetooth?

    I am trying to read data from PIN 39 on the back of the EZ430.


    Thank you.

  • Hi Srisenthilkumar,

     

    hope I could pronouce your name right:). I have read several of your post and I think you are really an expert in EZ430-rf2560. I am trying to detect a ADC signal and send that to my laptop computer. I have successfully modified the (ez430-rf2560 version of) accl code and i could let my end device sending ADC data to my PC thru the dongle (another ez430-rf2560 and the USB stick). now I wanna connect this thing directly to my PC bluetooth. I failed several times that I found a connection has been built and a COM port has been assigned to my end device on my PC, but I just cannot open them thru hyperterminal. 

     

    I realized that your post might have answered that question. from the developer's guide page 153, it said step 16 is to appl_send_spp_data(dev_index) and step 17/18 is to check a CNF signal from the peer device before sending another step 16. I think without a USB peer rf2560, I cannot give my end device a CNF so the connection is malfunctioning, hence I cannot open my COM thru hyperterminal?

     

    2 questions:

    1. if my understanding is correctly. otherwise why I can built connection bwtween PC-->USB-MSP430-rf2560--> MSP430rf2560 while not able to directly connect PC to end device? (I modified the requirement for MSP430-Demo prefix)

     

    2. you gave a tip that commenting out all appl_send_spp_data, and use the timer A ISR to send data. I tried that, but under #pragma vector=TIMER1_A0_VECTOR __interrupt void TIMER1_A0_ISR(void) function at user.task.c, appl_send_spp_data (rem_bt_dev_index) is warne since rem_bt_dev_index is used before its value is set from spp connection function or somewhere. what could I do?

     

    desperately need my ez430-rf2560 talking to my PC without any dongle thing.......

     

    Thanks in advance!

     

    Jingle