• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » Low Power RF Bluetooth® Low Energy & ANT Forum » How to make a program ?
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

How to make a program ?

This question is answered
Drave Dravenburgh
Posted by Drave Dravenburgh
on Feb 18 2012 13:04 PM
Prodigy200 points

Hello,

i bought the MiniDK for my Thesis. I have already programmed my Atmega8 and now i have to transfer the program to the CC2540. My problem is that i don't know how to start.

I have already read the guides and debugged the SimpleBLEPeripherial.

What i know is that during the initialization OSAL has to register my app as a task. After the initialization OSAL is waiting for events which trigger the tasks.

What i need is a procedure how to change the SimpleBLEPheripherial so that my program works.

If you give me an example for the following program i will surely understand what to do further.

The program is very simple.

For the KeyFob:

The ADC has to be started every 4ms (256Hz).

The converted values (10bit or larger) have to be sent with an baudrate of 57000 to the dongle, that all should be done continously without requests.

The dongle is installed properly as a serial port, so that the data can be processed by a software.

Keyfob and dongle should know each other so that by pressing a key a link should be established and the data should be sent

Thats all.

Thx

Andi

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • kazola
    Posted by kazola
    on Feb 18 2012 13:32 PM
    Guru10665 points

    I would not count on other people doing your job.

    You can start by observing the ADC example in the KeyFob project, which is using ADC to sense remaining battery.

    The baudrate 57000 is strange.

    You can do the behavior you want by working with autoconnect white lists in the dongle.

    Good luck :)



    Please click the     Verify Answer     button on a post if it answers your question! :)

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Drave Dravenburgh
    Posted by Drave Dravenburgh
    on Feb 18 2012 14:41 PM
    Prodigy200 points

    Hi kazola,

    it's not the whole program ! Only the frame of it.

    I don't know where to write my program.

    In the SimpleBLEPheripherial there ist the main task SimpleBLEPeripheral_ProcessEvent.

    It is triggered when it gets a message.

    The message comes from osal_run_system

    One part of the osal_run_system is:

    do {
        if (tasksEvents[idx])  // Task is highest priority that is ready.
        {
          break;
        }
      } while (++idx < tasksCnt);

    tasksEvents is defined as: uint16 *tasksEvents;

    and implemented in osalInitTasks: tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt);

    So tasksEvents is an array ? How ?

    The while loop checks if any bit of the tasksEvents array is set. But where is it set ?

    Is there a function in IAR which finds all references of a variable, like in VS 2010 ?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • kazola
    Posted by kazola
    on Feb 19 2012 04:43 AM
    Guru10665 points

    Ok...

    to find all text referred to a variable in IAR try to press "Ctrl + Shift + F". Then you can travel along the project by clicking on each result row :)

    On the other hand, at the beginning of the program, for example in OSAL_HostTest.c or OSAL_SimplePeripheral.c, you'll see the place where the taskarray is built. and where each layer of the stack is assigned with a number = taskID. For example, AND THERE ARE NOT REAL NUMBERS, when doing:

      L2CAP_Init( taskID++ );

    taskID = 3, L2CAP layer will have a taskID = 3.

    In the code, you can send L2CAP-level events by osal_set_event(3).

    Please note this is a very basic example / notation.

    Bye!



    Please click the     Verify Answer     button on a post if it answers your question! :)

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Drave Dravenburgh
    Posted by Drave Dravenburgh
    on Feb 19 2012 15:39 PM
    Prodigy200 points

    I made a flowchart for SimpleBLEPeripheral maybe it will help somebody like me.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Drave Dravenburgh
    Posted by Drave Dravenburgh
    on Feb 19 2012 19:49 PM
    Prodigy200 points

    I need the ADC to convert with 256Hz. So i have to set  osal_timer_EX() to 3.9 but the function doesn't accept floats ? What can i do ?

    I want that the Keyfob and Dongle to connect automatically so that i can monitor and process the data with another program called Brainbay. With Brainbay i can't send any commands to the dongle thats why they should link by pressing on keyfobs button.

    Where can i find information about the whitelist ? Or a howto ? Didn't find anything about that.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1960865
    Posted by 1960865
    on Feb 19 2012 20:29 PM
    Intellectual775 points

    asdfasdf asdfasd

    I share your pain. I am in  the same boat; I been reading TI's documents and code. but there is no design diagrams that can make understanding this thing much easier. Can you please upload your diagram into your files? I downloaded it but resolution is too low for it to be readable.

    thanks in advance

    LD.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Drave Dravenburgh
    Posted by Drave Dravenburgh
    on Feb 19 2012 21:15 PM
    Prodigy200 points

    Hi,

    Yes, it's really painful :=)

    It's not a real flowchart and not complete but i think it 's enough to understand the structure. You should go through the flowchart debugging the program.

    VISIO 2010:

    7774.SimpleBLEPeripherial.rar

    JPG:

    1464.SimpleBLEPeripheralJPG.rar

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Larry Yi
    Posted by Larry Yi
    on Feb 19 2012 21:23 PM
    Prodigy55 points

    thanks for sharing.I bought also for the same for project.

    I have same problem also. I code read and document with difficult. Texas Instruments files are no good for me to understand. 

    Mr Kazola, how do you suggest we learn.

    Thank you for help

    Larry Yi

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Drave Dravenburgh
    Posted by Drave Dravenburgh
    on Feb 20 2012 12:58 PM
    Prodigy200 points

    I found a simple description of BLE profiles:

    http://www.bluegiga.com/files/bluegiga/Bluetooth_LE/Profile_development_BLE.pdf

    And some training videos:

    http://developer.bluetooth.org/KnowledgeCenter/Pages/Training-Videos.aspx

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Larry Yi
    Posted by Larry Yi
    on Feb 20 2012 15:22 PM
    Prodigy55 points

    Mr. Drave

    You had helped more than TI members. 

    Thank you very much

    Larry Yi

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • kazola
    Posted by kazola
    on Feb 20 2012 16:21 PM
    Guru10665 points

    You should start by opening the simplebleperipheral, and playing with simple things, for example, the leds, the advertising frames, the notifications... in this order :) There is no theoretical way to learn, but instead you have to test, fail, ask, test, test, test, fail, fail, search in the forum, search some more, test, fail and ask :)

    If you have not ever programmed, embedded programming is even a bit difficult ;) But sometimes you'll understand things when travelling, for example ;)



    Please click the     Verify Answer     button on a post if it answers your question! :)

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Larry Yi
    Posted by Larry Yi
    on Feb 22 2012 07:28 AM
    Prodigy55 points

    Mr Kazolo, thank you for you reply. I already doing but face difficult because i no find document for high level design to help understand code architecture and structure.  Thats why this post I made reply. I coding experience of 4 years but TI BLE code is difficult to understand. Mr Drave post help me more. You post very little help. thank you

    Larry Yi

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • kazola
    Posted by kazola
    on Feb 22 2012 07:46 AM
    Guru10665 points

    Embedded programming is not high level programming. This is not Visual Basic and TI code is clear enough if you have enough pattience.

    I cannot further answer because I'm on my way to the church to punish myself for not being able to help you more.



    Please click the     Verify Answer     button on a post if it answers your question! :)

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Drave Dravenburgh
    Posted by Drave Dravenburgh
    on Feb 25 2012 07:27 AM
    Prodigy200 points

    Hey guys,

    bluegiga has the same uC built in an own evaluation kit. They developed a script language (bgscript)  which makes programming much more easier. You can use it on the TI evaluation kits  too. You can download it on bluegiga.com (BLE112: have to register).

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Don Clark
    Posted by Don Clark
    on May 03 2012 11:48 AM
    Prodigy130 points

    You are extremely patient, especially with our questions that perhaps seem uninformed.  But I think I can sympathize with the other posters on this thread, because we don't necessarily know how the TI engine really works, and we don't necessarily know where to look.  We can see from the samples how to cause things to happen within the app in the CC2540, but not necessarily how to react to outside actions.  For example, I'd like to intercept the writing of a particular characteristic within a particular service, both identified by UUIDs, and then do my own processing.  I'm doing this in the context of the SimpleBLEPeripheral sample code, and I'm "hijacking" the device info service for now.  I think I can register a callback, or maybe change my planned logic a bit and just use the CB routine already registered (devInfo_ReadAttrCB), but I don't know what my responsibilities will be inside the callback.   For example, is it really a callback (invoked when the normal processing is complete) or is it a delegate (handles the complete set of processing)?  In the case of the read callback in SimpleBLEPeripheral it appears that the devInfo_ReadAttrCB routine is handling all of the processing.  So what would the responsibilities be for, let's say, a devInfo_WriteAttrCB routine?  When these callbacks are invoked how much time can I take in the routine? do I have as much as I want, or am I constrained?   And so on.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
12
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use