17. Getting Started Useful resources linked from the first page, including very clear links to “Hello World” and the Getting Started guide Compiler linked from front page
26. Data quickly visible to a PC Logging to a CSV file means Excel can open the file and interpret, manipulate or plot the data. While the program executes the flash drive disappears from the PC, and returns when the file is closed
First let’s talk about what’s happening in microcontrollers these days. Microcontrollers are now getting very cheap. A Cortex M3 MCU can now be bought for around $1, compared to something similar that would cost around $10 in the past. This type of pricing is sure to drop even lower with coming Cortex-M0 MCUs. Compared with previous generations of microcontrollers that performed in the tens of MHz, and with modest Flash/SRAM (32kB/8kB), Cortex-M3 MCUs can be found with 512kB Flash and 64kB SRAM, running around 100MHz. They also contain a rich set of peripherals like USB, Ethernet, SPI, I2C, I2S, UART, CAN, PWM, Analogue I/O, and of course lots of GPIO. With the Ethernet and USB interfaces comes internet connectivity. You also have sensors and actuators for things like RFID readers, touch screen LCD, and MEMS devices. Of course, all of these things create new opportunities for MCUs.
- Before the computer revolution of the 1980s computers were really only used by scientists. 25+ years after the revolution, computers are everywhere, in all industries, in almost all homes, accessible and usable by almost anyone. - Much like computers back in the days, microcontrollers are now solutions looking for problems and applications. Traditionally, the people applying them are the embedded engineers, however, we’re seeing that change. Product designers who have no embedded engineering backgrounds are now envisioning and finding ways that MCUs can solve problems and improve applications. One example are the smart shoes Adidas put out a few years ago with the MCUs to intelligently adjust the cushioning depending on the users running style. - MCUs interact with the real world through sensors, actuators and other communication technology, and they often do so invisibly without even being noticed. Their scope of application is potentially far greater than that of the home computer. In fact as I mentioned before, the number of embedded applications and processors already exceeds all other types of applications combined.
Now let’s talk about barriers for MCUs. - It’s relatively easy to identify a problem, and come up with a solution that might be implemented with an MCU, but the reality is that it is difficult to experiment and prototype quickly. - When starting an embedded project you have a number of choices you usually have to make. They may not be complex, but they can be tedious, time-consuming, and may feel unnecessary if you just want to quickly experiment. Someone new to MCUs might not understand the choices that they have to make, and may be overwhelmed with options which may not even be relevant to their project. - Along with that is a certain amount of overhead in starting a new project. Setting up the tools, configuring hardware, configuring debug interfaces. This is okay for a long term project, but for quick experiments, the overhead may be the most time consuming part!
In general, how do we get products and designs to market quickly? The faster we can prototype a product, the faster it can come to market. If you examine most industries, whether it be making kids toys, automobiles, or software, there’s all sorts of new prototyping methods for speeding time to market. - For example With 3D moulding and printing, you can move from a CAD design to a high quality prototype using machines not much bigger than a copy machine. Universities are actually pretty big on this. I’m sure there’s way that for a modest fee, you can submit CAD designs to online printing houses and get prototypes days later in the mail. - If you look at prototyping microelectronics in the past say, 10 years, not a lot has changed. It’s still time-consuming to design schematics, lay out it out on a PCB, send it for manufacture. And only then can you start to write the software.
One ARM-based development platform has been designed specifically to speed up prototyping. The platform is called mbed, and was actually created by some internal R&D engineers at ARM. Mbed helps to speed up prototyping by providing a complete online-developer platform, which allows developers to quickly communicate with each other, share code, and ask questions in a forum, all regarding the same piece of hardware As well, all of the compilation tools are web-based, going along with the idea of cloud computing. There’s a number of advantages to this model, especially in an academic setting, most obvious is the ability to access your tools and code from any machine with an internet connection Additionally, all of the peripherals on the MCU are highly-abstracted, hiding a lot of the nasty assembly-level details and libraries, and allows you to easily program very high-level C++ as we’ll see a few examples of And of course, the board itself comes in a prototyping form-factor with all the peripherals pinned out so you can plug it into a bread-board and wire it up to other devices.
Nothing really to add to the slide text
So here’s what the website looks like. - There’s active forums for tech support and discussing ideas. - You have something called Cookbooks for publishing projects and code There’s Handbooks which are complete reference for the interfaces, the APIs, and the board specs. There’s Blogs to keep you updated with what is happening in the world of mbed.
Again, the compiler is cloud-based, meaning it and all of your code live online and not locally on your machine. Of course this means there’s software tool zero installation overhead, one of the barriers we discussed before. You can think of it like web mail, pick up where you left off, hop from computer to the next. The back end is ARM’s industry standard tools called RVCT 4.0 (or RealView Compilation tools) that has it’s flags and options all defaulted. It is also a full license, not an evaluation licence, so it doesn’t expire, and you can produce images for as large as the memory on the board.
Let’s talk a little bit more about the libraries. You have high-level API libraries for all of the peripherals written in C++, which abstract away all of the nasty implementation details.. It makes writing software very quick and easy, as you don’t need to troll through hundreds of pages of the MCU’s User Guide. The pin out cards you have there make it obvious, for instance, where the SPI blocks are and how you wire them. In software, its a similar idea– you have a pre-defined C++ SPI object declared with the pins specified. The idea here is that the representation of an interface is the same in software as it is in hardware. It keeps things clean and simple. You can swap the pins in the software, swap the declaration, and your code will work in the new location.
And for the board itself, it has .1” pins in a DIP for easily plugging into breadboards, and has a USB flash Disk where your images will be loaded to over USB and pulled from by the MCU. The important headlines are : 0.1” pitch, ideal for breadboard, and stripboard Powered over USB USB flash disk for programming debug via LEDs and Serial over USB You can access the USB file system from your code, a great feature for data logging or runtime configuration
Here is where we do a live demo. Plug in mbed Go to the website, Getting Started Downloading A program Compiling a Program Take the tour Handbook Cookbook Forum Blog
When you connect the mbed board, it presents itself as a standard USB Flash disk which the operating system can communicate with. This means that it can be plugged into a PC, Mac or Linux machine with no additional drivers. The flash disk contains an HTML file that, when clicked, will open a web browser and direct you to http://mbed.org, where you can sign up for an account, or log in if you already have one. The mbed Microcontroller contains a license that can be used to create exactly one mbed user account.
On the front page of the mbed website are some useful resources. These are aimed at getting the new user up to speed as quickly as possible. The first of these is a pre-built binary which can be saved to the mbed Microcontroller and run. It is a simple LED blinking program that proves that the binary is being downloaded and run correctly. Next is the getting started guide. This is a walkthrough tour leading all the way through to compiling and running your first simple program. It should be possible for a new user to have run through all these steps in a just a few minutes.
“ DigitalOut myled(LED1)” creates the object “myled” of class “DigitalOut”, passing it parameter “LED1” which is associated with the LED1 on board. ---------------- The online compiler is a very simple IDE with RVCT installed on the web server back end. All of the options have been preset and are not configurable. All the files are stored on the server, and all the editing is done locally, so the only internet traffic is when loading or saving files, or downloading a completed binary. Being a regular compiler its output is what you’d expect. Errors and warnings with line numbers, and hints as to how your code is wrong, or a completed binary, ready to be saved to your mbed Microcontroller.
It is important to understand that the USB interface is a separate entity to the microcontroller running the binary. When you save a binary to the mbed flash drive, you have done just that, stored a file on a flash drive. When you press the reset button on the mbed, the last binary file to have been saved onto the flash drive will be loaded into the microcontrollers memory, and run. You can store other types of file on the USB flash disk, they will be ignored. Keep in mind that the flash drive has just 2Mb capacity.
The USB flash drive which you save your binary files to is accessible from your program, using standard C functions fopen, fread, fwrite, fseek, fclose. When your program is using the flash disk, it will temporarily disappear from the PC, and will return when the files are closed. This has proven to be a very useful feature for prototyping features such as run time configuration of a program, reading command files and of course data logging application. The base class “FileSystem” can be derived to work on any storage which can be exposed as block read/write. An SDCard class already exists, and other variants such as discrete SPI flash are easily possible.
The USB flash drive which you save your binary files to is accessible from your program, using standard C functions fopen, fread, fwrite, fseek, fclose. When your program is using the flash disk, it will temporarily disappear from the PC, and will return when the files are closed. This has proven to be a very useful feature for prototyping features such as run time configuration of a program, reading command files and of course data logging application. The base class “FileSystem” can be derived to work on any storage which can be exposed as block read/write. An SDCard class already exists, and other variants such as discrete SPI flash are easily possible.
To open a file, we need to use the fopen function, which returns a file pointer in this case *fp.
The USB flash drive which you save your binary files to is accessible from your program, using standard C functions fopen, fread, fwrite, fseek, fclose. When your program is using the flash disk, it will temporarily disappear from the PC, and will return when the files are closed. This has proven to be a very useful feature for prototyping features such as run time configuration of a program, reading command files and of course data logging application. The base class “FileSystem” can be derived to work on any storage which can be exposed as block read/write. An SDCard class already exists, and other variants such as discrete SPI flash are easily possible.
MSC = Mass Storage Class The important point here is similar to when we introduced the LocalFileSystem, that there are very few changes.
FIN means “end” in French. It’s a mock of French Indie films who seem to think it’s kind of a “posh” way to end films.