Middleware Libraries
The normal usage models of some of the more complex peripherals (e.g., USB or network interfaces) require interpreting complex protocols or may require substantial additional processing to produce useable results, such as drawing graphical images on an LCD screen with an LCD controller peripheral. Therefore, while a device driver may be completely sufficient for a simple peripheral like a UART, some peripherals require what is frequently called middleware (aptly named because it sits between your application and the hardware abstraction_layer or driver_layer). MPLAB® Harmony provides several middleware library stacks to manage these more complex peripherals and provide the functionality you need and expect.
MPLAB Harmony middleware stacks are usually built upon device drivers and system services so that they can be supported on any Microchip microcontroller for which the required driver or service is supported. However, special-purpose implementations may be available that integrate the driver, certain services, and various modules within the stack for efficiency.
Click on the links below to get more details on each Middleware Library
Communication over the internet is accomplished by implementing the IP protocol. Functions like web pages, email, and FTP are advanced services that are part of a full IP stack implementation. Microchip offers a free full TCP/IP software stack optimized for the PIC32 family of MCUs and it operates seamlessly with Microchip's standalone Ethernet controllers (ENC28J60/ENC624J600) and WiFi modules (MRF24WG0M).
MPLAB® Harmony TCP/IP compliant software is also available from third-party companies.
The MPLAB Harmony TCP/IP Stack provides a foundation for embedded network applications by handling most of the interaction required between the physical network port and your application. It includes modules for several commonly used application layers, including HTTP for serving web pages, SMTP for sending emails, SNMP for providing status and control, Telnet, TFTP, Serial-to-Ethernet and much more. In addition, the stack includes lightweight and high-performance implementations of the TCP and UDP transport layers, as well as other supporting modules such as IP, ICMP, DHCP, ARP, and DNS.
Key Features:
- IPv6 support (gold certified)
- Fully dynamic:
- Stack initialization/de-initialization
- Interface up/down
- Resource management
- Module configuration
- Multiple interfaces (Ethernet and WiFi)
- Run-time configuration (console)
- Interrupt driven operation
- Real-Time Operating System (RTOS) friendly
Click the full-screen icon in the lower right corner to view the video in full screen. Click on the video title to view directly on YouTube.
Learn More
The third-party company, wolfSSL, offers MPLAB® Harmony compliant software for TCP/IP applications.
SSL/TLS Library from wolfSSL
CyaSSL is a lightweight C-language-based SSL/TLS library targeted for embedded, RTOS, or resource-constrained environments primarily because of its small size, speed, and portability. CyaSSL supports industry standards up to the current TLS 1.2 and DTLS 1.2 levels. It is up to 20 times smaller than OpenSSL offering a simple API, an OpenSSL compatibility layer, OCSP and CRL, and several progressive ciphers. CyaSSL is under active development and should be chosen over yaSSL when possible.
Key Features:
- Up to TLS 1.2 and DTLS 1.2
- Full client and server support
- Progressive list of supported ciphers
- Key and Certificate generation
- OCSP, CRL support
- Support Available
- Small Size: 20-100 kB
- Runtime Memory: 1-36 kB
- 20X smaller than OpenSSL
For more information, see the wolfSSL webiste.
Microchip’s MPLAB® Harmony USB software includes royalty-free source code and example projects. It provides support for USB device mode, embedded host, and On-The-Go (OTG) for PIC32 microcontrollers.
USB Device Library
The MPLAB Harmony USB Device Library (referred to as the USB Device Library) provides embedded application developers with a framework to design and develop a wide variety of USB Devices. A choice of full speed only or full speed and hi-speed USB operations are available, depending on the selected PIC32 microcontroller. The USB Device Library facilitates the development of standard USB devices through function drivers that implement standard USB device class specification. Vendor USB devices can also be implemented via USB Device Layer Endpoint functions. The USB Device Library is modular, thus allowing application developers to readily design composite USB devices. The USB Device Library is a part of the MPLAB Harmony installation and is accompanied by demonstration applications that highlight library usage. These demonstrations can also be modified or updated to build custom applications.
The USB Device Library features the following:
- Support for different USB device classes (CDC, Audio, HID, MSD, and Vendor)
- Supports multiple instances of the same class in a composite device
- Supports multiple configurations at different speeds
- Supports full speed and high-speed operation
- Supports multiple USB peripherals (allows multiple device stacks)
- Modular and Layered architecture
- Supports deferred control transfer responses
- Completely non-blocking
- Supports both polled and interrupt operations
- Works readily in a Real-Time Operating System (RTOS) environment
USB Host Library
The MPLAB Harmony USB Host Library (referred to as the USB Host Library) provides embedded application developers with a framework to design and develop USB host support for a wide variety of USB device classes. A choice of full speed only or full speed and high-speed USB operations are available, depending on the selected PIC32 microcontroller. The USB Host Library facilitates support of standard USB devices through class drivers that implement standard USB device class specification. Support for custom USB devices can also be implemented via a generic class driver. The USB Host Library is modular, thus allowing application developers to readily support composite USB devices. The USB Host Library is a part of the MPLAB Harmony installation and is accompanied by demonstration applications that highlight library usage. These demonstrations can also be modified or updated to build custom applications.
The USB Host Library features the following:
- Class Driver Support (CDC, Audio, HID, MSD, and Generic)
- Designed to support USB devices with multiple configurations at a different speed
- Supports low speed, full speed, and high-speed operation.
- Supports multiple USB peripherals (allows multiple host stacks)
- Modular and Layered architecture
- Completely non-blocking
- Supports both polled and interrupt operation.
- Works readily in an RTOS environment.
- Designed to readily integrate with other Harmony Middleware
This library provides all of the functionality of the Bluetooth® stack interfaces including profiles and protocols at the lower levels. These are utilized in a number of demonstration applications used in the PIC32 Bluetooth Audio Development Kit. Specific demonstrations to illustrate the various connection options, data and audio communications and control interfaces are available for purchase through Microchip Direct.
The PIC32 Bluetooth SPP-only (Serial Port Profile (SPP)) Stack Library is created under license from SEARAN LLC. and uses the dotstack™ framework. This library has been qualified for use and a Qualified Design ID (QDID) is available from Bluetooth SIG. More information about the qualification process can be found in the "PIC32 Bluetooth Audio Development Kit Reference Guide" (DS70005140).
The PIC32 Bluetooth SPP-only Stack Library is available only in binary format. When a license is acquired it may be for SPP (data) only, or with access to Low Complexity Subband Coding (SBC) or Advanced Audio Coding (AAC) decoders. The different licenses come with a number of specific applications.
The license to the stack must be procured from Microchip, and it is specific to the Microchip PIC32 microcontroller architecture. Some licenses require a one-time fee conveyed when a customer purchases the demonstration applications for the PIC32 Bluetooth Audio Development Kit (P/N DV320032).
There are four potential options in the license:
- SPP (data only) - This is a special version of the library available to carry data only. The decoder options have been removed in this case. The license is available for Microchip PIC® products and is free of charge. Special demonstrations and the library for this product can be found under the SPP section by visiting our "PIC32 Bluetooth Audio Software Suites" page.
- SBC Decoder - This Bluetooth license also grants the user the ability to use the baseline audio SBC decoder which is provided as a separate library. The demonstrations include stand-alone Bluetooth audio streaming using this decoder, and other applications that combine the use of USB and Bluetooth audio.
- AAC Decoder - This Bluetooth license also grants the user the ability to use the audio AAC decoder if a connected device supports this form of streaming. For devices that only support SBC, the SBC decoder is also included. All demonstrations of the (1) license are included. In addition, new demonstrations are included that make specific use of the AAC decoder both with and without USB options.
- Break-in Feature with SBC Decoder - The break-in feature enables multi-connection support and a "Party mode" where multiple handset devices can take turns sharing the Bluetooth connection to stream SBC audio. This also supports the single connection SBC audio streaming in SPP.
All licenses are available through microchipDIRECT. More details on the specific application demonstrations can be found in the "PIC32 Bluetooth Audio Development Kit Reference Guide" (DS70005140).
Microchip offers a reliable security solution for embedded applications on PIC32 devices. The Cryptographic Library includes functions to perform encryption, decryption, hashing, authentication, and compression within the embedded application. Random Number Generation (RNG) functions are also provided.
- Authentication capabilities:
- MD5
- SHA-1
- SHA-256
- SHA-384
- SHA-512
- HMAC
- Cryptographic capabilities:
- AES
- 128-, 192-, 256-bit key lengths
- CBC, CTR, GCM, and CCM-8 modes
- RSA
- DES/Triple DES
- Elliptic Curve Cryptography (ECC)
- AES
- Random number capabilities:
- Single random number
- Block of random numbers
- Compression capabilities:
- Huffman encoding
Digital Signal Processing (DSP) Fixed-Point Math Library
LibQ Fixed-Point Math Library
Digital Signal Processing (DSP) Fixed-Point Math Library
The DSP Fixed-Point Library uses fixed-point fractional functions to optimize execution speed. These functions limit the accuracy of the calculations to the bits specified for the function. Due to parallelism in some operations, the 16-bit version of the functions are more efficient than their 32-bit counterparts. In many cases, both 16-bit and 32-bit functions are available to give the user the choice of balance between speed and functional resolution.
A majority of the DSP Fixed-Point Library uses functions with variables in the Q15 or Q31 format. This limits the equivalent numerical range to roughly -1.0 to 0.999999999. It is possible to represent other number ranges but scaling before and after the function call is necessary. All library functions will saturate the output if the value exceeds the maximum or is lower than the minimum allowable value for that resolution. Some pre-scaling may be necessary to prevent unwanted saturation in functions that may otherwise create calculation errors.
The DSP Library supports the following functions:
- Complex Math Functions: general mathematical operations using a complex structure with the form (a + bi)
- Vector Math Functions: mathematical operations on an array of numbers or vectors
- Matrix Math Functions: mathematical operations on a matrix
- Digital Filter Functions: FIR and IIR filtering functions with various architectures
- Transform Functions: FFT, Windows, and related transform elements
- Support Functions: quick support functions for numerical transform
LibQ Fixed-Point Math Library
The LibQ Fixed-Point Math Library simplifies writing fixed point algorithms, supporting Q15, Q31, and other 16-bit and 32-bit data formats. Using the simple C callable functions contained in the library, fast fixed-point mathematical operations can be easily executed. Fixed-point mathematical calculations may replace some functions implemented in the floating-point library (math.h), depending on performance and resolution requirements.
Functions included in the LibQ library include capabilities for trigonometric, power and logarithms, and data conversion. In many cases, the functions are identical other than the precision of their operands and the corresponding value that they return.
These functions are implemented in an efficient assembly and generally tuned to optimize performance over code size. In some cases, the library breaks out functions that enable one to be optimized for accuracy, while another version is optimized for speed. These functions such as _LIBQ_Q2_29_acos_Q31() and _LIBQ_Q2_29_acos_Q31_Fast() are otherwise identical and can be used interchangeably. Each of these functions is typically used in computationally intensive real-time applications where execution time is a critical parameter.
The LibQ Fixed-Point Math Library supports the following functions:
- Divide
- Square Root
- Exponential
- Log
- Power
- Sine
- Cosine
- Tangent
- Arcsin
- Arccos
- Arctan
- Arctan2
- Random Number
- Float
- String