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.
Tool/software: Code Composer Studio
Hello, i have to send data from CC2652RB LP to android enabled smartphone. For this i am using project zero example code. I have successfully followed this tutorial dev.ti.com/.../ble_01_basic.html and verified data transfer from Smartphone (BLE Scanner android application) to launchpad with the first characteristic in the last service (UUID starts with F0001131), this is the data service. This characteristic is for reading/writing a long string. However when i am selecting write and when i write some string data in android application, i am able to see that data into the serial port of the launchpad connected with PC. But i want to do the oppossite, i want to send data from serial port of launchpad to android mobile. To be more specific i mean to say that i want to write data into the serial port of LP and then read it in android app i.e. BLE scanner.
You can refer to Task 3 - Get Notified in tutorial dev.ti.com/.../ble_01_basic.html to use notification to send char or string to Andriod App.
Task 3 is for Btool , but i am using mobile device. However that is button state, whereas i am using the last service with characteristic (UUID starts with F0001131) i.e. the data service. How can i enable notifications for the data service as the service corresponding to data in BLE scanner app doesn't have N (notification enable feature in the UI) whereas button service has it.
Thanks,
Shivam
If you check 4th custom characteristic in CUSTOM SERVICE of BLE Scanner, you will see a "N" icon. After you click on the "N" icon, it would enable notification.
You mean the 4th custom service or the custom service with F0001130 uuid. Yes both of them have "N". But how do i read the data from serial port in the android app, when i am trying to write anything it doesn't get written on the serial port.
However when i write it on android app UI, it goes to serial port after i perform Write operation by clicking 'W'.
Notification means device would send characteristic to Andriod App. For printing it on Android, it’s out of topic of this E2E forum and I suppose you have to do it by yourself.
NO, No it is not out of topic of this E2E forum. Every time you are saying the same thing.
It is not about printing on android. Its about reading from, how and what notification it is sending.
First of all there is no 4th custom characteristic in any of the service in BLE scanner.
My question is suppose i want to read char string from LP using string char/stream char of data service, then how will that string char/stream char be passed in project zero code? To be specific how can i verify data service of project zero from LP to android smartphone as i am able to do it from android smartphone to LP but not vice-versa?
Please help me i am really stuck.
HI please refer the screenshots below, these are from project zero link
I want to enable notifications and update them without input from mobile device. Please see it in the attached image. I have circled the concerned portion.
Also tell me if i am on right track to send large amount of data from LP to Android app.
Hi,
I think using the notifications is the proper way to solve your issue.
You can follow the SimpleLink Academy labs you have found.
Let me know if you have more questions.
Regards,
Okay, can you tell me one thing how can i write or change values of a characteristic from the LP side (i.e. the peripheral side) after i enable the notifications.
Thanks in advance
Thanks YK for your response.
Further, i am following bluetooth low energy custom profile of this link http://software-dl.ti.com/lprf/simplelink_academy/modules/ble_01_custom_profile/ble_01_custom_profile.html.
In this for completing steps 4 & 5 of task 2, where i have to add the SunlightService_AddService(); in the ProjectZero_init() section. Do i have to add the full generated appsnippets.c file in the project or only the code part of appsnippets.c in the ProjectZero_init() section or i just have to add the SunlightService_AddService(); along with other services as shown in the attachment.
Please help me i am just a beginner.
Yes that's what i am asking, do i have to copy the whole code or just the line SunlightService_AddService();along with other services in the initialization section in projectzero.c . Please see the steps 4&5 of task2 in Bluetooth custom profile in this link software-dl.ti.com/.../ble_01_custom_profile.html How to implement these steps, is not given clearly in the tutorial.
Thanks for the link YK. The steps 4 & 5 are almost same for both the links. Can you please elaborate how to complete these steps as i am unable to find the service initialization segment of ProjectZero_init() and
Insert the SunlightService_AddService(...);
snippet from the application-snippets.c under Example service generator there.
My question is what part of code i have to insert and where exactly?
Please help me.
I usually do this manually and don't use Example service generator. I suggest you to following task 1 to 6 to make this work.
That is okay YK, i got it but my question is different. I am following task 1 to 6 only. I am just asking where in the code of project zero.c i have to insert the sunlighService_addservice(); from appsnippets.c and how much i have to add there?
According to task 1, you can create sunlightService.c and sunlightService.h files in your project_zero and copy the source codes provide in task 1 to those two files. Then, added code by searching for SOLUTION in the project_zero tab to add related code into project_zero.c.
Okay, i got it. What about the step 5 in task 2?
How to implement it? Where exactly it is to be inserted?
Thanks for your help YK.
After adding the code blocks in Solution , i am getting the errors as shown in the attached image. Please let me know how to remove them as when i am including the #include "sunlightService.h" , i am getting an error that unable to open the file. I have created the sunlightService.h & sunlightService.c file in service folder in the application folder of the sunlightperipheral project.
1. You don't define SUNLIGHTSERVICE_SUNLIGHTVALUE_ID/SUNLIGHTSERVICE_SUNLIGHTVALUE_LEN/SUNLIGHTSERVICE_UPDATEPERIOD_ID/SUNLIGHTSERVICE_UPDATEPERIOD_LEN in sunlightService.h
2. You miss adding the following lines to your project_zero.c.
+// SOLUTION: Sunlight Service callback handler. +// The type Data_ServiceCBs_t is defined in sunlightService.h +static sunlightServiceCBs_t ProjectZero_Sunlight_ServiceCBs = { + .pfnChangeCb = sunCharChanged, + .pfnCfgChangeCb = NULL +};
I suggest you to read the SimpleLink more carefully to get every step done.
Dear YK,
Many Thanks for your suggestion, but i have added the code part in my project_zero.c that you have mentioned above in your reply. Please see the attached images and the code file for my project_zero.c.
I am reading the simplelink tutorial very carefully, but somehow i feel that the simple link platform is not clearly explained so that it can be completed without confusions.
That's why i am seeking your help. I want to use this BLE feature of Simplelink controllers in my project.
I tried the steps and I can build the task without problem. I attach my sunlightService.c, sunlightService.h, and project_zero.c for your reference.
You can directly create sunlightservice.h & sunlightservice.c in the application folder
Add "SunlightService_AddService( selfEntity ); // SOLUTION" right after the line "DataService_AddService(selfEntity);" in ProjectZero_init().
Okay Thanks and what about the 6th step in the shown image, there is no application/services directory in my project as i have added the sunlightservice.c and sunlightservice.h directly in the application folder of the project. Do i need to add this path in the include options as its already added as shown in the second attached image.
If you added the sunlightservice.c and sunlightservice.h directly in the application folder of the project, you don't have to do this step.
Yes , when i am downloading the program in my device, the service is not visible. The service will be shown by the name of sunlightservice right?
Though i am getting 5 services after scan and connection.
What BLE central do you use to scan and connect to the project_zero with sunlightservice?
I am using the BLE scanner android application in an android smartphone as the ble central.
Sometimes smartphone BLE driver would cache the information so you can try to turn off BLE and turn on BLE again or restart your smartphone to clear cache to try again.
Yes YK, i tried this by manually clearing the BLE scanner's cache myself. But still it's not working. Can you tell me one thing after downloading the program onto the LP, i will get service by the name of sunlighservice right?
Please see the screenshot of my result and let me know whether its right? I am also facing one more issue, after some time the LP becomes undiscoverable in the BLE scanner app and it becomes available again when i download the program again onto the launchpad. Why is this problem, do i have to download the program every time when i have to connect with the smartphone?
It looks correct. My screenshot is from iOS and it might be different to Android system. Before you download project_zero to test it, do you also download BIM into your launchpad?