Embedded Protocols Overview
-
GPIO (General Purpose Input/Output)
GPIO refers to digital pins on microcontrollers that can be configured as input or output for controlling or reading data from external devices. These pins do not have a dedicated function but are general-purpose, allowing developers to control various devices such as LEDs, sensors, and switches.
Key Features
- Configurable as input or output.
- Digital signaling (high or low, 1 or 0).
- Interrupt handling: Can trigger actions based on external events.
Use Cases
- Control LEDs or read from buttons.
- Interfacing with sensors that use binary data.
- Toggling relays or motor drivers.
-
ADC (Analog-to-Digital Converter)
An ADC converts an analog signal (voltage) into a digital value that a microcontroller can process. It is used in systems where signals like temperature, light, or sound need to be interpreted by a digital system.
Key Features:
- Converts analog signals to digital values.
- Resolution typically from 8-bit to 16-bit.
- Supports multiple input channels.
Use Cases:
- Reading analog sensors (temperature, light, pressure).
- Converting audio signals into digital form.
- Measuring battery voltage.
-
SPI (Serial Peripheral Interface)
SPI is a high-speed, synchronous communication protocol used for short-distance communication in embedded systems. It typically involves a master and one or more slaves, using four lines: SCK (clock), MOSI (Master Out Slave In), MISO (Master In Slave Out), and SS (Slave Select).
Key Features:
- Full-duplex communication.
- Faster than I2C with speeds up to tens of Mbps.
- Supports multiple slave devices.
Use Cases:
- Interfacing with sensors (accelerometers, gyroscopes).
- Communicating with SD cards and flash memory.
- Interfacing with display controllers (LCD, OLED).
-
I2C (Inter-Integrated Circuit)
I2C is a synchronous, multi-master, multi-slave, packet-switched protocol used for communication between low-speed peripherals in embedded systems. It uses only two lines: a clock (SCL) and a data line (SDA).
Key Features:
- Two-wire communication.
- Supports multiple masters and slaves.
- Devices are addressed by a 7-bit or 10-bit address.
Use Cases:
- Communication with sensors (temperature, accelerometers).
- Interfacing EEPROM, LCD controllers.
- Communicating between microcontrollers.
-
UART (Universal Asynchronous Receiver/Transmitter)
UART is a simple communication protocol used for serial communication between devices. It is asynchronous, meaning it does not require a clock line, only two lines: TX (transmit) and RX (receive).
Key Features:
- Asynchronous communication (no clock required).
- Full-duplex communication using TX and RX.
- Widely used for debugging and low-speed data transfer.
Use Cases:
- Debugging and console interfaces.
- Communication between microcontrollers and modules (GPS, Bluetooth).
- Serial communication with computers or other devices.
-
PWM is a technique used to simulate an analog output by varying the width of digital pulses. It is commonly used in controlling the speed of motors, brightness of LEDs, and other applications requiring a variable output.
Key Features:
- Controls output using duty cycle modulation.
- Used for power control or signal modulation.
- Can simulate analog output using digital pins.
Use Cases:
- Motor speed control.
- LED brightness control.
- Servo motor positioning.
-
DMA allows peripherals to directly transfer data to or from memory without involving the CPU. This significantly increases data transfer efficiency, especially for tasks requiring high-speed data processing like audio or video streaming.
Key Features:
- CPU-independent data transfer.
- High throughput for data-intensive operations.
- Can be used with various peripherals like ADC, SPI, UART.
Use Cases:
- High-speed data acquisition systems.
- Audio and video processing.
- Reducing CPU load during data transfers.
-
CAN is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other without a host computer. It is widely used in automotive and industrial applications.
Key Features:
- Multi-master, multi-slave communication.
- Error detection and correction mechanisms.
- Supports communication between multiple devices on the same bus.
Use Cases:
- Automotive networks (engine control, body control).
- Industrial automation.
- Medical devices.
-
1-Wire is a communication protocol that allows devices to communicate over a single data line and ground. It is often used for communication with low-speed devices such as temperature sensors (e.g., DS18B20).
Key Features
- Single-wire data and power communication.
- Low power and simple wiring.
- Addressable devices: Multiple devices can share the same bus.
Use Cases:
- Temperature sensors.
- Identification chips (e.g., for product authentication).
-
An RTC is a time-keeping component that keeps track of the current time (seconds, minutes, hours, days, etc.) even when the microcontroller is powered off. It often has its own battery backup to maintain time when the system is off.
Key Features:
- Keeps accurate time even when power is lost.
- Can trigger alarms or timed events.
- Consumes very low power.
Use Cases:
- Keeping track of time in data loggers.
- Timed operations or event scheduling.
- Wake-up functions in low-power applications.
-
Header Files
Below is the list of available headers for
Embedded Protocols
, along with a brief description of their functionalities:-
drv_analog_in.h: Provides an API for analog input reading functionalities using ADC (Analog-to-Digital Converter).
-
drv_name.h: Provides microcontroller's pin and port name type definitions.
-
drv_digital_in.h: Offers functions for managing digital input pins, enabling the reading of digital signals.
-
drv_digital_out.h: Provides functions to control digital output pins, allowing the setting of pin states.
-
drv_port.h: General-purpose port driver functions, managing operations on GPIO ports.
-
drv_i2c_master.h: Contains the API for I2C (Inter-Integrated Circuit) master mode communication, used for interfacing with I2C devices.
-
drv_pwm.h: Pulse Width Modulation driver that allows control of PWM signals for applications such as motor control or LED dimming.
-
drv_spi_master.h: API for SPI (Serial Peripheral Interface) master mode, facilitating communication with SPI-based peripherals.
-
drv_uart.h: Provides UART (Universal Asynchronous Receiver/Transmitter) communication functionalities, supporting serial communication with other devices.
-
drv_one_wire.h: Implements the One-Wire protocol driver, useful for communication with One-Wire devices like sensors and memory chips.
-
drv_can.h: CAN (Controller Area Network) bus communication driver, allowing data exchange between devices in automotive and industrial applications.
-
drv_rtc.h: Real-Time Clock driver for managing date and time functionalities in embedded systems.
-
drv_dma.h: Direct Memory Access driver, enabling efficient data transfer between peripherals and memory without CPU intervention.
-
-
How to Use These Headers?
Each driver header file provides a set of functions that can be easily integrated into your NECTO Studio projects.
To use a specific driver, include the corresponding header file in your code, enable this exact library in the NECTO Studio's
Library Manager
, initialize the driver in yourmain.c
file, and call the available functions to interact with the hardware.The mikroSDK v2.0 drivers offer a rich set of APIs that abstract away the complexity of hardware interfacing, allowing developers to focus on building robust embedded applications.
By utilizing these drivers, NECTO Studio users can significantly speed up their development process while ensuring compatibility and performance across various hardware platforms.