How to communicate with Cypress BLE device runnning UART_to_BLE_Central project using iOS Objective-C code?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
rotu_3236376
Level 3
Level 3
First like received

Hello -

I have a device with a Cypress semiconductor that is running the UART_to_BLE_Central project. I am trying to connect to this device using Bluetooth4 BLE protocols.  This one: CY5670 http://www.cypress.com/documentation/development-kitsboards/cy5670-cysmart-usb-dongle

I am able to successfully connect to the device using Android Java code but not on iOS.  On iOS I am not able to advertise manufacturing data in the way the PSoC code wants it.  I think this is likely the issue. 

Do you know if it is required to satisfy this condiction in the Central project code in order to connect?

File: app_Ble.c

case CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT:

           

            advReport = (CYBLE_GAPC_ADV_REPORT_T *) eventParam;

           

            /* check if report has manfacturing data corresponding to the intended matching peer */

            if((advReport->eventType == CYBLE_GAPC_SCAN_RSP) && (advReport->dataLen == 0x06) \

                    && (advReport->data[1] == 0xff) && (advReport->data[2] == 0x31)  \

                    && (advReport->data[3] == 0x01) && (advReport->data[4] == 0x3b) \

                    && (advReport->data[5] == 0x04))

            {

                peerDeviceFound = true;

               

                memcpy(peerAddr.bdAddr, advReport->peerBdAddr, sizeof(peerAddr.bdAddr));

                peerAddr.type = advReport->peerAddrType;

               

                #ifdef PRINT_MESSAGE_LOG  

                    UART_UartPutString("\n\r\n\rServer with matching custom service discovered...");

                #endif

            }          

           

            break;   

Any insights would be very much appreciated.

Thanks,

Rohan

0 Likes
1 Solution

Hi Rohan,

   If the iOS is not sending the Manufacture data as a part of scan response data then this is surely a issue with iOS. Have you also confirmed the scan response data send by iOS in sniffer logs  which contains only the device name as you said?

-Gyan

View solution in original post

7 Replies
GyanC_36
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Hi Rohan,

   In this PSoC BLE Central project , the scan response data is compared in order to filter a specific peripheral device. This is not a mandatory condition to make  a BLE connection. To establish a BLE connection you just need Bluetooth address of your peripheral device.

-Gyan

0 Likes

Hi Gyan-

Thank you for your response. But in this scenario my mobile phone is acting as the peripheral. And the device Id is constantly changing.  So I think this might be the reason I cannot connect with the Bluetooth address.

Perhaps, I can try to have the peripheral initiate the connection to the central when in range by the Central Bluetooth address?

0 Likes

A peripheral device can not initiate the connection. Only a central device can initiate a connection.

How frequently the peripheral address is changing? The central device should able to connect even if the peripheral is changing the address.

-Gyan

0 Likes

The problem is the Central code is already written on the firmware built in the device. And over 100,000 units have already been ordered. So there is no way for me to change the Central code.  I can only change the Peripheral code running on the mobile phone.

I was able to complete this successfully on Android but not able to do this with iOS.  The only difference I can  visibily notice is what is inside the Scan Response Data.  On iOS, the scan response only contains the Device name. But in Android, the Scan Response Data has the Device name and Manufacturer Data which I set to Cypress (company id = 305 per Bluetooth spec).  Apple limits this capability and I feel this is the reason my connection is not being made.

Using my BLE Sniffer I do see Scan Request and Responses going back and forth but there is no connection being made.  Even though I am able to connect use other apps such as NRF Connect mobile app for testing. 

If there is anything I am missing or have not tried please let me know. But at this point I am starting to think this is just a limitation on the Apple side.

-Rohan

0 Likes

Hi Rohan,

   If the iOS is not sending the Manufacture data as a part of scan response data then this is surely a issue with iOS. Have you also confirmed the scan response data send by iOS in sniffer logs  which contains only the device name as you said?

-Gyan

Hi Gyan-

Yes. I confirmed that I do see the Device name in the Scan Response Data from the iOS app.  But the manufacturer data is not there.   Someone from Cypress did say that it is not required to use Manufacturer data for connections as it only filters down the peers so it should still work.  But I am not sure if that is the case as I am not seeing any proof of that.  The project I am working with is the sample code from Cypress UART-to-BLE Central.
EZ-BLE_PRoC_Module/Example_projects/UART_to_BLE/UART_to_BLE_central at master · cypresssemiconductor...

-Rohan

0 Likes

Hi Rohan,

    The project you are using, filters the peripheral device based on manufacturer data. That is why, you are facing this problem. Otherwise for connection, you just need the BD address of your peripheral device.

-Gyan

0 Likes