aanon4 / BlueBasic

BASIC interpreter for CC2540 and CC2541 Bluetooth LE chips
https://gitlab.com/timwilkinson/BlueBasic
97 stars 55 forks source link

Beacon dies after 48 hours? #7

Closed gregwinn closed 9 years ago

gregwinn commented 9 years ago

Have you seen any issues with the beacon running the iBeacon example then dyeing after about 48 hours?

I have 8+ beacons that all died at about the same time (within two hours of each other). The fix was to take the battery out and then place it back in.

Note: All beacons had been programmed within two hours of each other.

aanon4 commented 9 years ago

I haven't seen that. I have a beacon sitting on my desk, battery powered, and it's been happily beaconing for over a week. I'm trying not to mess with it because it's my own hardware design and I want to make sure it is reliable.

After BASIC has done the setup for a beacon, it probably isn't running again (unless you have something else programmed) so it should just be in the standard TI firmware layer. What hardware are you using?

gregwinn commented 9 years ago

The hardware is of my own design but follows the basic TI design in the user guide for the 2540.

aanon4 commented 9 years ago

I'm running tests on 2541 based boards. Let me find a 2540 and try that.

gregwinn commented 9 years ago

Thank you, I am also running a bunch of tests here... i will update once I have any updates.

gregwinn commented 9 years ago

Ok, so it must have been a something else... I was unable to reproduce this. I am going to close this ticket.

aanon4 commented 9 years ago

Neither my CC2540 or CC2541 board has failed either. Fingers crossed it stays that way.

gregwinn commented 9 years ago

So it may have some issue with the iPhone app that was connecting to the beacons... It seems to kill the beacon when the app is installed and then when it makes first contact. (I am not an iPhone developer) So i don't have details but that seems to be what is going on... In order to have the beacon start transmitting again the beacon needs a hard reset.

If this sounds like something you have heard of I would love any info.

gregwinn commented 9 years ago

In the original hex file are you using POWER_SAVING mode? Am i able to set that after the board is programmed?

aanon4 commented 9 years ago

Well when you connect to the board it will stop beaconing until you disconnect (plus some slight delay). That's what I've observed. I've not seen it just stop at that point. As for POWER_SAVING, I just let the library handle that. The chip will be in the second lowest power saving mode most of the time because nothing is usually running. It wont go do the absolute lowest because a timer runs to wake it up and beacon every now and again.

gregwinn commented 9 years ago

So right after I posted my last comment all of my beacons dropped again after running this custom IOS app. So this leads me to believe that the issue is with the app... I shut the IOS app off and shut down the phone, the beacons did not come back on until a hard reset.

My question now is how do i protect the beacon from this? I am guessing the iOS app is opening an active connection and never dropping it (to each beacon)... but what i don't understand is when the phone is powered off the beacons do not come back up.

aanon4 commented 9 years ago

If the iOS app stays connected to a beacon them it won't broadcast its info, but the app disconnects when it goes into the background or is terminated. I regularly connect to my test devices and they come back okay. Can we narrow down the failure mode? Does it happen after every disconnect? Does it need you app before it will fail or does it have this issue out of the box? Is there anyway I could try your actual hardware?

gregwinn commented 9 years ago

So I have had a beacon in isolation for just over 4 days now... That beacon is still working prefect.

I placed it back in isolation then ran the iPhone app on my other beacons and the beacons stop transmitting after 10 or 15 mins. I shut the phone down and the beacons do not come back on until a hard reset is done.

So to answer your questions: 1) Does it happen after every disconnect? --- Just after the iphone app has been running for some time.

2) Does it need you app before it will fail or does it have this issue out of the box? --- Only happens around the iphone app.

I can deliver the schematics or eagle files if you like?

aanon4 commented 9 years ago

A few other thoughts then: 1) Can you try the failure test but using some other program to connect to the device? There's a tool in the AppStore called "LightBlue" from Punch Through - if you connect and disconnect (no console access of course) does this generate the same failure? 2) BlueBasic is now in the AppStore. Can you try the "official" version, again on the same test? Thanks

gregwinn commented 9 years ago

Ok, Tried both LightBlue and BlueBasic: While connected with one of the apps the beacon acts as expected (stops transmitting). Once that connection is dropped it comes right back up.

So, this is more proof that this iPhone app is doing something crazy... What i don't understand is that even when i power the phone off the beacon does not come back up like it does with the two apps above.

aanon4 commented 9 years ago

So, to clarify, if you connect with LightBlue or the AppStore version of Blue Basic, the beacon survives. If you connect with the from source Blue Basic app this will cause the beacon to fail. What about the OSX version of the app?

Assuming the store version is working fine, I'm not sure what's going on here. I checked the github source and it's the same version as in the AppStore. Are you up to date?

Grasping here ... sorry.

gregwinn commented 9 years ago

No, Blue Basic is 100% ok and working perfect, it will not cause the beacon to fail. So far the only way i can get the beacon to fail is via a custom iPhone App that was built to look for beacons.

aanon4 commented 9 years ago

Oh - I misunderstood. Is this an app I can try myself?

gregwinn commented 9 years ago

It's not public yet but i will work and see if i can get you access or source (it's a free demo app).

Is there any timeout that can be set so that it would drop all connections every so often? Via BlueBasic?

aanon4 commented 9 years ago

Happy to sign something regarding source code access.

I'll add a way to forcibly disconnect connections. Seems like a useful feature.

aanon4 commented 9 years ago

New firmware just uploaded now supports "GATT CLOSE" which will forcibly close any connections.

gregwinn commented 9 years ago

Thank you! I have the app source, now how would you like me to deliver it to you?

gregwinn commented 9 years ago

Never mind, i will email it to you lol.