With 48 channels controlled through one interface, you gain total PWM dominance, giving you the power to manage your devices and applications with precision and efficiency
A
A
Hardware Overview
How does it work?
PWM 2 Click is based on the LT8500, a 48-channel LED PWM generator with 12-bit resolution and 50MHz serial interface from Analog Devices. This IC has 48 independent 12-bit PWM channels, each with 6-bit correction up to 50% of the original duty cycle. The LT8500 IC is clocked by a clock signal at the PWMCK pin. The frequency of the clock signal can go up to 25MHz, generating the PWM output frequency of up to 6.1kHz, which is sufficient for most purposes. The maximum speed of the LT8500 serial interface goes up to 50MHz in theory, but in practice, it will depend on many factors. The clock signal at the PWM pin of the mikroBUS™ is triggering an internal counter register (PWMCK). This register is compared with the content of the PWMRSYNC register, associated with each channel. Whenever the counter value is less than the value written in a specific channel PWMRSYNC register, the PWM output of that channel goes to a HIGH logic level. The frequency of the output PWM signal is therefore determined by the frequency the clock signal at the PWMCK pin. This represents the basic operating principle of the LTC8500 IC. The PWMCK pin is routed to the PWM pin of the mikroBUS™. The device uses an industry-standard SPI interface for the communication. The LDI pin acts as the normal Chip Select, latching the SPI data in, but it has an additional function if held to a HIGH logic level
for more than 50µs. In that case, the IC will be reset, and all outputs will be blanked. Therefore, care should be taken not to hold this pin to a HIGH logic level, for more than 5µs. The LDI pin is routed to the CS pin of the mikroBUS™ and it is labeled as LDI. Besides the usual SPI interface lines, the LT8500 PWM generator IC provides a serial interface clock output signal (SCKO), allowing additional devices to be connected in the parallel 5-wire topology (LDI, SCKI, SDI, SDO, and SCKO). This allows large-scale cascading, without the need for the skew balancing or buffering the signals. These additional pins are available at the standard 2.54 pitch headers on board. These additional pins on the header are described in a table, below. More information about cascading and using the SCKO feature of the IC can be found in the LT8500 datasheet. The device is controlled by sending commands via the SPI interface, embedded in a command frame. There are eight different commands which are used to control the following parameters: PWM outputs update (synchronously or asynchronously to PWM period), the dot correction factor, self-test initialization, phase shifting between banks (groups of 16 channels), enabling/ disabling of the PWM output drivers, and enabling/disabling of the dot correction . A frame consists of a 12-bit data field for each of the 48 PWM channels, followed by an
8-bit command field, which contains one of the eight command codes. The status frame is clocked on the SDO pin, providing the host MCU with the frame information: LED fault status, phase shifting status, correction status, synchronization status, and so on. This information can be used either for troubleshooting or for other purposes by the host MCU application. As already mentioned, additional functionalities of the LT8500 IC are offered via the onboard headers, along with the 48 PWM channel outputs. The outputs are not meant to drive devices with high current, so PWM 2 click is best used as the driver for additional circuitry, whether it is a simple MOSFET LED driver, or a more complex ICs, such as the LT3595A LED driver, for which a special input pin is reserved, allowing open LED conditions to be detected, even on the externally connected LT3595 IC. Onboard headers also offer fixed 5V output from the mikroBUS™ for the auxiliary purposes. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the PWR SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Features overview
Development board
Curiosity PIC32 MZ EF development board is a fully integrated 32-bit development platform featuring the high-performance PIC32MZ EF Series (PIC32MZ2048EFM) that has a 2MB Flash, 512KB RAM, integrated FPU, Crypto accelerator, and excellent connectivity options. It includes an integrated programmer and debugger, requiring no additional hardware. Users can expand
functionality through MIKROE mikroBUS™ Click™ adapter boards, add Ethernet connectivity with the Microchip PHY daughter board, add WiFi connectivity capability using the Microchip expansions boards, and add audio input and output capability with Microchip audio daughter boards. These boards are fully integrated into PIC32’s powerful software framework, MPLAB Harmony,
which provides a flexible and modular interface to application development a rich set of inter-operable software stacks (TCP-IP, USB), and easy-to-use features. The Curiosity PIC32 MZ EF development board offers expansion capabilities making it an excellent choice for a rapid prototyping board in Connectivity, IOT, and general-purpose applications.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC32
MCU Memory (KB)
2048
Silicon Vendor
Microchip
Pin count
100
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic
Step by step
Project assembly
Track your results in real time
Application Output
This Click board can be interfaced and monitored in two ways:
Application Output
- Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
UART Terminal
- Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Software Support
Library Description
This library contains API for PWM 2 Click driver.
Key functions:
pwm2_set_channel
- Set channel function.pwm2_pwm_start
- Start PWM module.send_output_enable_frame
- Enable frame.
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \file
* \brief Pwm2 Click example
*
* # Description
* This application send the PWM signal in one or more outputs.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Configures the click board and sets all PWM channels on the click board to
* 50% duty cycle with the phase shift enabled.
*
* ## Application Task
* The first 10 PWM channels of PWM2 Click board are switched back and forth
* from 25% duty cycle to 75% duty cycle every 10 seconds.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "pwm2.h"
// ------------------------------------------------------------------ VARIABLES
static pwm2_t pwm2;
void application_init ( void )
{
pwm2_cfg_t cfg;
// Click initialization.
pwm2_cfg_setup( &cfg );
PWM2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
pwm2_init( &pwm2, &cfg );
pwm2_set_duty_cycle( &pwm2, 0.5 );
pwm2_pwm_start( &pwm2 );
pwm2_default_cfg( &pwm2 );
pwm2_toggle_phase_shift( &pwm2 );
//setting all 48 PWM channels of the PWM2 click to 50% duty
for( uint8_t cnt = 1; cnt < 49; cnt++ )
{
pwm2_set_channel( &pwm2, cnt, PWM2_50_PERCENT_DUTY, PWM2_NO_CORRECTION );
}
}
void application_task ( void )
{
for ( uint8_t cnt = 1; cnt < 10; cnt++ )
{
pwm2_set_channel( &pwm2, cnt, PWM2_25_PERCENT_DUTY, PWM2_NO_CORRECTION );
}
Delay_ms( 10000 );
for ( uint8_t cnt = 1; cnt < 10; cnt++ )
{
pwm2_set_channel( &pwm2, cnt, PWM2_75_PERCENT_DUTY, PWM2_NO_CORRECTION );
}
Delay_ms( 10000 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END