Common Questions and Answers in Embedded System Design

Common Questions and Answers in Embedded System Design Article Overview

This article will answer common questions aboutembedded system design. It begins with broad or conceptual questions. Other questions are more specific and may involve individual peripheral devices within the microcontroller. After browsing through the various topics, feel free to take some time to visitDigiKey Technical Forum. You will find more practical examples containing the following topics.
What is an embedded system?
An embedded system consists of hardware and software with specific functions, as part of a larger system. It typically includes one or more microprocessors or microcontrollers to supervise system functions. An embedded system includes some software that can automatically start when powered on. Often, the software runs autonomously. However, embedded systems also often include some user interface (buttons, switches, LEDs, LCDs, etc.) for external control and monitoring.
What is a microprocessor?
A microprocessor is responsible for executing all functions of the central processing unit and is manufactured as a small integrated circuit. It needs to interpret and execute program instructions, so it can be seen as the “brain” of the embedded system. A microprocessor includes digital logic that executes instructions in a specific order and uses a main clock to continuously execute instructions sequentially. The main clock is usually internally divided into individual clock signals to trigger specific hardware parts.
What is a microcontroller?
A microcontroller integrates the CPU with memory and hardware peripheral circuits for specific purposes.
In terms of memory, a microcontroller includes some non-volatile programmable memory that can become read-only during operation. This memory is where user programming application code resides, which is used to execute instructions in a specific order to achieve the overall purpose of the system. Microcontrollers typically have volatile random access memory that can be used during operation for variable manipulation and result storage. Sometimes, microcontrollers also include additional non-volatile memory to store information during power outages.
Dedicated hardware peripherals vary depending on the microcontroller. Some common hardware peripherals include timers, serial communication blocks, analog-to-digital converters, digital-to-analog converters, analog comparators, and general input/output pins.
What is the difference between parallel communication and serial communication?
When two devices communicate with each other, it means they are exchanging data. The system architecture will define how many bits each data word consists of, most commonly 8-bit, 16-bit, and 32-bit data words. Parallel communication uses dedicated lines to transmit each bit in the data word. Serial communication shifts all bits onto a single data line in some predefined order. Typically, serial communication uses a single data line and shifts each bit in sequence (prioritizing either the most significant bit (msb) or least significant bit (lsb)). However, some serial protocols may also rearrange bits in a non-sequential manner to mitigate the effects of electric fields (DC bias, electromagnetic interference, etc.) on the rest of the board.
The main advantage of using parallel communication is that it requires fewer clock cycles than serial communication when transmitting the same amount of data. For example, if an 8-bit data word is transmitted using 8 separate lines, the entire data word can be transmitted in a single clock cycle. In contrast, a serial communication protocol using a single data line would require 8 clock cycles to transmit the same data word.
The main advantage of using serial communication is that it significantly reduces the number of pins on the device and the board space required for wiring. Therefore, we can use the pins for other purposes, which often reduces the required board space and/or cable size.
Additionally, there are hybrid communication protocols that combine the advantages of both. For example, dual and quad I/O SPI protocols use multiple serial data pins to increase overall bandwidth. However, this ultimately depends on the designer’s understanding and trade-offs to determine the required/acceptable scheme for a specific application.
What is the difference between synchronous communication and asynchronous communication?
Synchronous communication means that two (or more) devices exchanging data share a common clock line. One device (usually referred to as the master) drives the clock signal as output, while the other device (usually referred to as the slave) reads the clock signal as input. As the name implies, this keeps the devices synchronized and ensures that data is set and sampled at the right time. The main advantage of synchronous communication is reliability. You don’t have to worry about setting an accurate reference clock on each device to achieve the appropriate baud rate, and temperature has little or no effect on data reliability. The downside is that it requires additional pins and often increases the required board space/cable size. Running clock signals on the board may also increase electromagnetic interference effects.
Asynchronous communication means that the two devices do not share a dedicated clock signal… each device has a unique clock. Therefore, each device must set matching bit rates in advance and the expected number of bits during a given communication step. The advantage of asynchronous communication is that it can save a pin, thus saving board space/cable size, and allows designers to use that pin for other purposes. Removing the clock line from the board also helps reduce electromagnetic interference. The disadvantage of using asynchronous communication is that reliable communication is more challenging to achieve. The reference clock used to generate the bit rate must maintain a certain accuracy and stability at the corresponding temperature, or timing may go wrong. Integer division drops may also introduce errors in the bit rate. This happens when you try to achieve a baud rate that is not an exact integer multiple of the reference clock. In other words, even with a perfect reference clock, the required baud rate may not be achievable within a certain margin of error. The margin of error may or may not be within an acceptable range.
What is I2C?
The Inter-Integrated Circuit (I2C) protocol is a widely used synchronous serial communication protocol in embedded systems, as it requires fewer pins and can connect a large number of devices to a single bus. I2C master and slave require only one data line (SDA) and one clock line (SCL) plus common ground. The following diagram (refer toI2C Baidu Encyclopedia entry) shows a simplified timing diagram of I2C communication steps. The first yellow box indicates the start signal. The start condition is the only time the SDA line transitions to low when the clock line is high. During the communication steps, the SDA transitions when SCL is low (blue), and SDA is sampled when SCL is high (green). The second yellow box indicates the stop signal. The stop condition is the only time the SDA line transitions to high when the clock line is high. Data and clock lines use open-drain outputs with external pull-up resistors. When the device stops actively driving the bus, the external resistor pulls the level of each line high.
Common Questions and Answers in Embedded System Design

I2C Timing Example

I2C is an address-based protocol, which means each slave device has a unique I2C address. I2C supports multiple masters and multiple slaves on a single bus. The device’s datasheet will specify its I2C slave address. Typically, devices will use a 7-bit I2C slave address, although some variations of the I2C protocol also support 10-bit and 16-bit addressing modes. A typical I2C communication step begins with the master issuing a start signal, followed by a single byte containing the 7-bit slave address and a single read/write bit. After the slave address byte, the message format varies by device. There is no limit to the number of bytes transmitted in a single communication step. However, each byte must receive acknowledgment from the receiving device before sending the next byte. After receiving the last byte and acknowledgment, the master will issue a stop signal to end the communication step. For devices supporting larger addressing schemes, the initial byte format may also vary. The specific device’s datasheet will describe the required I2C message format. 100kbps is the standard I2C data rate, while recent variants of I2C support 400kbps fast mode, 1Mbps fast mode +, and 3.4Mbps high-speed mode.

Common Questions and Answers in Embedded System Design

In the next image, the duty cycle increases to 75%, which means the signal is on for 75% of the time and off for 25% of the time. This will raise the voltage from 2.5V to 3.75V (75% of 5V).

Common Questions and Answers in Embedded System Design

It should be noted that the period (frequency) of the PWM signal remains unchanged. We can see that the black line intervals in the two images are uniform, and the falling edge of the signal always occurs at defined times. The rising edge, which is the pulse width, is the part we need to adjust for precise average control. The required switching frequency will be application-specific.

PWM is widely used in embedded design. Motor control, LED intensity control, and DC/DC power conversion are typical applications of pulse width modulation.

For more common questions and answers about embedded system design, please click the “Read More” button at the bottom to visit the DigiKey Technical Forum and view the post:Common Questions and Answers – Embedded System Design

Feel free to leave comments on the forum and discuss with more engineers.

Common Questions and Answers in Embedded System Design
Common Questions and Answers in Embedded System Design

Common Questions and Answers in Embedded System Design

“Star” us to not miss fresh cases and industry insights

Common Questions and Answers in Embedded System Design

Leave a Comment