Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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-Chronos Simple Acceleration reading sequence from serial port

Hi all,

I monitored the communication between eZ430-Chronos and Control Center Software (CC) and found some information about the protocol.

Firstly CC opens the port corresponding to "TI CC1111 Low-Power RF to USB CDC Serial Port" using the settings 115200,1,N,8. I think CC firstly search for COM ports matching some criteria and opens it.

After that it continuously send ping requests in the background even when he reads any acc data in order to know that AP is working and not disconnected.

When you push the button "Start Access Point" it sends a request to let AP know that. After that it begins polling the AP for valid acc data.

While we are waiting for TI to release some documentation or source code it may be useful for impatient guys.

 

Packet format:

PC-to-Ap: 2 byte command + 1 byte packet length + n byte packet load

AP-to-PC: 2 byte command + 1 byte packet length + n byte packet load

Some commands:

Background polling
----------------------------------------------------------------------
PC to AP : ff 20 07 00 00 00 00
Response : ff 06 07 xx xx xx xx
xx xx xx xx: 4 byte watch address

Start Access Point:
----------------------------------------------------------------------
PC to AP :  ff 07 03
Response: ff 06 03

Command before each Request Acc. data (functionality not known):
----------------------------------------------------------------------
PC to AP: ff 00 04 00
Response : ff 06 04 03
It may be returning the state of the watch or AP

Request Acc. data:
----------------------------------------------------------------------
PC to AP: ff 08 07 00 00 00 00
Response: ff 06 07 tt xx yy zz
tt: data type (ff: no data, 01: valid acc data)
xx, yy, zz : acc data

Acc Reading sequence:

1. Open the port using the settings 115200,1,N,8.

2. Send background ping requests (Optional)
packet : ff 20 07 00 00 00 00

3. Send "Start Access Point" command
packet: ff 07 03

4. Send the acc data request command
packet : ff 08 07 00 00 00 00

5. if you want to get new acc data go to step 4

 

 

  • I found another command:

    Stop Access Point
    ----------------------------------------------------------------------
    PC to AP :
    ff 09 03

     

    I found it after I wrote my code though. Oh well.

  • Actually, before the turn off access point can be issued, the same "command" that turns the access point on:

    ff 07 03

    must be issued.

     

    So to turn the access point off you would send:

    ff 07 03 ff 09 03

    to the access point from the PC.

  • Hi Guys,

    Thank you so much for the information. I'm trying to communicate with the watch following your communication protocol to read ACC data  but no result. I wrote a toy Matlab code but no way, maybe it's because the tx rate 115200 is so high..

    This is the code, any help will be very welcome..


    clear all, clc

    pingrequest_CMD = 'ff200700000000';
    startAP_CMD =  'ff0703';
    getACCdata_CMD = 'ff080700000000';
    stopAP_CMD =  'ff0703ff0903';
    n_samples = 5000;
    data =zeros(n_samples,3);

    instrfind
    s = serial('COM16','BaudRate',115200,'DataBits',8);

    fopen(s);
    fwrite(s, pingrequest_CMD);
    pause(0.2);
    fwrite(s, startAP_CMD);
    pause(0.2);
    fwrite(s, getACCdata_CMD);
       
    try
        for i=1:n_samples
            frame = fread(s,8);
           
            if frame(4) == 01
                data(i,1)=frame(3);     %Acc_x
                data(i,2)=frame(2);     %Acc_y   
                data(i,3)=frame(1);     %Acc_z
            else
                error('Parsing frame');
            end
        end
                      
    catch
        fclose(s);     
        delete(s);     
        rethrow(lasterror);
    end

    fwrite(s, stopAP_CMD);
    fclose(s);


    Thanks in advance,

    Jesus Mora

  • Hi, do you get any response from the serial port at all, for example a valid response from the 'access point' command?

    Andy

  • Hi Andy,

     

    No men, I don't receive anything, the timeout expires always before at all. For sure I'm not doing the things well....

     

    I would like TI publish  at least the communication protocol.

     Thanks in advance,

    Jesus Mora

  • Hi Jesus,

     

    I'm not very familiar with MATLAB, but it seems like you aren't sending the data to the serial port as a bytestring. If you can somehow convert the data into a bytestring your code will (probably) work.

     

    Thanks,

     

    Sean

  • Hi uguryildiz,

    That was nice post I managed to get the data bytes for three axes. Thank you.

    But I still wonder -the data I get is byte data max FF whereas the data displayed by control center is +/-1000. Perhaps it is G*100 representation. How do I get to convert the data to G values - any ideas?

  • Hi Ganesh,

    I was just wondering, the data you're capturing is actually the acceleration data or the tilt data? Please let me know.

    Thanks!

    Venkatesh.

  • Good question - I am right now only capturing the tilt values.

    If these values are FF at max already then how to obtain acceleration data. Usually there are extrapolation methods using the calibration values which gives the G values. I wish TI gives away the codes to read the data from watch.

    Has anybody tried codes to obtain other data from the watch such as the altitude and time? The data center is still a mystery, probably the code for data center shoud've been included for practical applications.

    Regards

     

  • Ganesh,

    I have one other question...Can we connect two Chronos to the same computer and still get the Tilt data..If so please let me know.

    Thanks,

    Luke.

  • Hi Venk,

    Yes, one can connect two chronos to the same computer and get the Tilt Data. Just that each chronos will need to be sync'd to the CC1111 receivers appropriately.

    Good Luck.

    Ganesh

     

  • Ganesh,

    Can you explain more about that Please!

    Thanks!

  • Ganesh,

    One other thing, I believe you have a code for capturing Telt data...So, at this point, the program imports data into CSV file automatically when we start running it..Is it also possible to import that data into XML file along with CSV file at the same time? If so how can we do it?

    Also, I am just wondering how can we Sync'd  each chronos  to the CC1111 receivers..Can you please explain the process?


    Thank you so much for all your help Ganesh!
    Luke.

  • Venkatesh/Luke,

    When you are connecting more that one Chronos, you need to take care of sequence of starting which might be important especially if you are dealing with tilt.

    Let us say you have two chronos A & B are connected to convey data from Joe and Harry respectively. If you start access point on A and then Harry turns on his chronos you have Harry's data on A which is mis-match. You need to take care that way.

    Ganesh

  • Luke,

    I am capturing data on screen only, I am not writing it to any file as of now.

    But I wonder why would you want both CSV as well as XML file simultaneously? Of course you could write the data into both csv and xml. I do not know what is your interface program to go any further. But perhaps you can have two streams of data to both the files and write in the respective formats and close the streams on exit.

    Synchronization is to turn on access point and chronos one after the other matching so that we know we the source of data is what we believe it to be - as in the earlier post. You turn on AP for A then Joe then AP for B then Harry.

    I hope this is useful.

    Ganesh

  • Hi Ganesh,

    I am also trying to extract ACC data from  the USB Access point without using the TI CC application. I opened a serial connection, but the read to the Access point fails(in fact it times out). Can you tell me  the setting you used for the serial connection.

    Regards

    Jerry

     

  •  

    Hi Jesus,

    I was able to get the accel readings using ur code with slight modification. here is the code.

     

    function read_acc(port)

    pingrequest_CMD = 'ff200700000000';
    int_arr = [255 32 7 0 0 0 0];
    ping_CMD = char(int_arr);

    startAP_CMD =  'ff0703';
    int_arr = [255 7 3];
    start_CMD = char(int_arr);

    checkAP_CMD =  'ff000400';
    int_arr = [255 0 4 0];
    check_CMD = char(int_arr);

    getACCdata_CMD = 'ff080700000000';
    int_arr = [255 8 7 0 0 0 0];
    get_CMD = char(int_arr);

    stopAP_CMD =  'ff0703ff0903';
    %int_arr = [255 7 3 255 9 3];
    int_arr = [255 9 3];
    stop_CMD = char(int_arr);

    s = serial(port, 'BaudRate',115200,'DataBits',8, 'StopBits', 1);

    try
    fopen(s);
    fwrite(s,start_CMD);
    frame = fread(s,3, 'uchar');
    disp(frame);

    for i=1:5000
       
        fwrite(s, check_CMD);
        frame = fread(s,4,'uchar');
       
        fwrite(s, get_CMD);
        frame = fread(s,7,'uchar');
       
        if frame(4) == 1
                D = sprintf('%i %i %i \n', frame(5), frame(6), frame(7));  
                disp(D);
        else
            %disp('No data');
        end

    end

    disp('Stopping AP');
    fwrite(s, stop_CMD);
    disp(frame);
    fclose(s);
    delete(s);
    clear s;

    catch
        fclose(s);    
        delete(s);    
        clear s;
        rethrow(lasterror);
    end


    end

    The stop command is not yet working properly. 

    Here is the serial port trace when CC Application is issuing stop command to AP.

    [19/02/2010 15:02:45]
    11469  IRP_MJ_WRITE - Request transfers data from a client to a COM port
       STATUS_SUCCESS
          ff 31 16 07 00 00 00 00 00 00 00 00 00 00 00 00     ÿ1..............
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00     ................
    ----------------------------------------------------------------------------------
    [19/02/2010 15:02:45]
    11471  IRP_MJ_READ - Transfers data from a COM port to a client
       STATUS_SUCCESS
          ff 06 16                                            ÿ..
    ----------------------------------------------------------------------------------
    [19/02/2010 15:02:45]
    11473  IRP_MJ_DEVICE_CONTROL - Request operates a serial port
       STATUS_SUCCESS
             IOCTL_SERIAL_PURGE - Request cancels the specified requests and deletes data from the specified buffers
                Flags - 15
    ----------------------------------------------------------------------------------
    [19/02/2010 15:02:45]
    11475  IRP_MJ_WRITE - Request transfers data from a client to a COM port
       STATUS_SUCCESS
          ff 09 03                                            ÿ..
    ----------------------------------------------------------------------------------
    [19/02/2010 15:02:45]
    11477  IRP_MJ_READ - Transfers data from a COM port to a client
       STATUS_SUCCESS
          ff 06 03                                            ÿ..
    ----------------------------------------------------------------------------------
    [19/02/2010 15:02:46]

     

    Also as Ganesh mentioned,  the x,y,z acceleration readings got prom AP are one byte values. But the TI CC App gives 2 byte readings. There might be some conversions involved.

    Regards

    Jerry Mannil

     

     

     

     

     

  • Ganesh, 

    I connected two Access Points to one computer and tried to get Tilt data from two Chronos, but I wasn't able to do that..I could only get from one Chronos, I'm actually using Python program to get the Tilt, Please Ganesh can you help me with you Bro?

     

    Thanks,

    Venk

  • Hi Venk,

    If you have connected the two access points you would get two ports for accessing the data from two chronos. You need to open both the ports and then you can read data from both chronos. The algorithm should be like:

    Open port P1
    Open port P2
    Start AP1
    Turn on Chronos1
    Start AP2
    Turn on Chronos2
    .
    .
    .
    Stop AP1
    Stop Ap2
    Close Port1
    Close Port2
    .
    .
    .
    Timer/Event Procedure
        Read data from P1
        Read data from P2
        Process P1 & P2 data such as display or write to file
    End Procedure

    I am scheduled on a project with two chronos but for now, I am on my first phase where I am focusing on the application software with one Chronos.

    Warm regards,

    Ganesh N

  • Hi Jerry,

    The port setting is as follows:

    Data Bits = 8
    Stop Bits = 1
    Baud Rate = 115200
    Read Timeout = 3000 //3 Seconds
    Write Timeout = 3000

    Check your timeout setting if it is about 1sec it is bound to timeout mostly. For my project this setting suits well.

    Warm regards,

    Ganesh N

  • Hi All,

    Firstly, thanks for putting together the list of commands.

    Like most of the guys in this thread, I am trying to read the acceleration data from the watch into my program.

    My problem is that I am not seeing the exact byte responses you guys mention. What I am getting from the AP is an echo. Every command I issue is being echoed back.

    I have tried various baud rates. As soon as I switch to the CC app, I can see the graph on the CC window. So I know the problem is most likely in my program.

    Am I missing a setting or something?

    Thanks in advance

  • Has anyone tested the above Stop Access Point command?  I can start the access point, but I can't stop it.

     

    Marty

  • Yep. Me, and lots of other people have written code that uses the stop access point command. Check out some of the code listed here:

    http://wiki.msp430.com/index.php/EZ430-Chronos?DCMP=Chronos&HQS=Other+OT+chronoswiki#PC.2FChronos_Communication

     

    There's examples using it in Python, Ruby, and Processing. What language are you using?

  • My mistake.  I assumed the access point was not stopped but I was looking at the watch rather than the USB doggle.  The code works fine.  I coding in C++ but I have been using your python code as an example.

    Thanks for your assistance,

    Marty

  • Guys,

    the new Chronos content update with the AP firmware source code and updated documentation might be able to help you with your development.

    http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/p/18587/141055.aspx#141055

     

    Regards,

    Dung

  • hi guys

     

    i  know i sound stupid out here...but can some one pls tell me where u learnt how to send commands to the rf access point and pls tell me how it is done.i. have absolutely no clue... it would be very helpful if u cud give me tat info asap..

    thanx

    kaushik

     

     

  • Hi Kaushik,

    Good question - you might be aware of the technique of reverse engineering, the practical stuff we do to solve problems.

    In this case thanks to whose work was useful to be carried forward. You could learn the same with port scanning, lot of patience and time.

    Warm regards,

    Ganesh N

  • hi ganesh

     

    thanx for de reply. actually i am doin a project now. its only for a month and i dont have that much time to sit and research all stuff. i need to create a GUI which can send commands through the AP and receive certain data from the watch and do some calculations on the PC side. I am using JAva to do this. But the prob is i am not very well versed in JAVA or any language which can help me create a GUI . i know a  MATLAB properly and know to make GUIs in it. but i feel matlab is too slow to draw real time  graphs . is it possible to do it in matlab itself ?? pls advice me how i cud proceed.

    regards

    kaushik

     

  • Kaushik,

    Given the situation a. You are doing a short term project & b. You are only well verse with MATLAB, I don't see you reaching your goal.

    JAVA is no big deal, for that matter if you can lay your hands on Microsoft .NET technologies they are very intuitive. I am sure you can do it this way rather than living with a mental block. Unfortunately, I can't guide you with MATLAB.

    Regards,

    Ganesh N

  • Hey ganesh,

     

    its cool i got it runnin on java.. there was a minor mistake in de code . prob coz i didnt know java well.. anyway cleared it. shud not be a prob now i hope. :)

     

    kaushik

  • Thank you everyone for your information on the above. I was wondering if anyone has gotten two chronos connected to one access point or two chronos connected to one chronos (2 slaves to a master).  I just started playing with these and looking for any help I can get.  Thanks again.

  • I don't think 8 bits are enough for the acceleration data. When I use Chronos Control Center interface I see data large than 255 and there are negative values out there. So I think each axis should have more bits for its value.

  • Hello Guys,

    I have got this watch very recently and I am still in the initial stages. Could someone help me write a code in C to capture the x,y,z co-ordinates onto an xml file or a data file? It would be of great help if anyone can guide me through the process. 

     

    Thanks a lot.

    Regards,

    Srikanth Sistla.

  • Hi Jesus, 

    in MATLAB, to load AP i've done this

     

    %  startAP_CMD =  'ff0703';  replaced by startAP_CMD =  [255 7 3];

    s=serial (...) % same as you have done

    startAP_CMD =  [255 7 3];

    fprintf(s,'%s',native2unicode( startAP_CMD )) %  the use of  " format" "%s"  is to supress the use of terminator

    and works fine. 

    i have some troubles to get off the AP using "ff 09 03"(while, the "solution" is close the serial connection, and open TI program to be sure the connection will be closed when close this).

    that's all.

    regards

  • Hello all!

    I recently got my Chronos ez430, and I have been able to play with the programming in the swatch, but I´m struggling quite a bit with the PC-Chronos Communication. I would like to use Visual Studio, whatever language is fine. I thought this was going to be like a regular serial port, but I guess its not that easy to use the AP...

    Im lost in this matter, can anyone help me please?

     

    Thanks, 

    Ángel Hernández

     

  • Excuse me can you tell me were did you found this commands?

    Thank you

  • I have tried to show a 3D box in Processing that rotate when you tilt the watch:

    http://www.metacafe.com/watch/7035380/ez430_chronos_processing_and_tilt_measurement_error/

    I get the 3 maximum and minimum values  and convert them to -1.0 and 1.0 interval. Then with the atan2 function I convert it to rotations for X (pitch) and Z (roll) axys:

            float x, y, z; 

            x = map(buffer[4], -53, 47, 1, -1); 
            z = map(buffer[5], -60, 43, -1, 1); 
            y = map(buffer[6], -65, 31, -1, 1); 

            valorX = atan2(x,y); 
            valorZ = atan2(z,y); 

    However as you can see in video, when I invert the watch the 3D box moves wrong. What is the formula to calculate 360º rotations with the three values (x,y and z) retrieved from accelerometer?

     

  • hi, here if  im sending the data as "ff 07 03"., the same command is echoed back to me.

    im not able to connect it via hyperterminal.

    please help me in getting the accelerometer values via hyperterminal.

     

  • Hello,

    First of all I would like to thank you for your contributions in this thread, because it was very helpful.

    Unfortunately, I still have a problem when I want to read my AP (my Chronos is working with the Data Logger).

    Example: I send "FF 07 03" (which also works) to start the AP and now want to read if this statement was successfully arrived.


     The only thing witch I get back is a timeout, although my serialsniffer (Portmon) protocolls, that the string "FF 06 03" was read (see picture).

    Here is my c++-code (for my QT-Programm wich using qextserialport):

    #include <QtCore>
    #include <QCoreApplication>
    #include <qextserialport.h>

    int main(int argc, char *argv[]){
        char data[3];
        QString message("\xFF\x07\x03");
        QString message1("\xFF\x09\x03");

        QextSerialPort *mySerial = new QextSerialPort("COM6");
        mySerial->setBaudRate(BAUD115200);
        mySerial->setTimeout(500);

        //Open serial port and start AP
        bool start = mySerial->open(QextSerialPort::ReadWrite);
        int total = mySerial->write(message.toAscii(),message.length());

        //Read if AP has started
        int i = mySerial->read(data, 3);

        //Stop AP and close serial port
        total = mySerial->write(message1.toAscii(),message1.length());
        mySerial->close();

       return 1;

    }

     

    Regards and thank you for reading,

    Matthias

  • Hi h2ogeezr and everyone!

    Please. Somebody knows if you want to connect two chronos in the same PC... Could you use only one cc1111 rf access point?? Because I think it isn´t possible to connect two cc1111 because the two devices have the same VID, PID, etc, and whe you connect the second, the first disconnect.

    If it´s possible to control two chronos with one cc1111, how can I make it work?

    Thank You soo much! 

  • Hi, do you know the command to send a packet? I would like to send a simple packet from the AP to the ED?

    Thanks!

  • Hi Patrick,

    there is no generic command to send messages.

    You could use the Sync Mode to exchange messages.

    You send a message from the AP to the ED with the command  FF || 0x31|| Length(1 Byte, Length of Data + Overhead(3 Bytes) )  || Data

    You have make sure that AP + ED are in Sync Mode before you send messages.

    The dll project for tcl in the eZ430-Chronos\Control Center\GUI Sources\DLL folder is a good reference. The bm_api.h header has all possible commands.

     

     

  • Hi Martin , 

    Am using the EZ430-chronos watch for a project , and i want to apply movements on an object according to the accelerometer  reading , so could you please tell me what kind of library or code you used to read the accelerometer  ?!  am using C++

    Thank you so much :) 

  • jolie john said:

    Hi Martin , 

    Am using the EZ430-chronos watch for a project , and i want to apply movements on an object according to the accelerometer  reading , so could you please tell me what kind of library or code you used to read the accelerometer  ?!  am using C++

    Thank you so much :) 

    Hi jolie

    you can check for eZ430_Chronos_Net.dll available at http://sourceforge.net/projects/ez430chronosnet/files/

  • Al Very nice...

    Now how about using the chronos to display tekst from the host computer.

    I know possibility is limited because of the display but how about numbers>

    I would like to display the status of my house alarm...every door in the house has an unique system.

    When there is an alarm i would like the chronos to show me which door tripped the alarm.

    so long story short, I would like to send data to the chronos and proccess it inside the chronos.

    Any idee?

  • Hi
    I am also trying to develop a accelometer sensor based applications can u help me. Can u share ur source code or accelometer sensor receiving logic and data formats.

**Attention** This is a public forum