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.

New Sample Project - "KeyFobDemo" - Accelerometer, Battery, Proximity, KeyPress profiles

Other Parts Discussed in Thread: CC2540, BLE-STACK, CC2530, CC2430, CC2541

Hello,

We have a new sample project called KeyFobDemo which can be found on the following Texas Instruments Wiki

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

The example comes with source and binaries and will demonstrate the following functionality. 

  • Report battery level
  • Report 3 axis accelerometer readings
  • Report proximity changes
  • Report key press changes
  • Buzzer/ LED

These are implemented using GATT server profiles and the top level application.  Note, these profiles are not yet aligned with Bluetooth SIG profile specifications and are provided only as an example.  This demo uses the same libraries which were provided in the version 1.0 installation.

LPRF Wiki: http://processors.wiki.ti.com/index.php/Category:LPRF

Thanks,

LPRF Team

  • Thank you for this new code.

     

    I have a few question for the accelerometer part:

    - Is the sample code enabling the 2g or 8g range ?

    - Is there an example code to calculate the roll and tilt based on the CMA3000 accelerometer readings ?

    The datasheet of CMA3000 provide very little info. 

    It states that the range is between -2g and +2g (or -8/+8g) and the sensitivity is 56 count per g for 2 g. Am I correct to assume that the -2g reading would be 0 and the +2g reading would be(4*56) -> 224 ? If that the case, why do I get reading up to 255 ?

     

    - How to you get the 0g offset value ? (I could not find it in the datasheet)

     

    Thanks,

     

    Christian

  • The KeyFobDemo project enables the 2g range of the accelerometer.

    More information on the accelerometer can be found on VTI's web site: http://www.vti.fi/en/products/accelerometers/consumer_electronics/cma3000_series/

     

  • Any inputs on my other questions ?

     

    Thanks

  • Hi,  I compiled this demo project and the hex file was ~284KB. The included hex file

    with this demo project is ~721KB.  What's the difference? Should I able to flash the

    hex file I produced? thanks

  • The reason that the hex files included with the installer differ in size from that generated using IAR is because the file with the installer was generated by using the “Read flash into hex file” option in SmartRF Flash Programmer on a device that was programmed using the “Debug” command in IAR. If you look at the hex file included with the installer you will notice a large section of it contains all “FFFFFFF…”. This is because the read-back function with save blank sections of flash in the hex file.

  • Thanks for the clarification. I was able to flash the modified version.

     

    @ Christian

     

    were you able to use the accelerometer readings? my understanding after reading the data sheet

    is that the reported values are in 2's complement and requires further processing to get usable readings.

  • @Muthu - Did you have any luck running your build? While I can flash, I am finding varying degrees of instability in my own build that I do not find with the installer-provided hex file.

    One guess as to why I'm having trouble - I have applied all the available IAR patches to 7.51A (through to 7.51M) to my workbench installaiton. From the descirptions of the patches, it seems all are essential, so this is just a guess.

    What is the specific tool-set version and patch set applied in the released build of the demo?

    Best,

    Michael Devine

     

     

  • Yes, it has been working fine. I have modified the demo project, bulit and flashed several times so far. No issues.

    I've been using the keyfob to develop a demo (on windows) as well. No problems so far.

    I'm using 7.60 (EW8051-EV-web-7601.exe) and installed only one patch (EW8051-7.60-4-EV.zip) that was specific to CC2540.

    What were the instability issues you ran into?

  • Is support for IAR 7.60 official? The docs I have explicitly state otherwise, indicating support for 7.51A. Perhaps I need to pull forward to 7.60? Is there an official statement of support yet? If so, then do I also need to acquire fresh BLE stack libraries?

     

     

     

     

  • I'm not sure. I downloaded that version first and it worked. So, sticking to it.

    Just install the 7.61 and overwrite the files with the content from the patch. Thats it...

  • Hi,

     

    quoting http://processors.wiki.ti.com/index.php/Category:KeyFobDemo#Proximity_Callback :


    The functionality of the proximity profile is based on the Bluetooth SIG draft document Proximity Use Case, Requirements, and Design Document D05r06. Note that even though the profile functionality is based on a Bluetooth SIG document, the UUID values that are used by the profile are custom, and do not conform to any values defined by the Bluetooth SIG. This is because the SIG has not yet assigned any UUID values for the proximity profile. The functionality implemented on the keyfob is the role of the “Proximity Reporter” as defined by the document. A mobile phone or PC would typically implement the role of “Proximity Monitor”; however this full functionality has not yet been implemented in the USB Dongle software or BTool.

     

    Is there an official data when this functionalities will be implemented?

     

    Kind regards


  • There is official date as of yet; however a reasonable guess would be in the next few months.

  • In the CC2540 Keyfob reference design, can we use CR1220 coin cell battery with 220uF cap instead of CR2032 with 47uF cap?

     
    Model IEC
    (JIS)
    Electrical Characteristics Operating
    Temperature
    Range
    Dimensions PDF
    Nominal
    Voltage
    (V)
    Nominal
    Capacity
    (mAh)
    Standard
    Discharge
    Current
    (mA)
    Diameter
    (mm)
    Height
    (mm)
    Weight
    (g)
    CR1216 CR1216 3 30 0.1 -30°C to 70°C 12.5 1.6 0.7
    CR1220 CR1220 3 40 0.1 -30°C to 70°C 12.5 2.0 0.8
    CR1616 CR1616 3 60 0.1 -30°C to 70°C 16.0 1.6 1.1
    CR1620 CR1620 3 78 0.1 -30°C to 70°C 16.0 2.0 1.2
    CR2016 CR2016 3 90 0.1 -30°C to 70°C 20.0 1.6 1.7
    CR2025 CR2025 3 160 0.2 -30°C to 70°C 20.0 2.5 2.4
    CR2032 CR2032 3 220 0.2 -30°C to 70°C 20.0 3.2 3.2
     
    Here is the website I found regarding coin cell spec http://www.sony.net/Products/MicroBattery/cr/spec.html
  • Another question on keyfob reference design,

    The CC2540 datasheet and BLE specification allows me to calculate the battery droop due to an RF interaction as 0.33 V maximum (use 24 mA for 3 mA and calculate maximum droop as I = C * dV / dt ignoring the battery’s contribution to the pulse load), but I cannot tell what will happen if I try to erase a Flash memory block to write new data (I do not know the current or time to erase a Flash block per the original question below).  Ironically, I cannot even verify the Keyfob reference design through specifications because this data is lacking and does not allow me to verify the CR2032 battery is adequate

  • Hi ,can someone tell me why there is a  start up delay of 500ms incorporated STARTDELAY   to do gap device initialisation?

  • Hansen Dsouza said:

    Hi ,can someone tell me why there is a  start up delay of 500ms incorporated STARTDELAY   to do gap device initialisation?

    This delay is not required; you could change this to osal_set_event to directly set the event rather than waiting 500ms, or you could reduce the delay. This was put in just in case your board has some peripherals that may take some time to initialize. For the keyfob hardware this is not the case.

  • @Muthu Kumar

     

    Hi,

     

    I have recently started using the CC2540 kit. Have you figured out what the accelerometer readings stand for on each axis?

     

    In the accelerometer data sheet (http://www.vti.fi/midcom-serveattachmentguid-1e0126c994791f0126c11e09138e559c13fb5afb5af/cma3000-d0x_product_family_specification_8281000a.04.pdf, page 14 Table 4) the data is said to be presented in two's complement format, but the bit level description of the register indicates it is a signed integer.

     

    Any help would be appreciated.

  • Hi Muthu

            Twos complement signed integer imples the same thing..shift it and store it in a signed int and you should get the value,if its 12 bit ADC then range =  +-512

     

    Regards

  • Hansen is correct. A signed integer is the same as "two's-complement format". Here are a few examples of 8-bit data converted between hex and signed decimal:

    hex int8
    0xCF
    -49
    0xE1
    -31
    0x00 0
    0x21 33
    0x34
    52

     

  • Thank you for the quick reply and clearing up the confusion.

  • Where did this project move?

    This link no longer works (as of June 6, 2011)

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

    This link does not have the project files (as of June 6, 2011)

    http://processors.wiki.ti.com/index.php/BleAppKeyFobDemo

  • Seems to work now. Not sure what happened there...

  • Hello,

    Is the Project given at http://processors.wiki.ti.com/index.php/Category:KeyFobDemo the same as the one getting shipped with the BLE-CC2540-1.1a (C:\Texas Instruments\BLE-CC2540-1.1a\Projects\ble\KeyFob) ? Or its different? 

    In the wiki its stated that : 

    Running from the hex binaries

    Use the Smart RF Flash Programmer[2] to load the following images.

    • cc2540_ble1.0_slave_keyfobdemo.hex -->KeyFob
    • cc2540_ble1.0_master_usb_dongle.hex -->USB Dongle

    Where can I find the second hex file? Can someone please guide me?

     

    Thanks and best regards,

    Nagaraj Hegde

  • nagaraj hegde said:

    Where can I find the second hex file [cc2540_ble1.0_master_usb_dongle.hex]?

    You will need to download and install BLE-STACK version1.0 to get cc2540_ble1.0_master_usb_dongle.hex

     

     

  • I would recommend that everyone use the latest version of the BLE stack (version 1.1). It can be downloaded here: www.ti.com/blestack.

  • Willis said:

    I would recommend that everyone use the latest version of the BLE stack (version 1.1).

    I look forward to the release of a version of the KeyFobDemo that is intended for use with BLE stack version 1.1.

    README_KEYFOBDEMO.txt said:

    KeyFobDemo

    Version 1.0
    November 10, 2010

    Requirements
    1) CC2540 Bluetooth Low Energy Software Development Kit
    2) Installed BluetoothLE.exe software version 1.0

  • Sorry, I should have clarified- the BLEv1.1 SDK includes an updated version of KeyFobDemo. The application functionality is generally the same but updated to work with the v1.1 stack.

  • Willis said:

    Sorry, I should have clarified- the BLEv1.1 SDK includes an updated version of KeyFobDemo. The application functionality is generally the same but updated to work with the v1.1 stack.

     

    Thanks for clarifying.  I was mislead by the fact that (as of Septmeber 7, 2011) the CC2540DK Examples > Category:KeyFobDemo on the TI processors wiki describes only the KeyFobDemo for BLE-STACK v1.0.

  • Hello ,

    Thanks for the info., I am now using BLE 1.1 but finding it hard to locate the Characteristic UUIDs required to read the Accelerometer/battery status while using Btool ., Can you guide me in this regard please?

    And I believe I have done the right thing by flashing cc2540_ble1.1_keyfob_SimpleBLEPeripheral.hex into the CC2540miniDK and cc2540_ble1.1_USBdongle_HostTestRelease_Master.hex into the dongle., Let me know if I am wrong.,

    Thanks and best regards,.

    Nagaraj Hegde

     

  • Hello Jason,

    Any idea where can I get the HAL timer application which used to get shipped with the older stacks? I checked in version 1.0 and it wasn't to be found there.,

    Let me know.,

    Thanks and best regards,

    Nagaraj Hegde

     

  • nagaraj hegde said:

    Any idea where can I get the HAL timer application which used to get shipped with the older stacks? I

    This is what I found related to HAL timer.

    The equivalent files are there for BLE v1.0 too

  • Hello Jason,

    I know., But they are empty documents., There are no source code in those., I got the files from Igor, who gave it to me from z stack.,

    Thanks and best regards,

    Nagaraj Hegde

  • Hello NH -

    From what I understand, the HAL Timer files from ZStack are wrong - they were never updated from the register settings of CC2430 to the newer register settings of CC2530 (and thus, CC2540). So beware and review all of the register setting abstractions. Thus it seems that the HAL timer abstraction has been abandoned altogether because the use of a hardware timer is so specific and for many common uses, the abstraction will either make the timer operation inefficient code-size wise or not achievable, in which case you have to go in and write your own timer driver anyway. Thus we embedded software folks have jobs ;)

    -CS

  • Hello CS,

    Thanks for that., I was aware of these as Igor told me about this while sending the file., Thanks so much for your inputs., I am just using them as reference.,

    Best regards,

    Nagaraj Hegde

  • I've downloaded this twice with the same results..... my keyfob is based on the BLE-CC2540-1.1a download.  When this software is downloaded the function types do not align and are of different versions.  Calls to the same functions are or have been rewritten and take different perameters. They are also for an older version of the IAR software. So where do I go from here?

     

    Thanks

    Greg / robotics

  • Okay, this seems to have fallen into a stream about something I'm not interested in at all!  I don't care about timers at this point although this may change as things go further.  Right now I'm trying the get my BLE-CC540-1.1a download to accept and setup the accelerometer on the keyfob.  Evidently the newer 1.1a code doesn't generate the handles and responses into the system to activate the functions on the keyfob...... the code supplied is for version 1.0 and this is too old for my system or my version of IAR 7.60.... function calls are all wrong when compliled.  Where do I go from here?

  • I have not read the whole post but if you are looking for some accelerometer code, Victor Montilla was kind enough to post his achievements on the following thread:

    http://e2e.ti.com/support/low_power_rf/f/538/p/132241/475228.aspx?PageIndex=2

     

    Bye.

  • Hi Greg,

    Greg Vanderbeck said:
    Evidently the newer 1.1a code doesn't generate the handles and responses into the system to activate the functions on the keyfo

    Are you referring to the handles presented on the wiki? (processors.wiki.ti.com/index.php/Category:KeyFobDemo) In that case, I see your concern because those handles are outdated. The keyfob project included in the BLEv1.1 is essentially the same, but the handles has been updated. You could for example use Discover by Characteristic UUID to get the handles, which is by the way one of the standard ways to obtain the them.

    BR

  • Nick L said:

    The keyfob project included in the BLEv1.1 is essentially the same, but the handles has been updated.

    You can find the handles for the acceleromter here.

    What firmware should I use to try the accelerometer and proximity (link loss) alert on the CC2540DK-MINI?

  • I'm using BLE 1.2, but I can not find the UUIDs for the different profiles. I am using, for example BTool trying to discover the UUID 0xFFC5 for the proximity profile, as is specified in the Wiki, but the system says att not exist.

    Is there any documentation about this UUIDs that I have missed?

    Thanks in advance.

  • Hi Angel,

    As the wiki says "NOTE: This is for version 1.0 release Oct 2010." so that wiki page is obsolete. The UUIDs has been changed since then, you can find the new ones if you look in the proximity profile header file proxreporter.h.

    #define LINK_LOSS_SERVICE_UUID          0x1803
    #define IMMEDIATE_ALERT_SERVICE_UUID    0x1802
    #define TX_PWR_LEVEL_SERVICE_UUID       0x1804
    Br


  • cc2540_ble1.0_slave_keyfobdemo.hex is included in KeyFobDemo.zip,

    but cc2540_ble1.0_master_usb_dongle.hex is not included.

    Can you provide usb dongle firmware?

  • That version on the Wiki page is old. Please go to ti.com/blestack and download v1.2 of our BLE SDK. This version includes the latest keyfobdemo project working with the latest stack, as well as an updated USB dongle hex file.

  • Hello,

    Could someone post an example, or link to one, that shows a similar tutorial for beginners but without using BTool?  In other words, how do you communicate with the CC2540 to show it's data in a custom PC GUI created with Java, for example?  No third party software allowed.

    Thanks,

    John

  • Could someone at TI update this tutorial for the current CC2540 version?  It is significantly outdated.  It says to load the keyfab with cc2540_ble1.0_slave_keyfobdemo.hex and load the dongle with cc2540_ble1.0_master_usb_dongle.hex.  There are no such files in the ti.com/blestack download.  Here is a list of the current ones:

    CC2540_keyfob_SimpleBLEPeripheral.hex

    CC2540_SmartRF_HostTestRelease_All.hex

    CC2540_SmartRF_SimpleBLECentral.hex

    CC2540_SmartRF_SimpleBLEPeripheral.hex

    CC2540_USBdongle_HostTestRelease_All.hex

    CC2540MiniDkDemoSlave.hex

    CC2541_SmartRF_HostTestRelease_All.hex

    CC2541_SmartRF_SimpleBLECentral.hex

    CC2541_SmartRF_SimpleBLEPeripheral.hex

    I was able to get the keyfob and dongle firmware loaded.  I used CC2540_keyfob_SimpleBLEPeripheral.hex for the keyfob and CC2540_USBdongle_HostTestRelease_All.hex for the dongle.  Is that right?

    I managed to make it through the CC2540 Mini Dev Kit User Guide up to section 4.3.1, Reading a Characteristic Value by UUID.  Everything seemed to work ok as I got the expected response.  Then I switched to this tutorial.  I'm trying to "Read Using Characteristic UUID" in the Battery section.  I entered B1:FF in Characteristic UUID field as directed but when I clicked the Read button, I got "Invalid Parameter" message in the Status field.  The tutorial does not tell you what to do if you don't get the expected value so now I'm stuck.  Can anyone help?

  • John, if you're still stuck, I updated the Wiki with a few of the new UUIDs that I knew. Hopefully TI will update it with all the new UUIDs.

    --Derek

  • I am also using this app for the project. But I need to get the same set of  functionalities on the master node (i.e., the communication initiator) rather than a slave node (the advertiser). Please advise how I can do it, Please!!!