DE | EN | CN

ESE block 1 basics of microcontroller

Microcontrollers were originally developed in order, for example, to be able to manufacture PC peripheral devices such as printers inexpensively. Everything you needed to control a printer was packed into a single chip, including the control software. Such small control computers were also called single-chip microcomputers back then. In the beginning these were exclusively mass products. Programming and production of the one-chip microcomputer solution were very complex. Mass produced but extremely cheap. Today the development of a microcontroller solution has become so inexpensive that it is worth considering the use of a microcontroller even for small series and individual applications.

A microcontroller contains all the necessary components in a single chip to function as a small computer:

  • Central unit (core)
    • at least one arithmetic logic unit (ALU)
    • Today often also a floating point block (FPU)

  • with control unit
  • Program memory (today mostly FLASH)
  • Data storage (usually SRAM)
  • units for internal control
    • Timer
    • Interrupt controller
    • controller for internal data exchange
    • Monitoring units
    • Input modules
      • digital input modules
      • analog input modules
    • Output modules
      • digital output modules
      • analog output modules
    • Communication modules
      • serial communication blocks (UART, SPI, …)
      • Field bus communication modules (CAN, I2C, …)
      • possibly network communication modules (Ethernet)
      • sometimes radio communication modules (Bluetooth, WiFi, NB-IoT, …)
    • and much more

With its ability as a small, complete computer to immediately perform complex control and regulation tasks with the least amount of circuitry, the microcontroller is the ideal embedded system. It fulfills its tasks via sensors and actuators. In simple embedded systems, human machine interfaces are sometimes just a button and one or a few LEDs or, in the Internet of Things, a WiFi interface and the smartphone as the user interface.

In order to clarify why one could opt for a microcontroller solution, two comparisons should be discussed.

Comparison 1:

  • discrete metal detector solution without microcontroller compared to an equivalent solution with microcontroller
  • on the left the discrete variant of a PI metal detector on the right with a microcontroller

  • the microcontroller solution has the same search performance
  • the microcontroller solution has far fewer components
  • the microcontroller solution has lower material costs
  • the microcontroller solution is smaller
  • the microcontroller solution is lighter
  • the microcontroller solution offers various search programs (is intelligent)

Comparison 2:

  • Standard module as an extension for an existing PLC control compared to an individual solution for the extension with a microcontroller. The solution is to compare two analog signals with a high sampling rate and detect disturbances and patterns.
  • on the left the standard module for expanding the PLC by two additional analog channels, on the right the individual microcontroller solution

  • Material costs for standard module approx. 200 €
  • Material costs for individual solution (3 € electronics), standard empty housing (5 €) and production costs (10h) approx. 208 €
  • Software costs for both modules about the same (implementation of the same algorithms)
  • Standard module, processing of the high volume of data in the PLC, high computer load, high bus load
  • Individual solution, processing of the high volume of data in the microcontroller, low computer load, low bus load (edge computing)
  • Standard module, sampling rate max 5 kHz
  • Individual solution, sampling rate max 150 kHz

Summary:

  • low material costs
  • high performance
  • enables very small individual room dimensions
  • Reasonable to low system costs including programming even with small quantities
  • highest flexibility
  • better market opportunities through unique selling points
  • particularly suitable for special applications, special cases
  • Reasonable costs for individual solutions, inexpensive small series, extremely inexpensive in large series

The first industry standard controllers were Intel 8051/52 8 bit controllers. These dominated the market for over 30 years. Then there were numerous suppliers of other 8-bit controller families such as Atmel's AVR and Microchips PIC. In the class of 16-bit controllers, none of the available architectures has been able to establish itself as an industry standard. It was only with the advent of the 32-bit ARM architecture that a new industry standard emerged. So we can differentiate between the following microcontroller categories:

  • classic, simple 8 bit microcontroller with the old industry standard architecture
  • modern, easy to program and electrically very robust 8 bit controller
  • Inexpensive and easy to program 16 bit controller
  • Industry standard 32 bit ARM microcontrollers from various manufacturers in many performance classes
  • special often expensive 32 and 64 bit high-performance microcontrollers (e.g. digital signal processors, DSP)

The 32-bit ARM microcontrollers now also cover most of the application areas of 8 and 16-bit controllers in terms of price and form factor. A small ARM Cortex M0 + is no more expensive than an 8-bit controller and is also available in small 8-pin housings. However, the ARM is up to ten times faster, calculates more precisely, has many more internal peripheral components, more internal memory and is still often more energy efficient. There are few reasons to decide against an ARM microcontroller.

In theory, microcontrollers can do everything that other computers such as PCs or tablets can do. Some even faster and more precisely. Nevertheless, one must take into account that there are of course resource differences due to the small size.

Power resources of modern microcontrollers:

  • Speed ​​8 MHz to 400 MHz (PCs 2 to 5 GHz)
  • Cores usually 1 sometimes 2 cores (PCs 4 - 16 cores)
  • 32-bit processing width (64-bit PCs)
  • RAM 8 KB to 200 KB SRAM (PCs 4 - 32 GB)
  • Permanent storage 16 KB to 4 MB FLASH (PCs 256 GB SSD - 4 TB HDD)
  • 400 million computing operations per second (PCs more than 500,000 MIPS)
  • Control tasks: more than 1,000,000 digital inputs or outputs per second (PCs some 1,000)
  • Signal processing: more than 100,000 analog values ​​with 8/10/12/16 bit resolution per second (PCs some 100)
  • ready for operation in a few milliseconds if required in microseconds (PCs boot time from a few seconds to a minute)

To program microcontrollers you need a PC and a development environment, as for any programming. This creates the source code and forms the executable program. The program must be loaded into the program memory of the microcontroller so that it can be executed. There are two ways to do this:

  1. a special hardware for transferring the program (left example ST-Link V2)
  2. use one of the existing communication interfaces
  • Professional programming and debugging devices mostly offer JTAG. This is a very powerful interface for troubleshooting, monitoring and also for programming embedded systems. JTAG stands for Join and Test Action Group and is laid down in the IEEE standard 1149.1.
  • Less expensive manufacturer-specific programming devices or programming devices from third-party providers offer the following interfaces, for example
    • ISP = In System Programming (proprietary)
    • SWD = Serial Wire Debug (subset of JTAG)
    • DAP = Debug Access Port (current ARM standard)

The second option, i.e. using a communication interface on the target system, requires a so-called boot loader. This is a special program that decodes and executes programming commands received via the communication interface. Standard interfaces to the PC or the higher-level systems are usually used as communication interfaces for bootloaders, such as: COM, USB, Ethernet, CAN, LIN, I2C, but also Bluetooth or WiFi.

The microcontroller board referenced in this course uses a bootloader. We use the embedded UML tool SiSy as a development environment.

The hardware platform for this course is the mySTM32 Board lite. It has a microcontroller from the STM32 family and all the necessary input and output devices.

Continue with