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.

CC2640R2F: Can CC2640R2 Bluetooth search any mobile phone's Bluetooth?

Part Number: CC2640R2F

Hi,

I am learning to use the Bluetooth function of CC2640R2. I follow the board CC2640R2 SDK 2.40.00.32 of SimpleLink-Academy 2.40.03.00. There is a Bluetooth 4.2 tutor to show GAP and GATT service. However, I have problems:

1. I use the simple_central project as a master to scan other Bluetooth devices. I can only find the other board which is download simple_peripheral project. However, I want to use the board CC2640R2 to scan mobile phone's Bluetooth and connect to a mobile phone, then give data to mobile phone. Do you know whether this board can do it or not? What sort of protocol and policy I should use to setup the program code for the CC2640R2? Take I-phone 7+ as an example, I want the board to scan I-phone 7+ Bluetooth and initiate the connect to the phone.

2. The Academy teaches the custom profile of GATT service, but I can not find the tutor for the GATT client. I think the Host_test and simple_central projects include the GATT client program, but there is no tutor to explain their code. I want to modify the simple_central project to receive data from GATT service (simple_peripheral) and display data through the UART COM to the computer. Do you have any suggestion that which tutor I can learn it?

Thank you very much.

  • 1. Yes, you can use simple_central (remember to set DEFAULT_DEV_DISC_BY_SVC_UUID as FALSE) to scan/connect to iPhone 7 act as BLE peripheral or other BLE peripherals.
    2. I am not aware TI provide tutorial for GATT client. I suggest you to study simple_central and HostTest.
  • Hi,
    For the second item, you can refer to the Simple Serial Socket example on github.com/.../ble_examples. It implements a more generic service discovery.
  • Hi,

    I am a stranger of TI development board. Try to understand.

    1. I can not scan any mobile phone with simple_central so far. Is this because I have not set DEFAULT_DEV_DISC_BY_SVC_UUID as FALSE ? What function I should use to set this variable? GAP_SetParamValue() ? or GAPCentralRole_SetParameter()?

    2. the simple_central code is too much to find how to read and write to the GATT service. Could you give me an example? In simple_peripheral, there are 5 characteristics. I want to use simple_central to read a value from char2 and also write a value to char1. What does the code looks like?
  • 1. Yes, that should be the reason. You can change DEFAULT_DEV_DISC_BY_SVC_UUID define to FALSE to make it work.
    2. You can refer to "case GATT_RW:..." in SimpleCentral_handleKeys which show you how to do GATT read/write.
  • Hi, YiKai,

    1. I try to change DEFAULT_DEV_DISC_BY_SVC_UUID define to false, but I still can not search any mobile phones' BLE. The I-Phone 7's Bluetooth can be scan by other phones but not my simple_central program. However, a good news is that the simple_central can scan Project_Zero so far. When DEFAULT_DEV_DISC_BY_SVC_UUID was TRUE, it could only find simple_peripheral. Do you know anything else I need to set up?

    2. Thanks for your help I will try to learn the simple_central. I will open new questions when I can not understand it.

    Regards,
    Robert
  • DEFAULT_DEV_DISC_BY_SVC_UUID Should be the only needed change.
  • Robert,
    In order to find your phone with Simple Central, the phone must be actively advertising which can only be enabled in an App (i.e. LightBlue) by setting it up as a peripheral device.
  • HI, Joakim,

    I think you are right. I need set mobile phone to advertising. I will try that. I also try using the simple_central to search an android phone. I download a software to advertising the phone BLE, but my simple_central board still can not scan the phone. Do you know which app is good for Android phone setting advertisement?

    Regards, Robert
  • Hi, Yikai,

    Do you think I should pay attention to the address of I-phone BLE? The Simple_central scans diveices with addresses and UUIDs. I can disable the UUID recognition, but the address is the main point for scan and connection. I think the I-phone may advertise address which is different from the MAC address. Maybe, I just cannot find the correct address. Do you have knowledge about this?

    Regards, Robert
  • HI, Joakim,

    I think you are right. I need set mobile phone to advertising. I will try that. I also try using the simple_central to search an android phone. I download a software to advertising the phone BLE, but my simple_central board still can not scan the phone. Do you know which app is good for Android phone setting advertisement?

    Regards, Robert
  • Hi, Joakim,

    This is too much and complicated to me. I do not know how long I can finish that.
  • I try this with my iPhone 7 plus (running iOS 12.1.4) and I can see simple_central scan my iPhone 7and connect to it.
  • Hi, YiKai,

    Could you tell me how do you know you can see your I-phone from simple_central? When I use simple_central to scan, I can only see the Mac address. I can not find the BLE MAC address of my I-phone from the simple_central.

    Regards, Robert
  • Hi, Joakim,

    I try to use LightBlue to set my I-phone to do the advertisement, but my simple_central still can not scan out the I-phone BLE MAC address. I think I still can not use simple_central to scan and connect to my I-phone. I also try other phones. None of them can be found by simple_central.

    Regards, Robert
  • I use lightblue app on iphone to simulate BLE peripheral and test this in a shielding room. Since iPhone would use virtual BLE address, it’s difficult to know exact BLE address when using iPhone as BLE peripheral. So, you should test this in shielding room or find somewhere that no other BLE device would interfere your test and you can know that is the only one doing BLE advertising for connection from your iPhone.
  • Hi, YiKai,

    I give it up. I can not find any shield room. Maybe the environment is too noisy to find I-phone BLE. I do not know the I-phone will change the virtual address or not in next connection or in next power cycle. Thank you for your help.

    Regards,
    Robert