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.

CC2540 how to send multiple packets in one connection event

Other Parts Discussed in Thread: CC2540

Hi,

I'm recently working on CC2540 . I see discussions about sending 4 packets of 20 bytes in one connection event.

So I tried with the USB dongle with Btools (Host test release) and the key fob (Simple BLE pheripheral). When the left key is pressed, the keyfob sends 4 packets.

But no matter how I adjust the theconnection interval (from 7.5ms to 80ms), I always get 4 packets with an interval of exactly 10 ms between each of them.

Is there any thing I'm missing in the configuration? Thanks for yor help.

  • Hello Xiao,

    According to the documentation:

    Profile checks the connection interval and slave latency setting for the connection, and (if enabled) will send an automatic update request if:
    – Interval falls outside the range set by GAPROLE_MIN_CONN_INTERVAL and
       GAPROLE_MAX_CONN_INTERVAL parameters
    – OR latency setting does not equal GAPROLE_SLAVE_LATENCY parameter value
    – OR supervision timeout settings does not equal GAPROLE_TIMEOUT_MULTIPLIER parameter value
    Update parameter request sent with connection parameter values in profile

    You would need to set:

    #define DEFAULT_ENABLE_UPDATE_REQUEST                   TRUE

    Thanks,

  • Hi greenja,

    Thanks for your reply.

    I tried to set the DEFAULT_ENABLE_UPDATE_REQUEST to TRUE but that doen't change anything.

    How can I get multiple packets sent during one connection event ? Please help.

  • I believe you are getting multiple packets sent during a connection interval if you are seeing 4 packets sent during a connection interval.

    The UPDATE_REQUEST is something I'll have to look into.  Perhaps since the BTOOL or Central device needs to send the new setting to the peripheral.  The Central device would then see if the request falls writhing the settings of the peripheral before it is changed.  I would have to lookup the exact procedure.

    Thanks,

  • Hi,


    view this thread for how I ended up doing it.

    http://e2e.ti.com/support/wireless_connectivity/f/538/p/345429/1209148.aspx#1209148

    Use HCI_EXT_ConnEventNoticeCmd to get a callback after a connection event. When this callback happens use

    while ( GATT_Notification() == success ) to queue up data until you fill the queue.

    Good luck.

  • Hi Mark,

    Thanks a lot for your post. That's  helpful.

    Could you please tell me where did you put the HCI_EXT_ConnEventNoticeCmd() function? I tried to call it in the peripheralStateNotificationCB() in the case  GAPROLE_CONNECTED. But it seems not working.

     

     

  • Hi,

    You need to compile code with "ADV_CONN_CFG" and "CTRL_CONFIG" flags. 

    Another thing is that , you can put HCI_EXT_ConnEventNoticeCmd(uint8 taskID, uint16 taskEvent)  during initialization only.

    task id is your task id. When event occurs, it'll notify you with taskEvent passed during function call. which means you'll receive event which you have passed in function argument.

  • Are you still having issues?

  • Hello Gill,

    Sorry for not giving feedback. I'm occupied by another sujet. I'll be back soon.

  • Hi,

    Thanks for you guys I got it worked.

    I tried to put the HCI_EXT_ConnEventNoticeCmd(simpleBLEPeripheral_TaskID, SPB_BLECON_EVT); 

    into SimpleBLEPeripheral_Init( uint8 task_id ), but the funcion returned 0x12 HCI_ERROR_CODE_INVALID_HCI_CMD_PARAMS.

    I saw in this post the save problem, http://e2e.ti.com/support/wireless_connectivity/f/538/t/222801.aspx

    It seems the HCI_EXT_ConnEventNoticeCmd() should be put into peripheralStateNotificationCB() function, in the switch case GAPROLE_CONNECTED, there it returns 0x00 HCI_SUCCESS. What I did was right, I just missed the definition of the flag ADV_CONN_CFG

    BUT, I still cann't verify how many package sent and the time interval between packages. 

    It seems that the BTool won't log a time interval less than 10 ms.

  • Is this simply a subset wrapper function for using HCI_EXT_HaltDuringRfCmd?