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.

Linux BLE scripts

Guru 18385 points
Other Parts Discussed in Thread: CC2540

Hi,

at the wiki:

      http://processors.wiki.ti.com/index.php/Category:BluetoothLE

We can already find two python scripts which will ease minor TI's BLE solution tests under this operative system. The links are:

      http://processors.wiki.ti.com/index.php/Category:LinuxHostTest

      http://processors.wiki.ti.com/index.php/Category:LinuxHostTest2

Thanks to everybody who has helped to this little experiment.

 

  • Hi,

    Im testing an aproach to the comunication with the cc2540, with the keyfob exactly (Mini Dev Kit), using python. The scripts in those links are fantastic, I really want to thank the developper for publishing them. I succeeded with the first script, however, I cannot get the LinuxHostTest2 to work.

    I have flashed the hosTestRealease on the dongle and the SimplePeripheral to the keyfob

    I can discover and connect to the device but I cannot receive data, and if I try to activate all the notifications the program crashes and write on console:

    "WHAT!?! SHOULDNT HAPPEN!!!!"

    I believe I am using the wrong profile on the KeyFob, that was not intended to be used with this script.

    I want to make my own python script but first I wanted to see it works well, so if you could help me it would be great.

    Thank you in advance,

    João Bastos

  • Hi,

    I developed the first script and got in touch with the author of the second one. Unfortunately, I think the second one does not work nowadays but just because of the change in the handles TI applied some time ago. Check this link for related info:

    http://e2e.ti.com/support/low_power_rf/f/538/t/134385.aspx

    And please feel free to upload an updated version of the second script if you succeed! :)

  • Yes, you were right. The problem is simply a wrong handle number for the Accelerometer Enable. Its easily fixed by changing the Handle value in the BTDevices.py, activateAccelerometer function, from \x21\x00 to \x33\x00.

    I will upload this modified version to my files, in my TI account. I don't know where is the correct place to upload this, or if it would be enough just to add a note on the wiki page explaining this. What do you think is best?

    Best Regards,

    João Bastos

  • Wow! Is it really THAT easy?

    I did not wanted to change the code of another person but I do not think it is wrong to do a single modification... argh.

    See you in 10 minutes.

    PS: Everybody, the change has already been applied. If there are new modifications to be made, do not hesitate posting here. Bye!

  • looking for some help with this keyfob dev kit. had some questions for you. not sure how to send you a PM. please message me: abraham.carter@gmail.com

    thanks in advance

  • Hi Abraham,

    I am not a TI member and this is not my job so I do this for fun. I do not accept private messages, since I cannot guarantee I can help. I just try to.

    So post around the forum and we'll try our best. TI guys are much better prepared than me.

    Bye! :)

  • Hi Abraham,

    Kindly add me as your friend in Ti.E2E forum and when ever you are posting queries , send a notification to me so that i can help you ,if i can.

    Nice Day,

    Senthil

  • Dear ,

    May I ask the some code as below against red word.

    I want add humidity for this script , how can I do?  

    Because more doc I cannot found.

        def activateAccelerometer(self):
        #Write Command
        st = '\x01' #command
        st = st+'\x12\xFD'   #0xFD12 (ATT_WriteReq)
        st = st+'\x07'    #datalength
        st = st+self.connHandle    #handle
        st = st+'\x00' #Signature off
        st = st+'\x00' #command off
        st = st+'\x33\x00'        #CHANGED from \x21\x00! attribute Address
        st = st+'\x01'    #AttrValue
        self.ser.write(st)

        #wir setzen hier nur die bewegung in gang, HCIEvents wird den rest der pakete schicken parsen etc.
        def setUpXAccNotifications(self):
        st='\x01' #command
        st=st+'\x88\xFD'   # 0xFD88 (GATT_DiscCharsByUUID)
        st=st+'\x08'        #data length
        st=st+'\x00\x00'    #connectionhandle
        st=st+'\x01\x00'    #Starting handle
        st=st+'\xFF\xFF'    #end handle
        st=st+'\xA3\xFF'    #UUID we are searching for (X)
        self.ser.write(st)
        def setUpYAccNotifications(self):
        st='\x01' #command
        st=st+'\x88\xFD'   # 0xFD88 (GATT_DiscCharsByUUID)
        st=st+'\x08'        #data length
        st=st+'\x00\x00'    #connectionhandle
        st=st+'\x01\x00'    #Starting handle
        st=st+'\xFF\xFF'    #end handle
        st=st+'\xA4\xFF'    #UUID we are searching for (Y)
        self.ser.write(st)
        def setUpZAccNotifications(self):
        st='\x01' #command
        st=st+'\x88\xFD'   # 0xFD88 (GATT_DiscCharsByUUID)
        st=st+'\x08'        #data length
        st=st+'\x00\x00'        #connectionhandle
        st=st+'\x01\x00'    #Starting handle
        st=st+'\xFF\xFF'    #end handle
        st=st+'\xA5\xFF'    #UUID we are searching for (Z)
        self.ser.write(st)

    Thanks

    Ben

  • The value of the handle should be changed from 0x33 to 0x34 with the latest code.