Thursday, October 13, 2011

Working with mbed

After one year of working with the NGX blueboard, I finally got a chance to fool around with mbed. Till now I was wondering as to what makes mbed so popular. I came to know the reason after working with it.

The first thing I noticed is that mbed has a USB bootloader that comes along with the board. So you need not search for the USB bootloader on the internet and burn it to your microcontroller. Secondly, the board is lot more compact than the NGX blueboard. Thirdly, the cloud compiler is nice to work with. Now you will have your files wherever you go. Finally, a lot of people have already worked with mbed and have developed and shared the libraries to do different things. So it makes your work a lot easier.

One thing I would like to have for mbed is advanced compiler options which will allow me to tweak my code as I wish and also which allows me to choose the optimization level. In some program, for some reason, I might need to do something (loops without body or something like that) that does not affect the end result of the program. In such cases I would not want the compiler to ignore that code. So I would like to have control over the compiler optimization level. Well you can change the compiler optimization by using pragmas. But what about other compiler settings? Do I need to learn the commands for all the settings? Well the compiler thing wont be that big a problem if you use some other offline compiler that you like.

In the application development point of view one can very easily develop complex applications within days by using mbed as there is no need to do all the peripheral initializations by hand and also due to the abundance of libraries to do all sorts of common things. But I would recommend beginners not to use the classes and libraries provided by mbed. Try to do all things on your own. That way you will learn about the microcontroller in deep and also it will help you very much while debugging complex codes or silly mistakes. If you use a library, try to understand what the author is doing in the library and use it.

If you want to share your experience of working with mbed or NGX blueboard or in general ARM this is the place to share.

Anyway mbed or NGX blueboard does not matter. LPC17xx is FUN to work with.

SPOILER: The description and demo of a new mbed project done by me and my colleague will be posted shortly.


Christopher Hyde said...

Any idea on how to load programs onto mbed using usb D+ D- pins instead of the normal way? Thank you

Thejasvi .M.V said...

Is there a specific reason as to why you want to program from the other UDB D+ and D-?

There may be ways to write your own bootloaders that can program it from D+ and D-. I can look it up for you, if you can tell me as why you cannot use the conventional USB programming method.

Christopher Hyde said...

Only for learning purposes, and later own as part of a project for school. I want the mbed to be a "brick", and i want to do the work from scratch.

Thejasvi .M.V said...

It should be possible to program it with D+ and D- pins as long as you write your own bootloader and follow the protocol you implemented in the bootloader to transfer the binary file.

But I am concerned with putting the bootloader onto mbed. I do not think the cloud compiler for mbed allows you to write something like a bootloader (for which you will need to specify the start address of the bootloader and all).

So you should use any offline compiler like keil uvision, or CMSIS library with eclipse ( write your own bootloader (you can find an example here Then program the binary file onto mbed.

Now this is where I have doubts. mbed's current bootloader might have some safety feature so that nothing overwrites that bootloader. If that is the case, then you cannot use it. Alternative option would be to program it with JTAG. But the USB interface chip on mbed is using JTAG to communicate with LPC1768, so you will not be able to use JTAG.

I saw some relatively new posts in mbed group which said that there is an inbuilt UART bootloader in newer LPC1768. If that is the case and mbed does not overwrite this inbuilt bootloader, you can use it.

So my suggestion is look for ways to put your bootloader program onto LPC1768 of mbed. But creating the bootloader itself should not be a problem. Also by doing this you might remove the mbed's USB bootloader.