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.

BLE central device



Hi, I am trying for a application based on peripheral - central BLE communication on CC2540EMK boards. I do not have SmartRF EB evaluation board so i have powered it using my own power board that is similar to SoC-BB (which can only power up the device with no keyboard).

My queries are

1. how do i generate events for Key handling (Joystick), that get generated from a SmartRF EB?

2. IAR workbench is unable to set the breakpoints. What could be the cause of this?

BR

Gautam

  • Hi,

    1. Trace available GPIO lines from chip to connector (use EMK schematics) and choose those you wish to use. Enable them as GPIO pins in IAR project and wire the actual connector pins to push buttons or whatever switches you want to use. 

    Then (quick-and-dirty yet reliable method) set up GPIO-driven interrupt (look details up in part 7.4 of CC254x user guide). The ISR should then schedule OSAL event. Once the event is triggered, you'll know that GPIO state has changed. 

    2. Check if there are already 4 breakpoints set. CC254x can't handle more than four. 

     

    BR,

    Oleg

  • hi Oleg

    1. I followed your method of using GPIO lines with switches as a replacement to joystick device. I'll try that. But for now can we have some method of doing it from the stack   itself, like generating an event on purpose.  

    2. U are right i dint about the 4 breakpoints limit. Thank you

    BR

    Gautam

  • Just to clarify - do you want to somehow emulate key events as they are in simpleBLEcentral? I think it could be done by explicitly calling simpleBLECentral_HandleKeys.

    Appropriately placing those calls in time is another matter - its your call. Simplest may be crude state machine:

     if ( events & NEW_SHINY_FSM_TRIGGER_EVENT )
    {

     if (fsmCounter = 54) 

     {

       <make some call emulating keypress etc.> 

     }

    osal_set_timeEx( taskId,  NEW_SHINY_FSM_TRIGGER_EVENT, 2000 ) ; // so next time the stack will call this branch after 2000ms

    return ( events ^ NEW_SHINY_FSM_TRIGGER_EVENT  ); 

      

    BR

    Oleg

  • Hi Oleg

    Currently I am working on emulating the key events for a BLECentral device. I'll come back to you with it later.

    In parallel,  i would like to know about callback functions, the concept callback is not clear me.(as in how, when are they called and so on )

    Can you give me some references for it?

    BR

    Gautam 

  • Hi,

    For precise info, the best bet is BLE_API_Guide that comes with a stack.

    Callback is a way for event handlers to interact with lower level layers. You make a call (like GATT_Write or whatever) and return control to the stack. Sooner or later the stack will come up with a result of call and pass it as an OSAL message that triggers the callback function. You can then map the message to appropriate structure (that's where API guide comes in handy) and get statuses, return values, etc.

    BR, 

    Oleg