Chapter 9. The Arduino ARM Family

The original Arduino family of boards was based on Atmel AVR 8-bit microcontrollers. These devices are excellent in terms of price, flexibility, and ease of use, but the limited processing speed and small memory size make it difficult to support modern networking protocols. Arduino has taken advantage of the availability of low-cost 32-bit microcontrollers based on the ARM architecture to create a family of dramatically more powerful and flexible boards.

What’s the difference between AVR and ARM?

Both AVR and ARM refer to families of devices. The ARM architecture was developed by the ARM company and is licensed to other companies, while the AVR architecture was developed by Atmel and pretty much stayed within Atmel (now owned by Microchip).

Both AVR and ARM are microprocessors. AVR never appears as a stand-alone microprocessor, but is always integrated with memory, input-output ports, and other peripherals to make a microcontroller. ARM, on the other hand, is available both as part of a microcontroller, as well as a stand-alone microprocessor.

The AVR based microcontroller line started with relatively simple and slow 8 bit processors, and the product line has since grown to include 16 and 32 bit processors.  Designed from the start to be the core of a microcontroller, the AVR processor has efficient commands for manipulating individual bits in input-output ports, while the more generic ARM processor might lack these features.

ARM based microcontrollers, on the other hand, are typically 32 bit devices with more complex peripherals, with substantially more memory, and running at speeds greater than AVR based devices.

What difference does 32 bits really make?

The phrases “8 bits”, “32 bits”, and “64 bits” are seen quite frequently these days, but what do they really mean? They mean that microcontroller’s internal pathways can carry that many bits of data at the same time. At the very least, this means that whenever a 32-bit microcontroller wants to get information from memory, it can get 4 times as much as an 8-bit microcontroller could in the same amount of time, just as a 32 lane highway could carry 4 times as many cars at a time than an 8 lane highway could. Furthermore, it means that most of the internal processing, such as mathematical calculations, work on 32 bits at a time. This means that numerical calculations will be much faster. This, coupled with the faster clock speed, makes these boards practical for larger programs and more complex calculations where an 8-bit microcontroller might not have been able to read sensors, analyze the data, make a decision, and output control signals fast enough.

What’s the difference between a microcontroller and a microprocessor?

There is no hard definitions and many devices blur the distinction, but these are general guidelines:

A microcontroller is designed to be self-contained device that can be used to control a wide range of machines. In this context it is called an embedded controller. In addition to the processor, a microcontroller will include program and data memory and a range of peripherals such as timers, input and output ports, and analog-to-digital and digital-to-analog converters. The outputs of a microcontroller will usually be able to provide enough current to drive LEDs and possibly even small relays. A microcontroller typically does not have an operating system, but runs only the program necessary to control the machine. A microcontroller is designed for building embedded systems with as few external components as possible.

A microprocessor is only the core of a computer, the part that reads data from memory, manipulates that data, and stores the results back in memory. A microprocessor is expected to be part of a larger system, and lacks memory and peripherals. Because it is expected to interface to other integrated circuits, a microprocessor will have very limited ability to provide current. This current will be enough to connect to the inputs of other integrated circuits, but probably not enough to drive even LEDs.  Microprocessors range from very simple and relatively slow, that might be used in a microcontroller, to very complex and fast, such as those used in modern desktop computers.

Which is better: AVR or ARM?

The answer to this depends entirely on what you are trying to do. Generally speaking, AVR based systems will be less expensive and simpler to design and program. On the other hand, systems that require lots of memory and faster, more complex programs are likely to be better served with ARM based devices.

If you are just getting started, you should almost certainly should start with Arduino boards based on the simpler, more common AVR family. If you feel comfortable with Arduino circuits and programs, and need special features like wireless networking or complex mathematical calculations, then an ARM based Arduino is probably more suitable because the increased word size, speed, and amount of memory are better able to handle the larger and more complex programs.

Another reason you might choose an ARM based board is if you want to do any networking. With much more memory (256KB FLASH, compared to 32K on the Uno, and 32KB SRAM compared to 2K on the Uno, on all ARM based Arduino boards except the BLE and BLE Sense which have 1MB FLASH and 256KB SRAM) and much faster processing speed, these boards are ideal for handling wired or wireless networking protocols. As you’ll see below, most ARM based Arduino boards support one or more wireless networking protocol.

Introducing the Arduino ARM based boards

Here we introduce the ARM family of Arduino boards. These boards use three variations of the ARM core: Cortex M0, Cortex M0+, and M4.

The ARM Cortex M0 core was optimized for low cost as a 32 bit replacement for 8 bit microcontrollers. The Cortex M0+ was further optimized to reduce power and adds some new features. The Cortex M4 is a much more powerful core with a range of new features designed to support industries such as motor control, automotive, power management, embedded audio and industrial automation with the addition of DSP (Digital Signal Processing) instructions and an optional FPU (Floating Point Unit). The DSP instructions and the FPU allow the Cortex M4 to perform mathematical operations extremely quickly.

As of this writing, the ARM family of Arduino boards consists of:

  • Arduino Zero (Uno R3 footprint, ARM Cortex-M0+ microcontroller)
  • Arduino Nano 33 BLE (Nano footprint, ARM Cortex-M4 microcontroller, BLE and Bluetooth radio protocols)

  • Arduino Nano 33 BLE Sense (Nano footprint, ARM Cortex-M4 microcontroller, BLE and Bluetooth radio protocols)

  • Arduino Nano 33 IoT (Nano footprint, ARM Cortex-M0+ microcontroller, WiFi, BLE, and Bluetooth radio protocols)

  • Arduino MKR Zero (MKR footprint, ARM Cortex-M0+ microcontroller

  • Arduino MKR WAN 1300, 1310 - (MKR footprint, ARM Cortex-M0+ microcontroller, LoRa (low bandwidth, long-range) radio protocol)

  • Arduino MKR Vidor 4000 - (MKR footprint, ARM Cortex-M0+ microcontroller, WiFi, BLE, and Bluetooth radio protocols)

  • Arduino MKR NB 1500 - (MKR footprint, ARM Cortex-M0+ microcontroller, internet over 4G GSM network radio protocol)

  • Arduino MKR WiFi 1010 - (MKR footprint, ARM Cortex-M0+ microcontroller, WiFi, BLE, and Bluetooth radio protocols)

  • Arduino MKR GSM 1400 - (MKR footprint, ARM Cortex-M0+ microcontroller, internet over 3G GSM network radio protocol)

Special Features

Some of these boards have other special features. The Arduino MKR Zero has an I2S port and an SD card socket. I2S is a digital audio interface. With these capabilities, the MKR Zero can play and analyze audio files and can connect directly to other digital audio devices which support the I2S interface.

In addition to the ARM microcontroller common on all these boards, the Arduino MKR Vidor 4000 includes a device called a Field Programmable Gate Array or FPGA. While beyond the scope of this book, an FPGA contains a large number of the hardware building blocks (gates) that are present in every digital integrated circuit, and the way these gates are connected can be controlled through software. Thus, an FPGA basically allows you to design integrated circuits. Because your design is implemented in hardware, as opposed to software, a project implemented on an FPGA is incredibly fast. For example, the Arduino MKR Vidor 4000 includes a micro HDMI port, because it is fast enough to generate video frames in real-time.

Operating Voltage

In contrast to the Arduino Uno, which operates at 5 V, all of the ARM boards operate at 3.3 volts, so they will run off a single cell rechargeable Li-Ion or Li-Po battery. Some of the boards, such as the MKR WIFI 1010 and the MKR WAN 1310, include a battery connector and charging circuitry that will charge the battery whenever USB power is available, making these boards ideal for wireless battery operated projects.

Operating at 3.3 V means that you must take this into consideration when connecting external components such as LEDs and sensors. Switches and resistive sensors, such as the LDR we learned about in "Use a Light Sensor Instead of the Pushbutton" in Chapter 5, will work fine, but active sensors designed for 5 V, such as the sensor from "Testing the Temperature and Humidity Sensor" in Chapter 8, may not work properly at 3.3 V. Extreme caution must be used when mixing both 3.3 V and 5 V components in a circuit. In particular, voltages greater than 3.3 V must never be present at any pin of a 3.3 V component.

Drive Current

In "Driving Bigger Loads (Motors, Lamps, and the Like)" in Chapter 5, we learned that each pin on an Arduino should be used for at most 20 milliamps. Checking on the Arduino website for "DC Current per I/O Pin" under “Tech Specs”, we find that for all Arduino boards based on the SAMD21 microcontroller (indicated above by ARM Cortex-M0+) this number is only 7 milliamps! Assuming a worst-case LED voltage of 1.8V, 3.3v - 1.8v leaves 1.5V on the resistor, and solving Ohm’s law for resistance R = V/I = 1.5/0.007 = 220 ohms. This means that you should always use a resistor of at least 220 ohms with an LED, and if your LED is too faint you will need to use a transistor.

 

Digital to Analog Converter

Although all Arduinos support the analogWrite() function, in "Controlling Light with PWM" in Chapter 5, you learned that Arduino simulates an analog voltage by using Pulse Width Modulation (PWM). This works fine to control the brightness of LEDs and the speed of motors, but sometimes you might need a true analog voltage. In that case, the ARM-based boards are ideal because they contain a device called a Digital to Analog Converter or DAC. This does exactly what you would expect: You give it a number, and it generates a voltage proportional to that number. This can be invaluable for controlling a variety of devices.

Arduino boards that have a DAC include: Arduino Zero, Arduino Nano IOT, Arduino MKR 1010, Arduino MKR WAN, Arduino MKR NB, Arduino MKR GSM, and Arduino MKR Vidor 4000

USB Host

Arduino boards based on the SAMD21 microcontroller (indicated above by ARM Cortex-M0+) can configure a USB port in the Host mode. This means that rather than being a dumb device, subject to the whims of the USB Host, your SAMD21-based Arduino can be a USB Host initiating transactions with USB devices such as a keyboard or a mouse. In addition, these boards can pretend to be USB devices such as a keyboard or a mouse, controlling an attached computer or invoking and then sending data to program on an attached computer.

The Nano and MKR footprints

Except for the Arduino Zero, which is in the traditional Arduino Uno R3 footprint, all other ARM-based Arduino boards are in either the Nano or the MKR footprints. Apart from size, what sets these apart is the type of connector used for the pins: instead of sockets mounted on the top of the board, as was the case with the Arduino Uno, the Nano and MKR footprints have pins that are mounted on the bottom of the board, making them suitable to plug directly into a breadboard. Similarly, whereas shields sit on top of an Uno, shields for MKR or Nano boards sit underneath the microcontroller board.

 

 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.235.99