Professional Documents
Culture Documents
Simply put, an RTOS is a piece of software designed to efficiently manage the time of a central
processing unit (CPU). This is especially relevant for embedded systems when time is critical.
The key difference between an operating system such as Windows and an RTOS often found in
embedded systems is the response time to external events. An ordinary OS provides a non-
deterministic response to events with no guarantee with respect to when they will be processed,
albeit while trying to stay responsive. The user perceiving the OS to be responsive is more
important than handling underlying tasks. On the other hand, an RTOS' goal is fast and more
deterministic reaction.
Using an RTOS means you can run multiple tasks concurrently, bringing in the basic connectivity,
privacy, security, and so on as and when you need them. An RTOS allows you to create an
optimized solution for the specific requirements of your project.
Peripheral support, memory usage and real-time capability are key features that govern the
suitability of the RTOS. Using the wrong RTOS, particularly one that does not provide sufficient real
time capability, will severely compromise the design and viability of the final product.
The RTOS needs to be of high quality and easy to use. Developing embedded projects is difficult
and time consuming – the developer does not want to be struggling with RTOS related problems as
well. The RTOS must be a trusted component that the developer can rely on, supported by in-depth
training and good, responsive support.
The IoT technology industry has grown so huge that it has established itself as
the king of technology in every business and industry. The players who use this
technology to come up with their best products will benefit themselves a great
deal, and move miles ahead of the competition.
The leading IoT areas are transportation/automotive, healthcare, smart home
appliances, retail and wearables. Big players have already staked their claim in
the most lucrative of all consumer markets, but there is still tremendous
potential for new players.
Each year, innovations in the field of IoT have made it more exciting than ever.
Many of them are revealed through events like CES, the show that reveals to
the world what the tech world has been up to. In CES 2018, we were introduced
to the newest versions of groundbreaking technology. The best in the show
winner was The Wall by Samsung, while the People’s Choice was HTC Vive
Pro. Other interesting things on the show were rollable LG OLED TV, ultra-thin
laptops, Google Assistant, Amazon Alexa, smart thermostats & light bulbs,
Internet-connected garage door openers, GoPro cameras, and new Sony
smartphones. It means smart devices just got smarter.
This brings us to topic of wireless communication. There are so many
communication technologies around, so which one should you use? The idea is
to create user-friendly devices that can make lives easier, so the choice of
technology is very, very important.
So that leaves us with the best of the others - Bluetooth LE (BLE) and Wi-Fi.
BLE (Bluetooth Low Energy) such as iBeacons or Beacons are used to send
data over short distances. This wireless technology has become a recent
alternative for Wi-Fi, especially in IoT devices and apps. Let’s look at some
important factors that must be considered when making the choice between
BLE and Wi-Fi for wireless communication.
Privacy
Once a person turns on their Wi-Fi connection, the device will be on the
constant lookout for a Wi-Fi network. Retailers find this very useful, because
they track their customers and send them offers and discounts. It can even
track their physical movements, down to the exact location. Wi-Fi technology
does not necessarily ask the permission of the consumer to do this, because
there is no user intervention involved. If you want to be free of Wi-Fi, you will
have to disable it on your device.
For BLE technology, the consumer has to switch on the Bluetooth facility in their
phones and allow location detection. You can opt to receive in-store or indoor
notifications.
Users might want to choose a technology that gives them more privacy, more
freedom over the data they share in public. BLE offers more privacy.
Speed
BLE is more suitable for transmitting small amounts of data at 1 Mbps, like
sensor readings of temperature, acceleration details, GPS coordinates, etc.
However, BLE is not suited for sending data in real-time to a server. If real-time
data is required, a special gateway must be used to send the data.
Wi-Fi is a wireless Local Area Network (LAN) technology where two or more
electronic devices use the ISM radio bandto communicate. Bluetooth also uses
the ISM band, but Wi-Fi technology doesn’t rely solely on the proximity of the
user. Wi-Fi can triangulate the customer’s location when the device sends the
access point's BSSID (MAC address).
When it comes to micro-locating, Beacons are the best option, because Wi-Fi
signals are really not very capable of penetrating through solid objects,
including walls.
Proximity Detection
The user’s device should have Bluetooth facility. And once Bluetooth is
detected, the mobile device must be within a specified range because Bluetooth
is all about proximity, and not exact location. Both the devices should be paired
for the facility to function.
The proximity data provided by BLE is much more accurate than Wi-Fi, but not
very accurate either. The maximum range for BLE wireless connections is 30
meters, while Wi-Fi goes further beyond. It depends on the version, but you can
get well over 100 feet if you can extend the connectivity through external
antennas.
Transmission Range
Transmission range varies depending on the Bluetooth product that you use. If
you use class 2 transmitters, the transmission range is around 50 feet, but if
you use a class 1 transmitter, the range would be closer to 300 feet. But the
battery life could be affected. You can use a range extend circuit with sensitive
receivers to get a really long range.
As it is said that IoT and Big Data: two sides of the same coin, however, BLE
will not be the adequate choice for every IoT device/scenario. You may have
devices that exchange a lot of data., BLE will not be able to accomplish this. If
you want to transmit large images, Wi-Fi is the answer.
Compatibility
BLE signals can be picked up any Bluetooth 4.0 enabled devices. For Android
devices, Version 4.3 or later would be perfect, while for Apple devices, the
technology runs on Version 4S or later. Wi-Fi works on WLAN 802.11 a/b/g/n/ac
devices. For Android devices, Version 4.0 or later is the preferred choice for Wi-
Fi connectivity, while for Apple devices, you might need Version 5S or later.
Security
Both the wireless networks offer good levels of user security. But yes, initially,
passive eavesdropping was an issue in BLE, wherein a third-party device
listens to the exchange between two devices. But this issue was cleared
through AES-CCM cryptography where the data is encrypted. The key
exchange protocols that were used by the BLE initially has severe security
vulnerabilities that allowed hackers to decrypt the data that was being passed.
Key exchange that we were talking about here refers to the “pairing method” or
the association model and affects the security of the connection greatly.
The passkey method offers a certain level of protection, wherein a 6-digit
number is passed between the devices. If the hacker is not listening when the
user is typing this passkey, then it offers fairly good protection. Even if a hacker
is able to listen in on the values, then the TK process, or the Temporary Key
process offers sufficient safety.
Wi-Fi uses 256-bit encryption, whereas Bluetooth (Classic and LE) uses only
128-bit encryption. This is the usual level of security users need, but if you need
high levels of security, you might have to choose Wi-Fi. Wi-Fi has two most
popularly security accesses, Wireless Equivalent Privacy (WEP) and Wi-Fi
Protected Access (WPA2-AES) that makes it much more secure. You can
secure the Wi-Fi networks through passwords that render them safe. WPA2 is
always recommended over its predecessor, WPA.
Power Consumption
Some applications call for more Wi-Fi electrical power, as much as 40 times the
power that BLE takes up. This may be insignificant in places where electrical
power comes cheap. But for computer users who need to generate their own
electrical power through wind turbine technology and solar cells (as they are off
the power grid), this could be expensive.
iBeacon is very easy to set up and use. It can seamlessly connect to devices
and can easily contain 7 devices within a single network. However, Wi-Fi
doesn’t do it so easily. Users need to have a little bit of technical knowledge to
set up a system, and might even need the services of a technical person.
Deployment Costs
Both BLE and Wi-Fi deployment entails that companies should be prepared on
where they are going to place their devices. It also depends on the software
that will be functioning in these devices.
BLEs are less costly, self-sufficient and can run on a single battery for over 2
years, depending on usage. No configuration is required. Wi-Fi needs router
configurations, and they have to be connected to a power source. The expense
also depends on the router used and of course, the manufacturer.
Conclusion
So, as you can see, wireless communication between smart devices can
happen when a number of good technologies remains in concert with each
other. BLE is probably the most commonly used one, and more capabilities are
added to it to enhance its performance. It is more suitable when you want to
exchange simple data, not any large files or videos.
If you want to send a live video or a bandwidth intensive data, then turn away
from BLE. However, iBeacons would be good if you want to connect to your
home Wi-Fi network as it can command your device’s Wi-Fi chipset, where the
scanning and connecting to a network happens through the user’s own mobile
app. This would undoubtedly give you a very seamless experience and saves
you the trouble of manually connecting and transferring.
LoRa is ideal for applications that transmit small chunks of data with low bit rates. Data can be
transmitted at a longer range compared to technologies like WiFi, Bluetooth or ZigBee. These
features make LoRa well suited for sensors and actuators that operate in low power mode.
LoRa can be operated on the license free sub-gigahertz bands, for example, 915 MHz, 868 MHz,
and 433 MHz. It also can be operated on 2.4 GHz to achieve higher data rates compared to sub-
gigahertz bands, at the cost of range. These frequencies fall into ISM bands that are reserved
internationally for industrial, scientific, and medical purposes.
LoRaWAN
LoRaWAN is a Media Access Control (MAC) layer protocol built on top of LoRa modulation. It is a
software layer which defines how devices use the LoRa hardware, for example when they transmit,
and the format of messages.
Vaccine cold chain monitoring - LoRaWAN sensors are used to ensure vaccines are kept at
appropriate temperatures in transit.
Water conservation- Identification and faster repair of leaks in a city’s water network.
Food safety- Temperature monitoring ensures food quality maintenance.
Smart waste bins - Waste bin level alerts sent to staff optimize the pickup schedule.
Smart bikes- Bike trackers track bikes in remote areas and dense buildings.
Airport tracking - GPS-free tracking monitors vehicles, personnel, and luggage.
Efficient workspaces - Room occupancy, temperature, energy usage and parking availability
monitoring.
Cattle health - Sensors monitor cattle health, detect diseases and forecast calves delivery time.
LoRa in space - Satellites to provide LoRaWAN-based coverage worldwide.
etup we typically
see.
Sparkfun are our go-to when it comes to Xbee Modules/ZIgBee Mesh devices, we have their entire
range of Series 1, 2 and Pro boards available.
When it comes to selecting a Xbee device for your network, there are a couple of compatibility
options to be mindful of, in particular, the series of the module you use. There are Series 1 and
Series 2 devices available from Digi. Series 1 devices are the simple to use connections that are
configured to operate in a peer-to-peer manner, meaning they can essentially replace an existing
serial communication with the wireless connectivity offered by Xbee. Series 2, however, are not
pre-configured and open up that configuration to you, allowing you to not only access the peer-to-
peer configuration of series one but also branch into all of the other networking configurations you
might be wanting to take advantage of. If you are just starting out with Xbee, it's more that fine for
you to stick with the Series 1 modules. They will work out of the box and be an excellent
introduction to the system. Series 2 modules have their place too, but if you're thinking you will
need a Series 2 module it is unlikely you would be reading this article. They require a lot more
configuration than the Series 1 modules. There is one other main option you have with Xbee, that
being the 900 series. Operating on a frequency of 900MHz gives you a much greater range (up to
15 miles with the Pro 900 series boards and a high-gain antenna in outdoor environments!) but
maintains all of the features of the other Xbee modules.
If you are
looking to take advantage of the outdoor range options with the Xbee modules, the antenna plays
an important role.
There are a few options when choosing your antenna:
1. The chip antenna is the standard option for your XBee module. It has the 'worst' performance
of all the options in regards to range and sensitivity, but it requires no extra space in your
project. For a typical series one board, a chip antenna will get you an outdoor range of 140m.
2. The whip antenna is an additional antenna option that can connect to the SMA connector on
your Xbee module. For the same module used in the first example, the addition of the whip
antenna will increase the range to 258m in outdoor environments. The indoor performance will
not change with different antenna options as the penetration of the signal is a function of the
frequency, not the antenna that transmits it.
3. The PCB antenna is another option that you can choose, where the antenna is built into the
traces of the PCB of the module. Its performance is within 5% of the whip antenna option in
outdoor applications.
If you want to attach an antenna to your modules, there is usually a U.FL or RPSMA connection on
board that you can achieve that connection with too. Essentially there are plenty of options for an
antenna with your boards; be sure to check with local radio communication guidelines and your
project requirements to find something that works well for you.
The Pro Boards are the premium category of the boards offered by Digi. They offer slightly greater
powered modules (increasing the range) for a higher price point. It's a similar story to the Series 2
board here, stick with the regular models unless there's a pressing need for the change in range.
What is MQTT?
MQTT stands for Message Queuing Telemetry Transport. MQTT is a simple messaging
protocol, designed for constrained devices with low bandwidth. So, it’s the perfect
solution to exchange data between multiple IoT devices.
MQTT communication works as a publish and subscribe system.
Devices publish messages on a specific topic. All devices that are subscribed to that
topic receive the message.
Its main applications include sending messages to control outputs, read and publish data
from sensor nodes and much more.
MQTT – Publish/Subscribe
The first concept is the publish and subscribe system. In a publish and subscribe
system, a device can publish a message on a topic, or it can be subscribed to a
particular topic to receive messages
MQTT – Messages
Messages are the information that you want to exchange between your devices. It can
be a message like a command or data like sensor readings, for example.
MQTT – Topics
Another important concept is the topics. Topics are the way you register interest for
incoming messages or how you specify where you want to publish the message.
Topics are represented with strings separated by a forward slash. Each forward slash
indicates a topic level. Here’s an example of how you would create a topic for a lamp in
your home office:
1. A device publishes “on” and “off” messages on the home/office/lamp topic.
2. You have a device that controls a lamp (it can be an ESP32, ESP8266, or any
other board or device). The ESP32 that controls your lamp, is subscribed to that
same topic: home/office/lamp.
3. So, when a new message is published on that topic, the ESP32 receives the “on”
or “off” messages and turns the lamp on or off.
The device that is publishing the messages can be an ESP32, an ESP8266, or an Home
Automation controller platform with MQTT support like Node-RED, Home Assistant,
Domoticz, or OpenHAB, for example.
It provides high data rates extending from 10-100 Mbps and up. Latest LAN’s can provide
data rate up to 10 Gbps. The coverage area is less than 10 kms. Like any other Networks,
LAN also requires Hardware and Software components. Hardware consists of transmission
medium and connecting devices like Transceivers, Bridges, Switches, Repeaters etc.
Software has Application Programs which includes protocols defined by IEEE Standard. Fig.
2 shows schematic diagram of Ethernet LAN.
Fig. 2 – Schematic Diagram of Ethernet Local Area Network
Star Topology
Ring Topology
Bus Topology
Star Topology
In this network, all the nodes are connected to Central Node. The devices are not
connected to each other and transmits the messages to the Central Node. The central
node is responsible for transmitting the message to the required destination. It is the most
widely used topology for LAN’s.
Ring Topology
In this network, the nodes are interconnected to make a closed loop. Each node
communicates with the nodes on its either side with the help of Token (information
passing). The nodes with Token are allowed to transmit data. This topology eliminates the
connection of nodes with the central node i.e. there is no need of Network Server to
control other devices.
Bus Topology
In this network, all the nodes including computers and servers are connected to a single
cable termed as Bus. This network is easier compared to other networks and is
economical. Source node transmits a signal which is broadcast to all the other nodes via
Bus cable. Though the message is broadcast, the intended recipient receives the signal.
The recipient can accept the signal if its MAC Address or IP Address matches and data
transmission occurs in a single direction.
Fig. 5 – (a) Star Topology (b) Ring Topology (c) Bus Topology
a) Mesh Topology :
In a mesh topology, every device is connected to another device via a particular channel.
Figure 1: Every device is connected with another via dedicated channels. These channels
are known as links.
Suppose, N number of devices are connected with each other in a mesh topology, the
total number of ports that are required by each device is N-1. In Figure 1, there are 5
devices connected to each other, hence the total number of ports required by each
device is 4. Total number of ports required=N*(N-1).
Suppose, N number of devices are connected with each other in a mesh topology, then
the total number of dedicated links required to connect them is NC2 i.e. N(N-1)/2. In
Figure 1, there are 5 devices connected to each other, hence the total number of links
required is 5*4/2 = 10.
Advantages of this topology :
It is robust.
The fault is diagnosed easily. Data is reliable because data is transferred among the
devices through dedicated channels or links.
Provides security and privacy.
Problems with this topology :
Installation and configuration are difficult.
The cost of cables is high as bulk wiring is required, hence suitable for less number of
devices.
The cost of maintenance is high.
Physical Layer
Data Link Layer
Network Layer
Fig. 6 – Seven Layers of OSI Model
Physical Layer
The Physical Layer transmits raw data bits over communication lines. It deals with
establishing physical circuit between devices. Physical Layer protocols and standards are
responsible for type of modulation to be used for transmitting digital data over
analog transmission lines. It accounts for the components of network like Multiplexers,
Repeaters, Modems etc.
Network Layer
The Network Layer helps in routing the data across the network from source node to
receiving node. This Layer provides interface between a host and the network. Based on
Topology used, routing of packets takes place to the receiving device where the conversion
of data occurs and the original data is obtained.
Read More About OSI Model, Characteristics of Seven Layers, Why to Use it &
Limitations
Applications of LAN (Local Area Network)
The applications include:
LAN is used for school environment, offices, hospitals etc as it allows sharing of
resources like sharing data, scanners, printing and internet.
LAN serves users at home to access internet.
LAN’s are widely used in manufacturing industries where a central server coordinates
the activities of other machines.
High speed LANs are typically used to connect many slower networks together.
Using source-routed mesh network technology, Z-Wave signals can hop through other Z-Wave
devices to reach the device a user intends to control. Each Z-Wave network accommodates a
maximum of four hops.
The Z-Wave protocol operates on the low-frequency 908.42 band in the U.S. and the 868.42 MHz
band in Europe. Though interference with other home electronics, such as cordless phones, is
possible, the protocol avoids interference with the 2.4 GHz band where Wi-Fi and Bluetooth
operate.
Z-Wave offers transmission rates of small data packets using throughput rates of 9.6 kbps, 40
kbps or 100 kbps. The Z-Wave PHY and MAC layers are based on the ITU-T G.9959 global
radio standard, and the protocol uses GFSK modulation and Manchester encoding. It also
includes AES 128 encryption, IPv6 and multichannel operation.
Communication between devices ranges from 98 to 328 feet; the 500 Series has a range of 130
feet and the 700 Series 328 feet. Because walls and other dense building materials limit the range,
the general deployment best practice is to place Z-Wave devices 50 feet or fewer apart for
maximum signal strength.
Using a Z-Wave repeater -- an additional Z-Wave device between other devices -- or using line-
powered -- not battery-powered -- devices in the network can also strengthen the signal and help
it reach its destination. The maximum range with four hops is estimated to be 600 feet.
In regards to battery life, some 700 Series Z-Wave devices can last up to 10 years on a coin cell
battery, while many other battery-powered devices last a year or longer.
To bear the Z-Wave branding, smart home products must become Z-Wave certified. This
involves meeting a number of requirements and, most importantly, being interoperable with all
other Z-Wave-certified devices.
Z-Wave operates on the low-frequency 908.42 band while the Zigbee protocol operates
at 2.4 GHz. While the higher frequency allows Zigbee to transmit more data faster -- 40-
250 kbps to Z-Wave's 9.6 to 100 kbps -- it reduces the range of the signal. Z-Wave's
range of 98 feet is greater than Zigbee's 32-foot range. As an open standard run by the
Zigbee Alliance, Zigbee chips are available from multiple vendors, while Z-Wave chips
are only available from Silicon Labs.
Zigbee is often perceived as more complex due to its multiple protocols; for example, it
offers specifications for smart energy, healthcare, gateways and more -- which
historically do not communicate well together. However, the release of Zigbee 3.0 aims
to address this issue and address the complexity.
A Zigbee network, which doesn't have a maximum number of allowed hops, can support
more than 65,000 devices, while a Z-Wave network, limited to four hops, supports a
maximum of 232 devices.
Often considered an either/or situation, many smart home hubs today, including
Samsung SmartThings and Wink Hub, support both standards, allowing Zigbee and Z-
Wave devices to communicate with each other, so there is no need to choose one over
the other.
According to I2C protocols, the data line can not change when the clock line is high, it can
change only when the clock line is low. The 2 lines are open drain, hence a pull-up resistor
is required so that the lines are high since the devices on the I2C bus are active low. The
data is transmitted in the form of packets which comprises 9 bits. The sequence of these
bits are –
1. Start Condition – 1 bit
2. Slave Address – 8 bit
3. Acknowledge – 1 bit
Advantages :
Can be configured in multi-master mode.
Complexity is reduced because it uses only 2 bi-directional lines (unlike SPI
Communication).
Cost-efficient.
It uses ACK/NACK feature due to which it has improved error handling capabilities.
Limitations :
Slower speed.
Half-duplex communication is used in the I2C communication protocol.
Serial peripheral interface (SPI) is one of the most widely used interfaces between microcontroller
and peripheral ICs such as sensors, ADCs, DACs, shift registers, SRAM, and others. This article
provides a brief description of the SPI interface followed by an introduction to Analog Devices’ SPI
enabled switches and muxes, and how they help reduce the number of digital GPIOs in system
board design.
SPI is a synchronous, full duplex master-slave-based interface. The data from the master or the
slave is synchronized on the rising or falling clock edge. Both master and slave can transmit data at
the same time. The SPI interface can be either 3-wire or 4-wire. This article focuses on the popular
4-wire SPI interface.
Interface
The device that generates the clock signal is called the master. Data transmitted between the
master and the slave is synchronized to the clock generated by the master. SPI devices support
much higher clock frequencies compared to I 2C interfaces. Users should consult the product data
sheet for the clock frequency specification of the SPI interface.
SPI interfaces can have only one master and can have one or multiple slaves. Figure 1 shows the
SPI connection between the master and the slave.
The chip select signal from the master is used to select the slave. This is normally an active low
signal and is pulled high to disconnect the slave from the SPI bus. When multiple slaves are used,
an individual chip select signal for each slave is required from the master. In this article, the chip
select signal is always an active low signal.
MOSI and MISO are the data lines. MOSI transmits data from the master to the slave and MISO
transmits data from the slave to the master.
Data Transmission
To begin SPI communication, the master must send the clock signal and select the slave by
enabling the CS signal. Usually chip select is an active low signal; hence, the master must send a
logic 0 on this signal to select the slave. SPI is a full-duplex interface; both master and slave can
send data at the same time via the MOSI and MISO lines respectively. During SPI communication,
the data is simultaneously transmitted (shifted out serially onto the MOSI/SDO bus) and received
(the data on the bus (MISO/SDI) is sampled or read in). The serial clock edge synchronizes the
shifting and sampling of the data. The SPI interface provides the user with flexibility to select the
rising or falling edge of the clock to sample and/or shift the data. Please refer to the device data
sheet to determine the number of data bits transmitted using the SPI interface.
SEP 2018
VOL 52
Serial peripheral interface (SPI) is one of the most widely used interfaces between microcontroller and
peripheral ICs such as sensors, ADCs, DACs, shift registers, SRAM, and others. This article provides a brief
description of the SPI interface followed by an introduction to Analog Devices’ SPI enabled switches and
muxes, and how they help reduce the number of digital GPIOs in system board design.
SPI is a synchronous, full duplex master-slave-based interface. The data from the master or the slave is
synchronized on the rising or falling clock edge. Both master and slave can transmit data at the same time.
The SPI interface can be either 3-wire or 4-wire. This article focuses on the popular 4-wire SPI interface.
Interface
SPI interfaces can have only one master and can have one or multiple slaves. Figure 1 shows the SPI
connection between the master and the slave.
The chip select signal from the master is used to select the slave. This is normally an active low signal and is
pulled high to disconnect the slave from the SPI bus. When multiple slaves are used, an individual chip select
signal for each slave is required from the master. In this article, the chip select signal is always an active low
signal.
MOSI and MISO are the data lines. MOSI transmits data from the master to the slave and MISO transmits
data from the slave to the master.
Data Transmission
To begin SPI communication, the master must send the clock signal and select the slave by enabling the CS
signal. Usually chip select is an active low signal; hence, the master must send a logic 0 on this signal to
select the slave. SPI is a full-duplex interface; both master and slave can send data at the same time via the
MOSI and MISO lines respectively. During SPI communication, the data is simultaneously transmitted
(shifted out serially onto the MOSI/SDO bus) and received (the data on the bus (MISO/SDI) is sampled or
read in). The serial clock edge synchronizes the shifting and sampling of the data. The SPI interface provides
the user with flexibility to select the rising or falling edge of the clock to sample and/or shift the data. Please
refer to the device data sheet to determine the number of data bits transmitted using the SPI interface.
Figure 2 through Figure 5 show an example of communication in four SPI modes. In these examples, the data
is shown on the MOSI and MISO line. The start and end of transmission is indicated by the dotted green line,
the sampling edge is indicated in orange, and the shifting edge is indicated in blue. Please note these figures
are for illustration purpose only. For successful SPI communications, users must refer to the product data
sheet and ensure that the timing specifications for the part are met.
Figure 2. SPI Mode 0, CPOL = 0, CPHA = 0: CLK idle state = low, data sampled on rising edge and shifted
on falling edge.
Figure 3 shows the timing diagram for SPI Mode 1. In this mode, clock polarity is 0, which indicates that the
idle state of the clock signal is low. The clock phase in this mode is 1, which indicates that the data is sampled
on the falling edge (shown by the orange dotted line) and the data is shifted on the rising edge (shown by the
dotted blue line) of the clock signal.
Figure 3. SPI Mode 1, CPOL = 0, CPHA = 1: CLK idle state = low, data sampled on the falling edge and
shifted on the rising edge.
Figure 4 shows the timing diagram for SPI Mode 2. In this mode, the clock polarity is 1, which indicates that
the idle state of the clock signal is high. The clock phase in this mode is 1, which indicates that the data is
sampled on the falling edge (shown by the orange dotted line) and the data is shifted on the rising edge
(shown by the dotted blue line) of the clock signal.
Figure 4. SPI Mode 2, CPOL = 1, CPHA = 1: CLK idle state = high, data sampled on the falling edge and
shifted on the rising edge.
Figure 5 shows the timing diagram for SPI Mode 3. In this mode, the clock polarity is 1, which indicates that
the idle state of the clock signal is high. The clock phase in this mode is 0, which indicates that the data is
sampled on the rising edge (shown by the orange dotted line) and the data is shifted on the falling edge
(shown by the dotted blue line) of the clock signal.
Figure 5. SPI Mode 3, CPOL = 1, CPHA = 0: CLK idle state = high, data sampled on the rising edge and
shifted on the falling edge.
Universal asynchronous receiver-transmitter (UART) is one
of the simplest and oldest forms of device-to-device digital
communication. You can find UART devices as a part of
integrated circuits (ICs) or as individual components. UARTs
communicate between two separate nodes using a pair of
wires and a common ground.
UART Protocol Guide
As a “universal” setup, we can configure UART to work with many different types of serial protocols.
UART was adapted into single-chip units in the early 1970s, starting with Western Digital’s WD1402A.
2. Data travels to and from a UART in parallel to the controlling device (e.g., a CPU).
3. When sending on the Tx pin, the first UART translates this parallel information into serial and transmits
it to the receiving counterpart.
4. The second UART receives this data on its Rx pin and transforms it back into parallel to communicate
with its controlling device.
- Full duplex: Simultaneous communication to and from each master and slave
Data transmission takes place in the form of data packets, beginning with a start bit, where the ordinarily
high line is pulled to ground. After the start bit, five to nine data bits transmit in what is known as the
packet’s data frame, followed by an optional parity bit to verify proper data transmission. Finally, one or
more stop bits are transmitted where the line is set to high. This ends a packet.
As an asynchronous protocol— no clock line regulates data transmission speed— users must set both
devices to communicate at the same speed. This speed is known as the baud rate, expressed in bits per
second, or bps. Transmission speeds vary dramatically, from the typical 9600 baud setting to 115200 and
beyond.
While something of an “ancient” protocol, and one that can only communicate between a single master
and slave, UART is well known, easy to set up, and extremely versatile. As such, you’re likely to
encounter this system when working with microcontroller projects. UARTs may be a part of systems that
you use every day, whether you realize it or not.
ADVANTAGES
Only uses two wires
The structure of the data packet can be changed as long as both sides are set up for it
DISADVANTAGES
The size of the data frame is limited to a maximum of 9 bits