View unanswered posts | View active topics It is currently Sun Apr 30, 2017 8:36 pm



Reply to topic  [ 14 posts ]  Go to page 1, 2  Next
does a BGScript program require the BGLIB/BGAPI? 
Author Message

Joined: Thu Oct 03, 2013 9:06 pm
Posts: 6
Hi,

I am trying to program a BLE112 chip with a very simple example.

here there is a simple example toggle_led.rar that switches a led on and off every second.
then I do as explained in their blog:

- I unrar toggle_led.rar and I get the fle toggle_led/out.hex.
- then I install and run the Texas Instruments SmartRF Flash Programmer
- set the flash image path to the out.hex file,
- then click on "Actions: Erase and Program"
- then hit the "Perform Actions" button

this seems to run ok.

now, the LED that is connected to P0.7 on my BLE112 module should switch on and off every second,
but nothing happens.

what can be the problem?
does the BLE112 need to have the BGLIB installed before I can program the toggle_led/out.hex with the Texas Instruments SmartRF Flash Programmer?
if so, how can i program the BGLIB?
or does the toggle_led/out.hex already contain the BGLIB?

from this post: http://www.sureshjoshi.com/development/ ... explained/
I understand the BGScript does not require BGLIB, and so programming the toggle_led/out.hex with the Texas Instruments SmartRF Flash Programmer should be enough.
is that correct?
if so, what can be the problem? that is, why nothing happens, why my led is not switching on and off?


Regards,
David


Thu Oct 03, 2013 9:51 pm
Profile

Joined: Sat Sep 21, 2013 1:13 am
Posts: 6
Hi David,

I'm new in this forum and just saw your post unreplied so I went for a shot. ;)

The Bluegiga modules are great for learning BLE. Those modules are full-stack BLE modules which means that your program can be embedded in the module and ran directly from it, without the need of an external computer/host. Those programs are not generic applications but yet small applications written in either C or they're own script language. When you go with the C language you will need to link against the BGLIB and when you go with the script language you just need to use they're compiler to build the binaries (those out.hex files you created).

So to answer your first question, a BGScript app does not need BGlib, it is already linked to it by the compiler when it builds the binary file. Nor you need to install any library into the module, they are already there (hence the term full-stack).

The problem you are facing may be relate to the fact that you use TI's flashing tool instead of the Bluegiga's one. Bluegiga modules has an internal key that needs to be present in order for the applications to run and when you flash a binary with 3rd part tools this key may be erased and your module wont work anymore.

I suggest that you get in touch with they're support by e-mail to identify if you bricked your module, and if so, if there is any way to recover from it.

Kind regards,

Eric


Wed Oct 09, 2013 2:41 am
Profile

Joined: Thu Oct 03, 2013 9:06 pm
Posts: 6
Hi Eric,

thanks a lot for your answer! :)

I took the example of the led program from this blog: http://blog.bluetooth-smart.com/2012/09 ... -bgscript/

they use the same Bluegiga module, and they use TI's flashing tool, and it works for them.

why it wouldn't work for me?


Regards,
David


Wed Oct 09, 2013 7:55 am
Profile

Joined: Sat Sep 21, 2013 1:13 am
Posts: 6
Hi David,

First of all let me say that I haven't yet used any IO feature of BLE modules. So far I only wrote some custom profiles and test them with a BLED112 and an ipod touch, so take my answers here with caution. ;)

Unfortunelly I cant test your code because I only have BLED112 modules but I quickly read your code and skimmed the post you pointed, and a few things got my attention.

1) In the post you referecend your code the author uses a Beta version of Bluegiga SDK. The beta version (and I assume modules at that time) didn't require the license key but new ones does as you can see in this section 3 of the following KB https://bluegiga.zendesk.com/forums/213 ... ooth-Smart.

I strongly suggest you to download the Bluegiga tools and docs from they're tech site (there is links in the product page) and use them.

2) I went trough the documentation I have for BGScript and I haven't found the hardware_io_port_read function in it. I know it exists since I have other people mention it, but I can't say for sure how it should be used. You could evaluate the result parameter returned in this call, it should be zero if no errors happened.

3) You probably know it already but your example uses the BLE112 just as timer. Your GATT characteristics are not binded to any variable in your BGS.

Are you sure your program is running? Can you find your module using a tool like BLExplr or LightBlue?

If so than it would be wise to debug your BGS. A simple way to do it is to create a custom service (in your gatt.xml) binding your variable to the characteristics of this profile and read them using one of the tools mentioned before.

Also do make use of Bluegiga support, they are really great. You can create a login in they're site and then send your questions by e-mail.

Regards,

Eric


Wed Oct 09, 2013 2:00 pm
Profile
Site Admin

Joined: Thu Aug 02, 2012 11:36 am
Posts: 166
Hello David,
sorry for not responding earlier.
What development board are you using?

DKBLE112?

Regards,
Michael.


Wed Oct 09, 2013 7:15 pm
Profile WWW

Joined: Thu Oct 03, 2013 9:06 pm
Posts: 6
Hi Michael,

we have these three boards:
http://www.aliexpress.com/snapshot/254764684.html

Regards,
David


Thu Oct 10, 2013 8:25 am
Profile
Site Admin

Joined: Thu Aug 02, 2012 11:36 am
Posts: 166
Hi David,
I would recomment to look at TI's webpages for development tools for the CC254x directly.
I don't think that code writte for the BLE112 is a good starting point to use the boards illustrated on the image you provided.

I have not yet tried to program the CC254x directly, since for me it was simply to expensice to get an IAR developer tools license for the chip. Maybe in the meantime there is something available from TI, but I don^t really know.

Cheers,
Michael.


Fri Oct 11, 2013 5:11 pm
Profile WWW

Joined: Thu Oct 03, 2013 9:06 pm
Posts: 6
Hi Michael,

i've read that bluegiga BLE112 is based on TI CC2540.
but what does "is based" exactly means?

BLE112 is a module, a board that includes the TI CC2540 chip and some more things, such as the antenna.
is that correct? it does use the TI CC2540 chip? or it is a modified version of the chip?

i've read that BLE112 does not use the same stack as CC2540.
this stack is "inside" the chip?
it means that they use the TI CC2540 chip, but they have changed their firmware or something else?

if BLE112 uses the exact same chip TI CC2540 chip,
then it is possible to use use BGScript from bluegiga with a different module (for instance, BR-LE4.0-S2A from Blueradios)?
that is, can I write a BGScript program, compile it with bluegiga tools, and program the out.hex file to my BR-LE4.0-S2A module with TI SmartRF Flash Programmer?

----
About using IAR instead of BGScript,
in the new BlueGiga BLE112 documentation "Getting Started with Bluetooth Smart.pdf", version 1.7 from 2nd October 2013,
that they have a "C-Development Environment (Beta)" to use with IAR.
this means that before this beta, it was not possible to program BLE112 with IAR?
that is, BLE112 was only programmable with GBScript, or also with IAR?

if so, what are the bluetooth chips that can be programmed with IAR?

---
and the last question :)

I understand that IAR is very expensive, and this makes it an undesirable solution for hobbist.
however, a part of this, do you know if it is much more difficult to use than BGScript, for a simple application?


Many thanks,
David


Sun Oct 13, 2013 9:59 am
Profile

Joined: Sat Sep 21, 2013 1:13 am
Posts: 6
Hi David,

Forgive me for the long answer. Since I was unsure about your background with programming and electronics I took the liberty to digress a little. (Not that I’m an expert, btw).

Microchips and microcontrollers are electronic components that usually do some very specific tasks ranging from simple things like reading bits in a serial transmission to complex tasks like supporting a BLE protocol. Usually the microchip manufacturer will provide a way for you to control it's inner working, most of the time in a high level form like a programming library but sometimes in binary form (like PDUs messages) which the chip can recognize itself internally.

In most cases those components are not enough by themselves and should be assembled together with other components to achieve something usable from a user perspective. By doing so comes the need to orchestrate the task of several different components, which in turns brings the need of a Host Controller to manage this orchestration. Also this usually requires a common language that talks to every one, usually C or C++ due to universal acceptance. By doing so manufacturers makes easier to use they're products with other products from other brands.

Examples of commonly used Host Controllers are Arduino boards, freeboards and others and you can always design you own.

So when TI says it has a BLE microchip what it's giving you is a piece of hardware that can perform all defined Bluetooth LE procedures like sending advertisement packets or respond to scan requests.

Now when comes to a Bluegiga module, it's the full package (hence the term Full Stack), a board in it's self. Bluegiga already assembled a set of components (picked at they're discretion) like volatile memory (RAM), persistent memory (Flash), serial ports, usb ports, and others.

A good analogy would be to think about a bluegiga module as your computer while TI microchip is your computer's processor.

In practical terms, depending on your needs a Bluegiga module may be too much. If, for example, I'm building a thermometer it may not require USB, RAM, Flash and other modules. All it may require is the thermometer itself, a serial interface to read the thermometer values, a battery and a BLE module to expose the value. In this case it may be easier to go with the TI microchip itself.

Another good example may be a tag used to detect its presence. Since the tag will only broadcast a pre-defined value, a simple BLE chip should suffice.

With this picture in mind, let's go through your questions:

Quote:
i've read that bluegiga BLE112 is based on TI CC2540. but what does "is based" exactly means?

Means they use this chip for the BLE procedures (and maybe others things, I don't know the exactly spec of TI's chip, but it’s certainly limited in its functionalities).

Quote:
BLE112 is a module, a board that includes the TI CC2540 chip and some more things, such as the antenna.
is that correct? it does use the TI CC2540 chip? or it is a modified version of the chip?

It's not a modified version of the chip, but BLE module it's more than a simpler BLE microchip. It’s a set of components bundled together.

Quote:
i've read that BLE112 does not use the same stack as CC2540. this stack is "inside" the chip?it means that they use the TI CC2540 chip, but they have changed their firmware or something else?

No. They build something bigger. For example, the BLE112D is a module with an USB port.

Quote:
if BLE112 uses the exact same chip TI CC2540 chip,
then it is possible to use use BGScript from bluegiga with a different module (for instance, BR-LE4.0-S2A from Blueradios)?

Probably not.

Quote:
that is, can I write a BGScript program, compile it with bluegiga tools, and program the out.hex file to my BR-LE4.0-S2A module with TI SmartRF Flash Programmer?

No. BGScript is language created by Bluegiga and it has a very limited set of instructions, just the ones required to allow a programmer to control the "functionalities" embedded in they're modules. The instructions in other manufacture chips are different even it they’re chip would be a full stack like bluegigas or if it does similar tasks, like performing BLE procedures (scan, advertise, etc). You can think about a PC x MAC (in case of full stacks modules) or Intel x AMD (in case of microchips). They are similar but not always interoperable.

Quote:
this means that before this beta, it was not possible to program BLE112 with IAR?

You’re probably right (or almost right) here. First pay attention that IAR is not just a compiler, its kind of a Visual Studio for microprocessors. It provides a debugger, a compiler, a linker, a visual IDE and so on.

That being said there are other programming tools around (free and commercial) that may be used, like GCC (compiler) and GDB (console debugger), but they may be harder to use and/or not officially supported by Bluegiga. Also note the difference from Bluegiga supporting an IDE and the IDE supporting Bluegiga's modules. Nothing prevents Microsoft (for example) from adding support to Blugiga's language and libraries into VS in future, but this would still be unsupported by Bluegiga.

Quote:
that is, BLE112 was only programmable with GBScript, or also with IAR?

No. You can use other languages (for example python) but since it's not officially supported you may found yourself limited in what could be done. This also does not mean that every/any language can be used. It’s a long subject for another thread.

Quote:
if so, what are the bluetooth chips that can be programmed with IAR?

That’s a hard one to answer. You may need to ask for each bluetooth manufacturer or to IAR itself. What I can assume is that since IAR is adopted by several big companies, I expect most of the major manufactures (Nordic, TI and others) to somehow support IAR in they're products.

Quote:
I understand that IAR is very expensive, and this makes it an undesirable solution for hobbist.
however, a part of this, do you know if it is much more difficult to use than BGScript, for a simple application?

The answer relies on what your application will do and it's requirements. If it will only need what is "inside" the BLExxx module and does not require TOP-processing performance (ice speed), than BGScript may be enough. Otherwise you may need to use another language like C or python. Let me give you some examples:

1) Suppose a peripheral running an application that holds a "like" counter. People may come with they're iPhone or android and increment the counter of likes. For this simple application you can use BGScript.

2) Suppose a peripheral with an application that will read data from a serial port or an USB port and expose those values in BLE characteristics. BGScript may be enough for this.

3) Suppose a peripheral controlling a medical device that needs real-time response time. Even so BGScript may be enough for it from the features perspective, its speed may not be enough for this case.

4) Suppose a peripheral that is a set-top box from a cable TV. The running application must talk to a simcard, to a graphic unit, a transcoding unit, and audio unit and still control multiple HDMI buses. For sure BGScript won't fit and probably the host controller would no longer be the Bluegiga module, even if the set-top box uses a bluegiga module.

Got it? I hope this helps clear it a bit.

Cheers,

Eric

[p.s.] I posted this message earlier today, when I was lacking some sleep and loaded in caffeine. Only now I realized that it sounded a little rude and was full of errors, so I updated it. ;) sorry for that.


Sun Oct 13, 2013 6:36 pm
Profile

Joined: Thu Oct 03, 2013 9:06 pm
Posts: 6
Hi Eric,

I should have specified my background: I have already programmed with Arduino, ATmega328P, C and IAR before.

thanks for your info, but I am afraid that it does not answer my doubts. let me be more specific with my questions:

The TI CC2540 chip: http://www.ti.com/product/cc2540
is a bluetooth chip with a 8051 MCU, which already includes RAM, Flash, 2 UARTS and other features.


Quote:
Bluegiga already assembled a set of components (picked at they're discretion) like volatile memory (RAM),
persistent memory (Flash), serial ports, usb ports, and other stuff.

that's the point.
the TI CC2540 chip already includes the RAM, Flash, serial ports...

so, what is the bluegiga BLE112 module really adding to TI CC2540?
they added the embedded antena, ok.
I guess that they preloaded a specific firmware (that could be programmed using a CCDebuger).
what else they are adding to TI CC2540?


So, just for my understanding,
would it be possible to get the firmware of BLE112 and put it in any other bluetooth module that uses the TI CC2540 chip?
(such as the CC2540EM module included in the http://www.ti.com/tool/cc2540dk)


Again, just for my understanding,
would it be possible to use a BLE112 module, remove its firmware and, using the CCDebuger,
program the "SimpleBLEPeripherical" project compiled by IAR to the BLE112 module?
note: SimpleBLEPeripherical is an example project from TI CC2540 Development Kit: http://www.ti.com/lit/ug/swru271f/swru271f.pdf


(I am talking about BLE112, not BLE112D).


Regards,
David


Tue Oct 15, 2013 12:57 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF.