Monday, September 10, 2012

Getting started with Bluetooth 4.0

Contents of the BLE112 development kit.
I recently started working on Bluetooth 4.0 development, or Bluetooth Low Energy (BLE from now on), and started doing so with BlueGiga's turnkey module and its Developer's Kit, the BLEDK112. There are a ton of options out there and if you're interested head on to this blog post to get started, you'll get an idea of what you can get and the overall feel of the road; this guy has taken the time to write and keep a great post alive and I'm very grateful since its already helped me plenty and inspired me to write this. You should know most of this solutions work on Texas Instruments's CC2540 bluetooth smart single mode module, one that, while empirical and supplied with maybe the best technical support, requires a development environment that goes for roughly 1500€ a piece, if you wanted to develop any serious application on it. It should also be noted that the CC2540 is only a transceiver with a MCU while turnkey modules already have an antenna and some other cool stuff.
The purpose of this post is to get whoever has purchased one of BlueGiga's DKs started and manage to compile your own code, I've found that the documentation, while some of the best available in comparison to the rest, falls short at times. So on to the point. What you'll need in order to get started, aside from the DK obviously:
  • TI's SmartRF Flassh Programmer.
  • Technical documentation available at BlueGiga's website, specially the BGScript developer's guide.
  • Software pack available at BlueGiga's website, containing the compiler, a PC application to control your USB bluetooth dongle, a host of already compiled examples and more.
blegui2 software. It will help you control your USB dongle.
One of the main drawbacks of using BG's kit is the need to use their somewhat lacking proprietary script, the BGScript; but it might as well be one of the biggest highlights, since it's the only thing standing between you and having to fork over a truckload of cash for TI's IAR Embedded Workstation.
From the software pack you'll be able to get several examples and use them along with the blegui2.exe program, available in the bin folder, which uses the dongle to discover and connect with your test board. This is nice for starters, to see the thing working.
When it turns nasty is when you try to write your own code, so far I've only written a simple hello world-like code but what was actually painstaking was to get it compiled and into your board. Nowhere does it say, or at least I failed to find it, how to compile or what files you need. If you look closely into the example folders you'll notice some .xml files, and the .bgs script. What I would suggest is copying a set of these files onto a different folder and overwriting the .bgs script.
A quick run down of the .xml files:
  • hardware.xml: Define which hardware units, like the GPIOs, the timer clock and such, your script will use. Example programs in the developer's guide will help you figure out how to use this file.
  • attributes.xml: Define constants here.
  • gatt.xml: Usage profiles can be defined here, there's documentation on that but I haven't checked it out yet.
  • cdc.xml: Not sure what this does but it's related to the USB dongle.
  • project.xml: This, I take it, is sort of like a C makefile. If you open it you'll notice it mentions all the other files, including the .bgs source code. Make sure it all adds up.
If you're on Windows, as I am, you'll need to either add the bgbuild executable to your %PATH%, which is rather flaky since you'll have to add most of the other files in the bin folder and the api folder, I wouldn't recommend this since it works almost as often as it does not, or just copy the contents of your project folder to the bin folder of the software pack and then open a command window into it and write the following command:
        bgbuild.exe project.xml out.hex
Afterwards all you need to do is connect the CC debugger to your test board like this:
Open TI's SmartRF Flash Programmer and browse your file system for the recently generated out.hex. Click "Perform Action" and you're done.
To test it out open blegui2 with your USB dongle connected, click attach once it turns up and then start. To the right you should see your test board with its SSID, MAC address, Tx power and some other stats; connect to it and you can check whatever services you've got running.
I hope this was helpful and keep in mind I'm still new at this, both BLE and blogging, any comments or constructive criticism will be considered.

Sunday, September 9, 2012

Exclude yourself from Google Analytics

A few days after I started this blog I decided to set up Google Analytics since I'd read very nice things about it all over the place. Ok, so I set it up and started noticing how biased my results were toward were I live so I instantly started wondering if my own visits, due to me writing the posts, were getting counted. Turns out, they were. Since I'm starting out from scratch and don't get that many visitors this was seriously screwing me up. So if you're in a similar situation, after trying countless ways to avoid this I finally found a working one. No need to exclude IP addresses, nothing. All you have to do is install an extension in your browser of choice. This one, brought to you by the smart folks in Mountain View. Happy blogging.
PS: You have to do this in every computer you check you blog from.

Monday, September 3, 2012

Consumers are screwed...

It doesn't matter where you live, chances are your mobile carrier is screwing with you one way or the other. If you're an Iphone owner your specially screwed since your Iphone's pretty much ultra locked to that provider. If you're a Mac user, repair is getting less and less likely. If you bought Diablo 3, you've been screwed since the beginning with the "always-on" DRM scheme. We even hire our ISPs knowing they won't deliver what they advertise. If you use facebook, and chances are you do, you're getting useless news and "trending articles" getting pushed into your timeline with no regards for privacy. The list goes on and on...
My mobile carrier for example, forces me to pay for a voice plan, which I literally never use, in order to be able to have a data plan. It doesn't matter if I want to hire a data plan that is actually more expensive than those two plans combined, they just won't let me. Don't even get me started on contracts. Shouldn't the penalty for leaving a contract subside with each month? After all, you are paying a monthly fee for their services.
What ever happened to "the consumer is always right"?... And we should be, I mean, we are the ones paying aren't we? So why is there so much blatant disregard to our rights? Any consumer advocacy group out there?
It was great last year when that one girl managed to get the Bank of America to remove a nasty fee from her debit card. Americans all over supported her thanks to the Internet. Sadly, that's only one tale of success against hundreds of tales of consumer's rights being trampled by big corporations.
It pains me to see that one has no other option but to submit to their terms... And the worst thing of it all is that the ones that need your money or your clicks, likes and shares, are them. Why isn't anyone wooing their customers anymore? At least not a lot of companies. Just a couple of days ago Samsung pulled off a nice PR stunt and scored some serious points. At least with me. 
Recently, the thing that has most affected me in this regard is Diablo 3's "always online" DRM. It means you can't actually play a single player game without an Internet connection.  So if I travel, or if my line goes down, if anything were to prevent me from getting an Internet connection... I am officially off Diablo 3. I've given the game bad reviews due to this and bad scores all over, even though I love the game. It is time we consumers get a voice and the Internet is the right place for that. The big issue here is that they think they have all the power... But what would happen if everyone decided to stop using facebook? A massive PR effort would be needed to pull off such a stunt, but it would serve to show them that they need us a lot more than we need them... At least in the very particular case of facebook. And hey, Zuck's shares are pretty low as it is so maybe it could make a change.
Even if no one listens, that doesn't mean you shouldn't complain. So remember, the next time you get screwed, file a complaint. Maybe no one will read it, but they just might.

Tuesday, August 28, 2012

So about that new Diablo 3 patch...

Please keep in mind that I am in no way a pro in this game. I have been playing since it came out, yes, but I have yet to get a char to level 60, I'm currently on Hell Act II with my most advanced character. So this comes from a fairly regular player and not an ultra pro gamer prude. Also, I only play a most two hours a day so I can't say I grind for gear... Why the intro?
If you've played Diablo 3 since the latest patch came out, you'll agree with me: It's difficulty level has been downgraded quite a bit. It's not that monsters are weaker or hit for less... It's just that they drop perhaps three times as much loot as they did before, and it's not like it's better loot.
You might say that with three times as much loot it should be three times as likely to get good items but that, at least as far as I can tell, is not the case. You might end up getting a third of what you used to get. And I did believe the loot system was a little stingy before with good items, but now it's just ridiculous.
Why do I say it's gotten easier? With that much loot you can easily get up to 50k in like half an hour. And, contrary to what I had expected, AH prices are the same as they were before the patch. So you end up being able to spend a lot more gold there and therefore equip yourself way better.
As I said, I haven't gotten to the Paragon levels yet but as they add 3% to your magic find I would assume this only keeps getting worse, or better. Depending on how you see it.
So Blizzard, what would I have liked instead of this? Remember how you used to get yellow items not very often? And how frustrating it felt to finally get one and notice it's not even worth picking up? It would have been nice if, instead of these endless stream of useless but quite pricey junk, there had been a slightly higher chance of getting an item that I would actually put on, not just pass on to the nearest merchant.
It would have been nice to be able to get loot more closely related to the class you're using when crafting and not making it a matter of how much gold you can spend.
Still, it's a great game and I hope I get to the Paragon levels soon to see what they're all about.