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.

CCS/CC2640R2F: why am i not getting any BLE service s and characteristics in IOS app, while getting everything in Android App.

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2650, CC2540EMK-USB

Tool/software: Code Composer Studio

Hi,

i am working on a project and in my project the CC2640R2F is performing Advertising and scanning Both. I am using a custom Ble Service to receive Data from App(Android or IOS) to CC2640R2F. Whenever i am connecting the device with BLE Scanner in android i am getting all the services and all the characteristics and i am also able to send and receive the data without any problem and this is also working in my custom android app. But whenever i am connecting the CC2640R2F device with Ble scanner in IOS app, the device get connected but i am not getting any any services and any characteristics in the app. The same situation is with our developed custom ios app also. Why is this happening if i am getting all the things on android then this should also work on ios app.

Screenshot of Ble scanner Android app

IOS app ble scanner 

check if bluetooth Powered On then scanForPeripherals

if peripheral found then connect to device

after device connected search for services (if services found then it will break the timer()  else search for service again )

  • Pradeep,

    We do not support iOS Core Bluetooth Framework and Swift/iOS developers questions on this forum. The best place for this question would be stackoverflow.com or the Apple Developers Forums. You may also reference this:
    developer.apple.com/.../
  • In iOS version above 10.x.x ATT MTU method is not defined in the coreBluetoothLibrary but in Android there is a method to update ATT MTU.
    ATT MTU method used to update the connection Parameter. As it is not defined in the iOS so the problem can be solved by the device side only.

    Another thing when i make the HEAPMGR_SIZE=0, which uses auto heap size and
    HCI_EXT_SetMaxDataLenCmd( APP_TX_PDU_SIZE, 328, APP_RX_PDU_SIZE, 328); // in iniatialization

    and
    case HCI_GAP_EVENT_EVENT:
    {
    ...................................
    .................................
    CLR_FEATURE_FLAG( featSet[0], LL_FEATURE_DATA_PACKET_LENGTH_EXTENSION);//LL_FEATURE_CONN_PARAMS_REQ );

    // Update controller with modified features
    HCI_EXT_SetLocalSupportedFeaturesCmd( featSet );


    Now the ios app can connect and disconnect with the device around 8-9 times and after that device is discoverable in ios app and it can connect but no services appears on the ios app.

    I saw the heap_size also and it was coming out around 4736.

    I was not getting any result so i started everything from base and first add ble scanning and advertising in my project, then GPS, IMU and OLED.
    i noticed one thing when i was debugging, initially when only ble code(No IMU, GPS and oled code added) is added in project then it was working fine but when i add the GPS, IMU and oled code step by step then the code size is increasing accordingly and connection-disconnection number is decreasing as code size is increasing.

    So as code size is increasing ram and heap uses also increasing but but when i saw the heap size it was coming out 4736 and ram uses was around 72%.

    I tried increasing MTU size also but it had no effect.
    Sir right now i do not have any problem with android, the problem is with ios only, and after debugging now the device connection disconnection number is around 8-9 after this when i try to connect the device with app no services appear on the app.

    I have posted the similar question on the stack overflow and apple forum also but no exact answer found. try to look on the matter.
    Thank you

  • Pradeep,

    To your ATT MTU update method, it seems user Prognars on the developers forum has solved this.
    forums.developer.apple.com/.../73871

    To the rest of your post, I'm not clear on what your question is exactly. My apologies. Can you clarify on your question?
  • Sorry for the late response. The question was, in my project CC2640R2F is performing both advertising and scanning. for 1st time whenever i connect the CC2640R2F with our developed app or ble scanner, the device get connected and got all the services, now after disconnecting 2nd time when i connect and disconnect this works fine so for android its working fine.
    but whenever i connect with ios app(our developed app or ble scanner) for 1st time when i connect with CC2640r2f all the services and characteristics appear on the app after disconnecting again for 2nd time when i connect CC2640r2f with app all the services and characteristics appear on the app and worked fine, now after disconnecting for 3rd time when i connect with the app again all the services appear on the app but for 4th time when i connect CC2640r2f it get connected with the app but no ble services and characteristics appear on the app and after some time the no devices discover on the app and the device CC2640r2f advertising also turned off, and code has not been crashed its working fine. So this problem is only happening with the ios app, but in android app everything is working fine.
    this was my 1st post question.
    in 2nd post i applied some solution and then the connecting disconnecting number increased for 3 to 8-9

    in 2nd post

    In iOS version above 10.x.x ATT MTU update method is not defined in the coreBluetoothLibrary but in Android there is a method to update ATT MTU. ATT MTU update method used for updating connection parameter MTU size and pdu size according to peripheral coreBluetoothLibrary ( Correct if i am wrong).
    As it is not defined in the iOS so the problem can be solved by the device side only.

    i found in the following post that there may be issue with buffer created during the connection also which causes the heap failure.
    e2e.ti.com/.../579877

    but when i checked the heap size using HEAPMGR_SIZE it was coming around 4736 during connection, so i don't think there may be failure.

    i am using HEAPMGR_SIZE=0, which uses auto heap size and

    after searching a lot we found few command which are following

    HCI_EXT_SetMaxDataLenCmd( APP_TX_PDU_SIZE, 328, APP_RX_PDU_SIZE, 328); // i added this function in initialization function SimpleBLEPeripheral_init() after the BLE gap and gatt initialization is done here APP_TX_PDU_SIZE = 27 and APP_RX_PDU_SIZE = 27 and 328 us

    //
    and in SimpleBLEPeripheral_processStackMsg() in case of HCI_GAP_EVENT_EVENT i added LL_FEATURE_DATA_PACKET_LENGTH_EXTENSION


    case HCI_GAP_EVENT_EVENT:
    {
    ...................................
    .................................
    CLR_FEATURE_FLAG( featSet[0], LL_FEATURE_DATA_PACKET_LENGTH_EXTENSION);//LL_FEATURE_CONN_PARAMS_REQ );

    // Update controller with modified features
    HCI_EXT_SetLocalSupportedFeaturesCmd( featSet );


    so now after after using HCI_EXT_SetMaxDataLenCmd( APP_TX_PDU_SIZE, 328, APP_RX_PDU_SIZE, 328); in SimpleBLEPeripheral_init() and CLR_FEATURE_FLAG( featSet[0], LL_FEATURE_DATA_PACKET_LENGTH_EXTENSION); in SimpleBLEPeripheral_processStackMsg().
    so now when we connect the CC2640r2f device with ios app for 1st time all the service and Characteristics appear on the ios app, after disconnecting now 2nd time when i connect CC2640r2f get connected and all the service and Characteristics appear on the ios app, and now for 3rd time 4rt time ..............till 8th time its working fine and all the service and Characteristics appear on the ios app. after disconnecting when i connect CC2640r2f with the ios app device get connected but no service and Characteristics appear on the ios app or ble scanner. And after some time the device stop advertising. So this issue is only happening in ios app, everything is working fine in android app.


    at the time of debugging i found very interesting thing, when the code size increases this issue happening a lot.

    Thank you
  • Pradeep,

    Do you have a sniffer capture of the following?

    1) A capture of a good discovery.
    2) A capture of a failing discovery.

    That way we can compare what's going on.
  • Sir i am using a CC2640r2f custom board, now i am programming this board using CC2650 launchpad debugger. processors.wiki.ti.com/.../BLE_sniffer_guide and www.ti.com/.../swru187g.pdf i found in both the link that i need to have a usb dongele for capturing the packet sniffer. but i do not have that dongle, is it possible to get sniffer without usb dongle

  • Pradeep,

    I recommend either getting the USB dongle to sniff this problem. It's useful for any part of BLE development in general as well.

    However, the USB Dongle has some limitations. It only supports certain BLE4.2 and BLE5 features. To get a sniffer that supports the full BLE4.2 and BLE5, I recommend looking at Elysis or Frontline or other sniffers.

    I recommend that you test your program on a CC2640R2F LaunchPad to isolate any issues you may be having with hardware out.

    If problems persist after testing on a LaunchPad, I can only give two guesses.
    1st guess, you may be running out of heap. You may want to look at the section in the stack users guide titled "debugging memory issues"
    software-dl.ti.com/.../ble-memory_problems.html

    2nd guess, you are blePending on a GATT procedure that's not being handled properly.

    Other than all the above, for now, without the sniffer capture, I can't help you more other than suggestion to look at that Apple Developers post I linked earlier on ATT MTU exchange.
  • Thank you sir, i'll purchase a sniffer and a CC2640R2f launchpad. in the mean time i'll look into the provided solution. The Apple Developer link which you have shared, we have already used that.
  • May you please suggest me whether i found correct product or not. i found these link related to sniffer, and i found that frontline ellisys sniffer are more costlier than the Ti BLE sniffer usb dongel . please correct me if i found wrong product and share me the link of those sniffer.
    Thank You
    www.mouser.in/.../
    www.ellisys.com/.../
    www.ti.com/.../cc2540emk-usb
    www.ellisys.com/.../
  • Pradeep,

    Yes, you've found the devices I'm referencing. I recommend that you do your own research as to which one you want, since they support a wide range of features. CC2540EMK is more limited than the FrontLine and Ellisys sniffers due to it's age. 

  • Thank you sir for your suggestion but i can not afford frontline or ellisys sniffer as these are too costly so i am going with cc2540emk-usb dongle. But i am in little doubt does  cc2540emk-usb dongle support BLE-4.2 as everywhere it is mentioned that it support BLE 4.0. And is it possible to make CC2640R2f launchpad as a ble sniffer

  • It is not possible to make the CC2640R2 a packet sniffer. Those are essentially your three options.

    In the mean time, what do you have your Max_PDU_Size predefined to? It could be that you are running out of heap maybe. It's a stretch, and I'll ask around for other input in the mean time though.
  • sorry for the late response sir initially the MAX_PDU_SIZE  was 69 and then i reduced it to 27 so right now MAX_PDU_SIZE is 27 and it can be upto 255 so i do not think this would  an issue