Community news, upcoming events and general discussions
Threads: 31 Posts: 79
Get technical support from the community
Threads: 1009 Posts: 5548
Threads: 15 Posts: 54
Tell us how to make XDK better!
Threads: 35 Posts: 117
Share and discuss community member projects
Threads: 46 Posts: 226
atm I am working on a XDK testenvironment to send sensor data (internal and external) via BLE to a smartphone. The sensor data is no problem, the pin configuration for the XDK expansion module works just fine.
For my first steps with XDK and BLE I used the ,,BLE Guide XDK110''. The implementation compiles (workbench 1.7.0), but when I use a BLE scanner tool for my smartphone two problems appear:
1) the discovering services process takes realy realy long
2) when I send a read request (via my BLE tool, I'm testing three of them) no data comes out of the XDK into my smartphone or the other way round.
Has anyone an idea where the problem is or how it can be solved?
Thanks in advance,
Hi Markus, can you please provide the following pieces of information to us so that we can help you more conveniently: - which type of mobile device are you using (iOS / Android)? - could you give us your test results when using the iOS app CZBLEControl ? - how are you planning to process the sensor data on your smartphone? I guess you will write your own BLE app, right? Kind regards, Manuel
thanks for your reply. I am using an Andriod device, unfortunately i have no iOS device for testing purposes (though i cannot show what CZBLEControl returns).
I am planning to on the one hand display data from an external sensor, read in by the GPIO ports an on the other hand also send data onto the XDK for controlling GPIO ports.
I am testing with BLE Scanner, B-BLE and nRF Connect (all Android versions), the error that I get is the ,,discovering services'' task taking for a long long time. In fact I cannot say if it terminates after some time.
You are right, I am planning to write my own BLE app, not really more than the i/o stuff.
When I am using the VirtualXDK program and augment that one by my own services with their own UUIDs it works. But nevertheless I wanted a clean solution, this one is something like a workaround (-;
Hello Markus, unfortunately I can not comment directly on your isssue because I need to reproduce it with an android device. I will come back to you early next week. In the meantime I need to ask for your patience. Kind regards, Manuel
Hello Markus, we were now able to re-verify the XDK BLE Guide in combination with an android device and found that it is working. Could you please check the following steps on your side: 1) Install "BLE Checker" on your android device to identify if your device is supporting BLE (BT 4.0 and higher needed) > to get the app see the screenshot of the app store (see picture App Store BLE Apps) or directly here > after enabling BT and starting this app you should see the text "BLE wird unterstuetzt"(BLE is supported) as shown in the picture BLE Checker. which means that your device is supporting BLE and you are good to go to proceed with the next steps (otherwise repeat this test or check the device specifications until you've found the right device) 2) Flash the code as given in the several code extracts documented in the XDK Guide Bluetooth onto your XDK device and let it reboot (if you've already successfully flashed the code try to turn off/on your XDK via USB if you are facing problems at the third step) 3) Install "BLE Scanner" on your android device to perform basic BLE interactions with the XDK like writing to it and enabling notifications to receive data from it which are the two basic operations also explained in the XDK BLE guide using the Alpwise Data Exchange Service > to get the app see the screenshot of the app store (see picture App Store BLE Apps) or directly here > after enabling BT and starting this app you should see discoverable & connectable BLE devices > check the list for a BLE device called "BLE Tutorial" and connect to it (see picture BLE Scanner 1) > now you should see the services available on the XDK (see picture BLE Scanner 2) > scroll down to the custom service starting with the UUID "00005301-...." which is representing the Alpwise Data Exchange Service running on the XDK > hit "N" at the custom characteristic starting with "00005303-...." to enable notifications in order to receive cyclic data from the XDK > you should see the "N" lighting up followed by the message "Hello!" printed at "Value: " always presenting the latest value received from the XDK (see picture BLE Scanner 3) Please share your observations regarding the three steps shown above with us so we can further help you in your development process and progress. Kind regards, Manuel
Thanks Manuel for your Answer.
My Phone does support BLE, I used it and BLE Checker confirmed that (-:
In the meantime I have worked around my problem by adopting the demoVirtualXDK and the BLE support there. Now it works, I can send external sensor data via BLE to my smartphone and send data the other way round. But the problem with the BLE example still bothers me.
Hi Markus, I am glad to hear that things worked out for you. Nevertheless we would still like to further understand how you experience an issue with the BLE example. Did the steps above not work out for you with the Android BLE test app BLE Scanner? Kind regards, Manuel
I'm sad to tell you, that the hints above did not solve my problem \-:
The BLE scanner told me, that my phone is BLE ready () but nevertheless there was no communication inbetween my phone and a XDK.
Imho the problem is in the service broadcast, it takes maybe forever to find the services, after some 5 minutes I am usually cancelling the connection attempt.
Hi Markus, unfortunately I cannot reproduce your issue in my workbench bench, because the combination of BLE XDK Guide code and BLE Scanner work perfectly fine on my side. We should further investigate step 2) from my hints above just to make sure that the correct application is flashed on the XDK. I would ask to post your E-Mail address in here so that I can contact you to send me your XDK project as a zip-file. Kind regards, Manuel
my eMail Adress is noOne.isInterested@anymore.com.
I'm really really glad for you to help me!
Hello community users, I contacted Markus and already received the project files. I will l keep everybody posted about the progress in this thread. Kind regards, Manuel
Hi everybody, after a very detailled analysis of the code I can suggest 2 steps to get this issue solved: 1) Getting the XDK to be visible as BLE device by removing failing assertions: some of the assert code lines where the return status of the methods being called are compared to return codes are causing some problems in a way that the program will stop working since the assertion or "assumption" is not correct (e.g. because BLE status return value is dependent on user interaction to be of the kind "BLE_SUCCESS" like in a line
//assert(bleSendReturn == BLE_SUCCESS);
-> it means that the issue here is assuming that bleSendReturn should return always BLE_SUCCESS and if not the program shall stop execution, which it does as the default behaviour at the beginning of the code execution since „Hello!“ will not have been sent until the app connects to the XDK and enables notifications Here's an overview of the assertions to be removed to get the basic BLE functionality (discoverable BLE device) working: 1: bleStatus = BLE_customServiceRegistry(bleAppServiceRegister); // assert(bleStatus == BLE_SUCCESS);
bleStatus = BLE_customServiceRegistry(bleAppServiceRegister); // assert(bleStatus == BLE_SUCCESS);
2: appInitReturn = BLE_coreStackInit(); // assert(appInitReturn == BLE_SUCCESS);
appInitReturn = BLE_coreStackInit(); // assert(appInitReturn == BLE_SUCCESS);
3: bleSendReturn = BLE_sendData ((uint8_t *) "Hello!", sizeof("Hello!")); // assert(bleSendReturn == BLE_SUCCESS); // bleSendReturn will be 0 initially
bleSendReturn = BLE_sendData ((uint8_t *) "Hello!", sizeof("Hello!")); // assert(bleSendReturn == BLE_SUCCESS); // bleSendReturn will be 0 initially
2) Publishing available BLE data as services and characteristics in the XDK device by setting the visibility of one of the class function to static: I could see this issue that calling a method "void bleAlpwDataExchangeService(...);" in a line serviceRegistryStatus = BLEALPWDATAEXCHANGE_SERVER_Register( bleAlpwDataExchangeService); with the function prototype in the header like "void bleAlpwDataExchangeService(...);" would lead to the problem that the linker (the process of joining together all the project class files done by the IDE after compiling the class files individually) finds another function in the rest of the included XDK libraries with the name "bleAlpwDataExchangeService" and refers to that one instead of the one in the given "BTLE_Test.c" class file
serviceRegistryStatus = BLEALPWDATAEXCHANGE_SERVER_Register( bleAlpwDataExchangeService);
-> by adding "static" into the header file so that the function prototype looks like this "static void bleAlpwDataExchangeService(...);" we can tell the linker that only the function in the class file shall be used when refered to that function name. Hope this will help out! Kind regards, Manuel