目次
What is the difference between Raspberry Pi, Arduino and Mbed?
These words, which we often see, have a different appeal.
The Raspberry Pi is valued for its software compatibility, which allows it to run Linux, a widely used open source operating system, while the Arduino is gaining in popularity because of the wealth of information that comes with its long history.
On the other hand, Arm Mbed is a rapid-start development platform that includes software compatibility in IoT as an “IoT device platform”. In addition, it includes a number of available libraries, including the current focus on enabling IoT devices to connect to the cloud.
And, Mbed is provided by Arm, a semiconductor IP (Intellectual Property) company, and is attractive because many of its components are open source or available for free. Also, as the word “platform” implies, Mbed is not only a microcontroller board, development tools, software, and compatibility, but also a development environment or foundation that includes all of these. Moreover, most of the microcontroller boards developed by Mbed are Arm Cortex-M, so there is a very high degree of compatibility.
Of course, you can also take advantage of Arduino’s hardware compatibility if you choose an Arduino hardware compatible board as the target microcontroller board for Mbed development.
Mbed Features
Here are some of the features of Mbed Please keep in mind that this is an important part, so I’ll write it in larger letters.
Cloud Development Environment
drag and drop programming
C/C++ Hardware Abstraction API
open source (software)
I will give a brief explanation of each.
Cloud Development Environment
Mbed provides an IDE that runs in a web browser, called an “online compiler.” Commercial IDEs and compilers such as Keil MDK-ARM and IAR Embedded Workbench are paid for, and setting up a development environment with the free GCC is a pain in the ass. By contrast, as an online compiler, you don’t have to set up an environment – all you have to do is create an account with Mbed and log in to have your own workspace in the cloud (of course, there are no fees to register, maintain or use your Mbed account).
In addition, since the development environment is in the cloud, you can continue development simply by logging in with your account from any computer. In addition, since the development environment remains the same even if you change development equipment, you can concentrate on training without wasting time because there is no difference in the environment when you provide training.
Furthermore, by taking advantage of the feature of storing the developed source code in the online environment in the cloud, we have integrated a version control system called “Collaboration” to enable collaborative work with other users.
The compiler used in Mbed’s online compiler is armcc, which is also used in Keil MDK-ARM and other products. armcc is said to produce more efficient binaries than GCC in general, so all you have to do is to build it with Mbed’s online compiler You can get the binaries. By the way, the generated binaries are automatically downloaded by the download function of the browser and saved locally.
Some organizations may have a policy of “save the source code only in the specified location (not to the specified server)”. By using it, it is also possible to proceed with locally closed IoT software development.
Drag-and-drop programming
As I mentioned earlier, the binaries built by the online compiler are downloaded, and there is an easy way to write this binary to the development target. It comes with a chip called a written interface chip, which is recognized as a USB flash drive when the Mbed enabled development board is connected to the computer. By dragging and dropping a downloaded binary file to this drive, you can write to the target microcontroller board.
In addition to the binary writing (program) function, this interface chip has a USB-UART bridge and a debug adapter function that supports the CMSIS-DAP protocol. You can also debug your target microcontroller by using a CMSIS-DAP-compliant development tool (unfortunately, you cannot debug it with an online compiler).
C/C++ Hardware Abstraction API
This is probably the most useful element of Mbed: the hardware abstraction APIs are defined in Mbed OS. Therefore, when you develop with Mbed OS on a microcontroller that has Mbed OS ported, you can develop with the Abstraction API. There are two main advantages of using the abstraction API.
L Chica on Mbed OS
Now let’s look at an example of the code that actually manipulates GPIOs and flashes LEDs in the Mbed OS.
#include "mbed.h" DigitalOut led1(LED1); // main() runs in its own thread in the OS int main() { while (true) { led1 = !led1; wait(0.5); } }
It’s very simple like this. To do this without using Mbed OS, you have to use a microcontroller vendor-dependent library or manipulate the I/O registers. For example, your code might look like this
#include "LPC17xx.h" void gpio_init(gpio_t *obj, PinName pin) { if(pin == NC) return; obj->pin = pin; obj->mask = gpio_set(pin); LPC_GPIO_TypeDef *port_reg = (LPC_GPIO_TypeDef *) ((int)pin & ~0x1F); obj->reg_set = &port_reg->FIOSET; obj->reg_clr = &port_reg->FIOCLR; obj->reg_in = &port_reg->FIOPIN; obj->reg_dir = &port_reg->FIODIR; } int main() { PinName pin = 0; gpio_t obj; gpio_init(&obj, (PinName)(0x2009C000 + 31 + 8)); // P1_18 unsigned int mask_pin18 = 1 << 18; volatile unsigned int *port1_set = (unsigned int *)0x2009C038; volatile unsigned int *port1_clr = (unsigned int *)0x2009C03C; while (1) { *port1_set = (port1_set | mask_pin18); wait(0.5); *port1_clr = (port1_clr | mask_pin18); wait(0.5); } }
Whether you use libraries or manipulate registers, you have to read datasheets and user manuals and write code that is vendor- or microcontroller-dependent.
On the other hand, if you want to use peripherals that are not defaulted to by the abstraction API, you can write code to access the peripherals directly without using the Mbed OS API. Of course, you can also write an inline assembler.
Open Source
The interesting thing about Mbed is that much of it is open source. The software Mbed OS is also open source, and the firmware of the interface chip, DAPLink is also open source.
Of course, it’s not just the software that’s open source, as the boards that are Mbed enabled are developed and released by different board vendors, but the boards that Arm is involved with are mbed-HDK. Schematics for third party development boards are also available to the best of the author’s knowledge.
This commitment to open source is probably because Arm is an IP supplier, not because of the revenue from selling Mbed OS and development boards themselves. My understanding is that the goal of third party development boards is not to make money from development boards either, since most of the third parties are semiconductor manufacturers.
That’s a bit of a tough one
This is the kind of Mbed that you need to know about to start using it now (a bit of a challenge). For example, when trying out a project with blinking LEDs on an mbed LPC1768, there are two examples of projects: the Blinky LED Hello World and the mbed OS Blinky LED Hello World.
The reason why there are two types of LED flashing programs is because there is a difference between those implemented in mbed SDK (also called mbed 2.0 or Classic) and those implemented in Mbed OS 5.
Next, let’s unravel the differences between mbed SDK (mbed 2.0/Classic) and Mbed OS 5 in terms of the history of Mbed.
History of Mbed
Mbed was born in 2005 when two Arm employees, Simon Ford and Chris Styles, discussed their extracurricular projects at a tea break. They were helping college students with student projects and an after-school electronics club, but the results were not good.
The idea was good, but the problem was that it didn’t come to fruition. Another problem was that the school’s system was locked and we weren’t allowed to install any software on it. This is how the features of Mbed were born: an IDE that runs on a web browser, an API that allows easy microcontroller development, and a programmer (write function) that looks like a USB flash drive from a computer.
This was followed by the first release of Mbed in 2009. At this time, it was called “mbed” in all lowercase letters and called itself a “rapid prototyping tool” (a tool for quick prototyping), as it was intended to be used to realize student projects, as mentioned earlier. The only supported board was the mbed LPC1768, which was intended for the then newly announced LPC1768 (the mbed LPC1768 was released in Japan the following year, February 2010). At that time, I was using an Arduino with 8-bit AVR, but I switched to Mbed because it allowed me to quickly load the network stack (IP stack) on the microcontroller and connect it to Ethernet.
Immediately after its release, Mbed was not open source, but it became open source in February 2013 with the announcement of mbed 2.0. mbed 2.0 By the end of 2012, a few months back from the introduction of the mbed interface, the programmer’s chip, which was called the mbed interface, also included a debug adapter feature that supported CMSIS-DAP. Shortly after the introduction of mbed 2.0, the first board with a microcontroller other than NXP, the Freescale FRDM-KL25Z (NXP and Freescale were not the same company at the time), was introduced, and from here the number of mbed-enabled (mbed-enabled) boards increased.
By October 2014, the mbed v3.0 was announced. From here, the Mbed software library, which was called “mbed SDK”, became known as “mbed OS”, and the mbed OS 15.11 Technology Preview, released in November 2015, included an event-driven scheduler called MINAR and and a package management system called yotta. These are now treated as “mbed OS 3”. mbed OS 3 suffered from a lack of compatibility with the previous mbed SDK due to ambitious changes such as the introduction of the aforementioned event-driven. Perhaps because of this, it is now rarely used, and many descriptions on websites have been replaced by Mbed OS 5, which is now rarely seen.
The current mainstream mbed OS 5 was announced in August 2016 and has been released. As can be seen from the diagram above from the release, mbed 2.0, which was released in 2013, and mbed OS 3, which was released in 2015, have been merged to allow for a smooth transition from mbed 2.0.
Features of mbed OS 5 include support for RTOS as standard, which was optional in mbed 2.0, and the equivalent of the package management system introduced in mbed OS 3mbed-cli makes offline compilation (a means of building without an online web compiler) easier.
In October 2016, mbed Cloud was released. mbed Cloud was released as a means of enabling device connectivity to the cloud, rather than closed-board development Device Connector is now available. Also, mbed Cloud goes beyond just providing cloud connectivity, with features such as Device Lifecycle Management (DLM) that are more aligned with the actual deployment of the IoT and more aware of the product life cycle. As a result, we have far surpassed our initial goal of launching Mbed as a practical IoT device platform that is widely and conveniently used by a large number of users, including those in commercial applications.
Finally, in August of 2017, the “Arm” logo and text notation changed, and at the same time, the “mbed” notation was changed to “Mbed”. In explaining the history of the company, I have purposely used the notation from that time as well.
Finally
In this article, as an overview of Mbed, the “IoT device platform”, I’ve tried to give a quick overview of its connectivity to the cloud and its appealing features. I’ve also included the appeal of the Mbed as a microcontroller development platform by comparing it to the Raspberry Pi and Arduino. In future articles, we will introduce the Mbed with content related to the development of IoT devices that will further penetrate into people’s lives and industries.
“もっと見る” カテゴリーなし
Mbed TLS overview and features
In this article, I'd like to discuss Mbed TLS, which I've touched on a few times in the past, Transport …
What is an “IoT device development platform”?
I started using Mbed because I wanted a microcontroller board that could connect natively to the Internet. At that time, …
Mbed OS overview and features
In this article, I would like to write about one of the components of Arm Mbed, and probably the most …