Notifications sometimes not sending in hello_sensor sample

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

cross mob
Anonymous
Not applicable

So I finally got everything up and running on my eval board, connecting with the included BLE USB dongle.

Trying the hello_sensor app with HelloClient x64, I am able to receive notifications when I press the big white button.

However, after I press it about 12-15 times, the notifications stop sending. I have to press "Read" to send a read request to get the new value, and the notifications start sending again. For about 12-15 times. Then they stop again and I have to "Read" again before they work. Rinse, Repeat.

I know the button is working, because when I click "Read", the number changes to the number of times I pressed the button in between the notifications stopping.

Is anyone else getting this same problem? Setting to Indications doesn't help.

Notifications in iOS

On a related note, notifications don't work at all in iOS. I wrote an iOS app to subscribe to the Hello Input notifications. The iPad connects to the device, retrieves the services, and subscribes to the Hello Input notifications all without error. However, I never receive notifications when I press the button. Perhaps this is related?

Is there a setting to improve the robustness of the notifications? Perhaps a longer timeout interval or connection interval or something? The same iOS code works with a Bluegiga BLE112 perfectly, as well as the RedBearLabs BLE Mini (Nordic chip), so I'm wondering if there's some setting on the WICED firmware that I need to change to get it to respond to notifications.

Thanks!

0 Likes
1 Solution

Thank you for collecting the trace.  There is nothing happening on the sensor side.  What device are you using on the host side.  My best guess is that there is something wrong there.  For example if this is a USB device it can somehow go into a selective suspend and due to the crappy radio or USB hub or system design it does not wake on the packet received over the air.  To prove that I am wrong, can you get your machine in to the state where it does not receive notifications from the sensor.  Open Bluetooth settings and modify Allow Bluetooth device to find this computer.  Click on Apply.  Change it back and click on Apply again.  This will not talk to the hello sensor, but will wake the USB interface.  See if you can receive notifications from the sensor.

View solution in original post

0 Likes
5 Replies
VictorZ_46
Employee
Employee
5 comments on blog 25 sign-ins 250 likes received

Hello,

We have not heard about any issues with Hello Sensor or Hello Client Windows apps.  Do you think you can collect some traces.  Over the air would be fine, but if you can get traces from the tag as described in the quick start guide, it would be perfect. We can also provide you with a Windows trace tool so that you can see what is happening.

iOS notifications also work fine.  Maybe you can try to download LightBlue application and check it out.

Thanks!

0 Likes
Anonymous
Not applicable

Hi Victor, here are the traces from hello_sensor (using Putty). I've bolded the approximate positions where I stopped receiving notifications and had to press "Read" in HelloClient to get them to work again. Not sure if this will be totally helpful - I'll try adding some more debug prints in there.

hello_sensor_timeout:5

hello_sensor_timeout:6

hello_sensor_timeout:7

hello_sensor_timeout:8

hello_sensor_timeout:9

hello_sensor_timeout:10

hello_sensor_timeout:11

hello_sensor_timeout:12

hello_sensor_timeout:13

hello_sensor_timeout:14

hello_sensor_timeout:15

hello_sensor_timeout:16

hello_sensor_timeout:17

hello_sensor_timeout:18

hello_sensor_timeout:19

hello_sensor_timeout:20

hello_sensor_timeout:21

hello_sensor_timeout:22

hello_sensor_timeout:23

hello_sensor_timeout:24

hello_sensor_timeout:25

hello_sensor_timeout:26

hello_sensor_timeout:27

hello_sensor_timeout:28

hello_sensor_timeout:29

hello_sensor_timeout:30

hello_sensor_timeout:31

hello_sensor_timeout:32

hello_sensor_timeout:33

hello_sensor_timeout:34

hello_sensor_timeout:35

hello_sensor_timeout:36

hello_sensor_timeout:37

hello_sensor_timeout:38

hello_sensor_timeout:39

hello_sensor_timeout:40

hello_sensor_timeout:41

hello_sensor_timeout:42

hello_sensor_timeout:43

hello_sensor_timeout:44

hello_sensor_timeout:45

hello_sensor_timeout:46

hello_sensor_timeout:47

hello_sensor_timeout:48

hello_sensor_timeout:49

hello_sensor_timeout:50

hello_sensor_timeout:51

hello_sensor_timeout:52

(INT)But1:1 But2:0 But3:0

hello_sensor_timeout:53de = 00

hello_sensor_timeout:54

(INT)But1:1 But2:0 But3:0

hello_sensor_timeout:55de = 00

hello_sensor_timeout:56

hello_sensor_timeout:57

hello_sensor_timeout:58

(INT)But1:1 But2:0 But3:0

hello_sensor_timeout:59de = 00

hello_sensor_timeout:60

hello_sensor_write_handler: handle 002b

hello_sensor_write_handler: client_configuration 0001

hello_sensor_write_handler: NVRAM write:0009

hello_sensor_timeout:61

hello_sensor_timeout:62

(INT)But1:1 But2:0 But3:0

hello_sensor_timeout:63de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:64de = 00

(INT)But1:1 But2:0 But3:0

hello_sensor_timeout:65de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:66de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:67de = 00

(INT)But1:1 But2:0 But3:0

hello_sensor_timeout:68de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:69de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:70de = 00

(INT)But1:1 But2:0 But3:0

hello_sensor_timeout:71de = 00

(INT)But1:1 But2:0 But3:0

hello_sensor_timeout:72de = 00

hello_sensor_timeout:73

hello_sensor_timeout:74

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:75de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:76de = 00

hello_sensor_timeout:77

hello_sensor_timeout:78

hello_sensor_timeout:79

hello_sensor_timeout:80

(INT)But1:1 But2:0 But3:0

hello_sensor_timeout:81de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:82de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:83de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:84de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:85de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:86de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:87de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:88de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:89de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:90de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:91de = 00

(INT)But1:1 But2:0 But3:0

(INT)But1:1 But2:0 But3:0 = 00

hello_sensor_timeout:92de = 00

hello_sensor_timeout:93

hello_sensor_timeout:94

hello_sensor_timeout:95

0 Likes

Thank you for collecting the trace.  There is nothing happening on the sensor side.  What device are you using on the host side.  My best guess is that there is something wrong there.  For example if this is a USB device it can somehow go into a selective suspend and due to the crappy radio or USB hub or system design it does not wake on the packet received over the air.  To prove that I am wrong, can you get your machine in to the state where it does not receive notifications from the sensor.  Open Bluetooth settings and modify Allow Bluetooth device to find this computer.  Click on Apply.  Change it back and click on Apply again.  This will not talk to the hello sensor, but will wake the USB interface.  See if you can receive notifications from the sensor.

0 Likes
Anonymous
Not applicable

Yes, I agree. I think it might be the USB Bluetooth dongle that came with the eval kit. Probably going through a VirtualBox VM of Windows on a MacBook Pro is not the ideal setup.

In other news, I fixed the iOS notifications! For some reason, hello_sensor was not saving the notification state for that characteristic. Even though I am calling "setNotifyValue:(BOOL)enabled forCharacteristic:(CBCharacteristic *)characteristic" in iOS when I connect, hello_sensor is not saving that data in "hello_sensor_hostinfo.characteristic_client_configuration".

Here's the workaround I did to get it to work: I disabled the pairing check in "hello_sensor_write_handler()":

 if (memcmp(hello_sensor_remote_addr, hello_sensor_hostinfo.bdaddr, 6) != 0)
    {
        ble_trace1("hello_sensor_write_handler: wrong host handle %04x\n", handle);
        
        // COMMENTED THIS OUT TO DISABLE CHECK:
        //return 0;
    }

Once I disable the host handle check, it saves the notification state correctly and notifications work solidly (much better than my janky USB->VM->HelloClient setup).

I'm not sure when or how the hello_sensor code stores the "hello_sensor_hostinfo.bdaddr" device handle to compare against, but it was definitely not storing my iOS device's address. Perhaps because in iOS there is no pairing process? You just turn it on and it connects/pairs automatically.

Is disabling the check a big security issue? Or will it have some other effects I'm not seeing? Or is there some call in iOS that I am forgetting to make?

Thanks victorz!

Anonymous
Not applicable

Thank you fro this. I ran into this problem too.