Reply
Posts: 25
Registered: ‎08-10-2017
Accepted Solution

Empty Example - Current Time caused Blue Gecko Stopped

[ Edited ]

I am using Simplicity Studio v4 and Bluetooth 2.4.1.0 with EFR 32 Blue Gecko Bluetooth Starter Kit SLWSTK6020B AND EFR32 BG1P232GG 1609C007FP0.

 

1) I followed page 15 of the qsg139-bluetooth-dev-simplicity-studio to create a new project based on Empty Example. It was built successfully, but when I touched “Current Time” I got a pop-up window “Unfortunately, Blue Gecko has stopped.” Please let me know the problem and how to fix it.

 

2) According to page 19 of the qsg139-bluetooth-dev-simplicity-studio, I suppose to be able to modify the value of the characteristic in the database following the example below: struct current_time_t current_time = {{{{2016,11,25,17,43,00},{5}},0},1}; gecko_cmd_gatt_server_write_attribute_value(gattdb_current_time, 0, sizeof(struct current_time_t), (uint8*)&current_time); however, I couldn’t find this statement anywhere in the project. Please let me know which file I should modify.

 

3) When I clicked on System ID, I saw a message highlighted in RED stated that “The problem occurred during characteristic parsing.” Please see attached and let me know what this message about and whether it can be fixed. Thanks.

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

Hello,

 

the empty example is "empty" as the name implies, it does not include any code to modify the time value. 

 

If you want to experiment with the time service, you need to copy-paste the code from qsq139 to the application. 

 

You can copy the time struct definitions in the beginning of main.c and try adding the following piece of code in the boot event handler:

 

  case gecko_evt_system_boot_id:
// added:
struct current_time_t current_time = {{{{2016,11,25,17,43,00},{5}},0},1};
gecko_cmd_gatt_server_write_attribute_value(gattdb_current_time, 0, sizeof(struct current_time_t),
(uint8*)&current_time); 
...

I just tried this with BGM121 and Blue Gecko app and it worked OK.

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

Regarding your question #3: I also tested adding the system ID characteristic to my GATT database and I was able to read it using Blue Gecko app. (The value is 0 because I haven't set it in my application code)

 

See attached screenshots:

bg_systemid.png

 

sysID.png

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

I followed your suggestion to the codes, please see attached main.c.  When I touched “Current Time” I still got a pop-up window “Unfortunately, Blue Gecko has stopped.”

 

Please review the attachments and advise.

 

Also from your screen shoot, you got the “Current Time Service”, but I only got the “Unknown Service” (see attached screen shoot from my Android device) and looked the same as qsg139-bluetooth-dev-simplicity-studio.  How can we get the title out like yours? 

 

Thanks.

 

 

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

I followed your screen shoot to set up my system_id to zero value.  Please see attached screen shot and still got the same result.

Please advise.

Thanks.

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

Can you attach your binary file so that I can test it myself using my phone? It could be that the application crashes on your phone for some reason or another.

 

The service is listed as unknown because the UUID value is some custom 128-bit value. The assigned value for time service is 1805. I guess you first created some new service in the GATT editor and then added the Current Time characteristic there? The UUID for new services is by default set to some random 128-bit value. If you drag&drop the whole Current Time Service from the Services tab in the editor then the UUID will be automatically set to 0x1805.

 

Alternatively, you can edit the current GATT database definition of yours and simply replace the long service UUID (4b660c72-c316-4919-b0a2-cb9496d1afc4) with value 1805.

 

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

I downloaded Blue Gecko 1.3 and 1.4 from https://www.silabs.com/support/resources.ct-software.p-microcontrollers.p-wireless?query=Blue Gecko and installed into my Android device.  I tried to send you both 1.3 and 1.4 versions of apks, but they are too large (see attached screen shot my-soc-empty zip too large.jpg).  Please download from the above web link directly.   I also attached my Android software information (Android Info.png).

 

I downloaded and installed Blue Gecko from Google Play Store to 3 difference Android devices.

 

They all crashed when I touched “Current Time” I still got a pop-up window “Unfortunately, Blue Gecko has stopped.”  You can try to install Blue Gecko from Play Store to see if the application crashes too.  

 

I changed my Simple Time Service's UUID to 1805, (please see attached screen shot my-soc-empty current_time UUID 1805.jpg), but I still see Unknown service UUID (4b66....).

 

You mentioned to change GATT database definition, but I could not find value 1805 or 4b66... to replace.   I also attached gatt_db.c and .h.

 

I also tried to use "Current Time Service" directly (see screen shot my-soc-empty current_time_service.jpg) , I got the same result with UUID 4b66 and crashed when clicked "Current Time".

 

Please advise.  Thanks.

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

I don't need the APK, when I was asking for the binary I was referring to the firmware that you load onto your development kit.

 

For example, if you are using the GNU toolchain then the binaries are placed in the project directory under a subfolder named GNU ARM v4.9.3 - Default. What I'm looking for is the binary (*.hex) so that I can load the same firmware onto my own kit and test if I see the same issue.

 

Can you also let me know the exact radio board ID that you are using for testing? The board ID can be checked from the PCB bottom side, it is printed there in format BRD4xxx Rev XX. (I'm talking about the small PCB that plugs into the development kit main board)

 

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped


advanchip wrote:

 

 

I changed my Simple Time Service's UUID to 1805, (please see attached screen shot my-soc-empty current_time UUID 1805.jpg), but I still see Unknown service UUID (4b66....).

 

 



 

Did you press the Generate button in the upper right corner of the GUI after modifying the GATT database? This step is needed if you do any modifications to the GATT (change service UUIDs, add services or remove services....)

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

Attached are my board ID picture, Empty Example hex and bin files.  I also included .isc and gatt_db.c file.  Also the screen shot of the new item Simple Time Service and the Android screen shot of Unknown Service and Blu Gecko crashed screen.

 

When I followed Section 5 The GATT Editor of psq139 to set up the new service, I didn’t see the “Simple Time Service” as in isc (attached my-soc-empty_4 simple_time_service.jpg) instead I saw the “Unknown Service” in Android screen (attached Android Screenshot_2017-08-16 Unknown.png) and when I touched “Current Time” I got a pop-up window “Unfortunately, Blue Gecko has stopped.” (attached Android Screenshot_2017-08-16 Crash.png).  The binary file of this project is attached.

 

However, If I just copied the Current Time Service, it worked nicely.

 

Since no hex file extension is allowed to be attached (see attached No Hex file allowed.jpg) , please change "No Hex file allowed.hqx" to "No Hex file allowed.hex".

 

Please help me set up the new items.  Thanks.

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

There seems to be some issue with the Blue Gecko application. I tried your binary on my kit and the app crashed when I read the current time value.

 

I then tested on the same phone but different app (BLE Scanner) and I was able to read the value without any problems. The returned 10-byte value was e1070810082800030001 which corresponds to "Wed 16 Aug 2017, 08:40".

 

I also tested connecting with the BLED112 dongle and reading the current time characteristic with the PC test program (BLE GUI) worked fine, so this must be an issue in the Blue Gecko app.

 

What is strange is that my own test project seems to be exactly the same as yours (in terms of the time service) but I don't see any crashes when testing against that version.

Posts: 16
Registered: ‎08-02-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

Hi,

Sorry for the intrusion.

But how you do you know that hexadecimal value is that date?

Thank you

Highlighted
Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

I am not clear about your question:  

I added the following statement in Main. c line 145 for current time

struct current_time_t current_time = {{{{2017,8,16,8,40,00},{3}},0},1};

Posts: 16
Registered: ‎08-02-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

Thank you. I already understand. Sorry for the inconvenience.

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

[ Edited ]

anotherone wrote:

Hi,

Sorry for the intrusion.

 


No worries, the forum is intended for open discussion and not just point-to-point dialog.

 

Just to let other users know how the data is decoded:

e1070810082800030001 

 

the two first bytes are the year (little endian) and then there's one byte for month,day,hours,minutes,seconds,day of week,fractions, adjustment reason. Total 10 bytes.

 

Decoding the above data, 

year = 0x07e1 = 2017,

month = 08,

day = 0x10 = 16,

etc...

 

 

 

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

This solved my System ID problem by increasing the length in .isc.  I want to know which file has the codes, please let me know the file name.  Thanks

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped


advanchip wrote:

This solved my System ID problem by increasing the length in .isc.  I want to know which file has the codes, please let me know the file name.  Thanks


I don't understand what you are saying here.

 

Did you manually edit the *.isc file? That is not how it is supposed to work, if you need to change the size of a characteristic then that should be done in the BLE GATT Editor GUI and then pressing Generate button in the GUI will create new *.isc file.

 

And please clarify which "codes" you are referring to?

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

When I created a new project, the system_id default's length is 6 (see attached my-soc-empty system_id_length6.jpg), I saw "The problem occurred during characteristic parsing" in Android app  (see attached empty example System ID.jpg).  After I changed the system_id's length to 12 (see attached my-soc-empty system_id_length12.jpg), it fixed the problem. 

 

I want to know which file(s) has/have been changed, gatt_db.c or other files?  

 

Thanks. 

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

The correct length of the system ID characteristic (UUID 2A23) is 8 bytes (64 bits). Reference:

https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.s...

 

I tried this using BLE SDK 2.4.2 and latest version of Studio. The GATT editor sets system ID length to 8, see attached screenshot: 

systemid.png

 

Only modification I have made manually is defining the value (123456....), marked with red color in the image. 

 

When you press the Generate button in the upper right corner, the following files are (re)generated for you:

gatt.xml

gatt_db.h

gatt_db.c

 

The gatt_db.* files are used as input to the C compiler when building your project. The XML file is basically just informative, it is an intermediate step that is used when creating the gatt_db.h/c files.

 

You are not supposed to touch any of the source files manually using text editor. All changes to the GATT should be made using the GUI.

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

I have Bluetooth SDK 2.4.2.0, The GATT editor defaults system ID length to 6, see attached screenshot.  I wonder if my Bluetooth SDK 2.4.2.0 is same as yours, since we have too many differences.  Do you know how to verify?  Thanks

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

The behavior seems to depend on what project you are using as starting point. I used the soc-Smartphone in my tests and it works fine. You used the soc-empty in which case the length is not correct.  We were able to reproduce this in our own tests and it is filed internally as a bug.

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

I'm glad you found the bug.  I can repeat what you said with soc-smartphone project.  Now I saw that there are a lot more files in soc-smartphone than in soc-empty, please see two attached files.  Do you know any document to describe what these files and folders for?  Also do you know any document to tell me when to add codes into main.c such as PACKSTRUCT for current_time, etc.?

 

 

 

Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

We don't have documentation that explains each file or folder one by one. The SoC Empty is a minimal template that is easier to follow, if you look into the files and folders it should be not too hard to figure out what is the purpose of those.

 

The smartphone app is a bit more complicated example and it includes lot of files that are related to the example functionality (like reading the temperature sensor).

 

Below are some recommendations for further reading:

https://www.silabs.com/documents/login/user-guides/ug136-ble-c-soc-dev-guide.pdf
https://www.silabs.com/documents/login/user-guides/ug103-14-fundamentals-ble.pdf
https://www.silabs.com/documents/login/quick-start-guides/qsg108-bluetooth-software-getting-started....

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

You said "The smartphone app is a bit more complicated example and it includes lot of files that are related to the example functionality (like reading the temperature sensor)." Would you please let me know all the functions that are included in the smartphone app so that I can check them out one-by-one. Thanks.
Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

The smartphone app main loop is in file app.c.

 

The demo has following features:

beaconing -> see advertisement.c, beacon.c

Health Thermometer -> htm.c

Immediate Alert service -> ia.c

 

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

Do all the Profiles and Services have their own .c files? Where can I find them? For example: If I want to use Automation IO, do I need to create my own .c file or the .c file is already available like Immediate Alert service -> ia.c. Please advise. Thanks.
Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped


advanchip wrote:
Do all the Profiles and Services have their own .c files? 

No, we don't have sample implementation for all profiles/services. For the automation I/O service you would need to write your own code.

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

For both soc-smartphone and soc-empty only have one way communication from the device to the mobile phone, do you have any example that the device has both transmit (Tx) and Received (Rx) capabilities to/from mobile devices? If not, please advise how to send request to the device from the mobile phone. Thanks.
Posts: 2,674
Registered: ‎09-01-2015

Re: Empty Example - Current Time caused Blue Gecko Stopped

The smartphone app does feature two way communication between the device and mobile phone. The Immediate Alert service allows the phone to write alert level characteristic. The LED status on the kit changes depending on what value was written by the phone.

 

see following piece of code in app.c that handles the write request from phone:

app.c ->

    /* Value of attribute changed from the local database by remote GATT client */
    case gecko_evt_gatt_server_attribute_value_id:
      /* Check if changed characteristic is the Immediate Alert level */
      if ( gattdb_alert_level == evt->data.evt_gatt_server_attribute_value.attribute) {
        /* Write the Immediate Alert level value */
        iaImmediateAlertWrite(&evt->data.evt_gatt_server_attribute_value.value);
      }
      break;

The function iaImmediateAlertWrite implementation is found in file ia.c.

 

Another more generic example of two-way communication can be found in this knowledge base article:

http://community.silabs.com/t5/Bluetooth-Wi-Fi-Knowledge-Base/SPP-over-BLE-C-example-for-BGMxxx/ta-p...

 

 

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

For soc-SmartPhone example, I changed the device name to aio Smart, but
Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

For soc-SmartPhone example, I changed the device name to aio Smart, but
Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

For soc-SmartPhone example, I changed the device name to aio Smart, but the Android still showed BG63565rt, not Aio Smart. I have changed the device name in soc-empty few times and it worked fine. Is this a bug?
Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

For soc-SmartPhone example, I changed the device name to aio Smart, but the Android still showed BG63565rt, not Aio Smart. I have changed the device name in soc-empty few times and it worked fine. Is this a bug?
Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

For soc-SmartPhone example, I changed the device name to aio Smart, but the Android still showed BG63565rt, not Aio Smart. I have changed the device name in soc-empty few times and it worked fine. Is this a bug?
Posts: 27
Registered: ‎06-26-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

Hi advanchip,

 

In the soc-smartphone application there is a feature that creates unique name to the device and name is based on the device id. In your case the unique name is overwriting the name you set in the Visual GATT editor. If you want to set your own name you can modify the example code and disable name overwriting. The feature is found at app.c file and inside the appInit function. This is the command used to write the new name to the device.

gecko_cmd_gatt_server_write_attribute_value(gattdb_device_name,
0,
strlen(devName),
(uint8_t *)devName);
Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

I verified your statement "The Immediate Alert service allows the phone to write alert level characteristic. The LED status on the kit changes depending on what value was written by the phone." and it worked perfectly by using the "Blue Gecko" that I downloaded from the Play Store. Then I generated the attached .apk file from the "Bluegecko-android-master.zip", the LED statue is always at "No Alert", that means no blinking on Mild Alert and High Alert. I wonder if I got the same Android source codes as the one generated the apk file from the Play Store. Thanks
Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

I downloaded the attached Bluegecko-android-master.zip from your website to generate the attached mobile-debug.apk (mobile-debug.zip) and loaded into my Android device, the Immediate Alert service can't turn on the LED on the module.  

 

When I installed the Blue Gecko from the Play Store version 1.4.1 Updated on Jun 22, 2017 into the same Android devicethe Immediate Alert service works fine.

 

Please let me know where to get the Android source codes that works as the Play Store one.  I really need to learn the two ways communication and desperately need your help.

Posts: 25
Registered: ‎08-10-2017

Re: Empty Example - Current Time caused Blue Gecko Stopped

Never mind.  I found the latest version and it works now.  Thanks.