Power integrations InnoSwitch3-Pro Getting Started

Title
Getting Started with InnoSwitchTM3-Pro Code Library using Arduino
Author
Applications Engineering Department
Document Number
Application Note 77 (AN-77)
Date
September 6, 2018
Revision
1.0
Summary
InnoSwitch3-Pro is a digitally controllable CV/CC QR Flyback Switcher IC with integrated High Voltage MOSFET, Synchronous Rectification and FluxLink Feedback.
RDK-641 is a reference design board rated for 40W output power and is programmable from 3V to 20V output voltage. This reference design features an on board PIC16F18325 microcontroller and uses the InnoSwitch3-Pro integrated power supply IC.
This application note describes use of Arduino code libraries provided by Power Integrations to develop control logic and firmware for customizing RDK-641.
Information presented in this application note was used to develop firmware for Arduino UNO.
PATENT INFORMATION The products and applications illustrated herein (including transformer construction and circuits external to the products) may be covered by one or more U.S. and foreign patents, or potentially by pending U.S. and foreign patent applications assigned to Power Integrations. A complete list of Power Integrations' patents may be found at www.powerint.com. Power Integrations grants its customers a license under certain patent rights as set forth at https://www.power.com/company/intellectual-
property-licensing/.
Power Integrations
5245 Hellyer Avenue, San Jose, CA 95138 USA.
Tel: +1 408 414 9200 Fax: +1 408 414 9201
www.power.com
AN-77 Getting Started with InnoSwitch3-Pro using Arduino 06-Sep-18
Power Integrations
Tel: +1 408 414 9200 Fax: +1 408 414 9201
www.power.com
Table of Contents
Introduction ................................................................................................................ 3 1
System Requirements ................................................................................................ 4 2
Hardware Overview .................................................................................................... 5 3
Headers and Jumpers Settings ........................................................................... 5 3.1
InnoSwitch3-Pro Arduino Code Library ...................................................................... 7 4
Library Installation ............................................................................................... 7 4.1
Library Installation Complete ............................................................................... 8 4.2
Library Examples ................................................................................................ 9 4.3
Folder Contents ........................................................................................................ 11 5
File Description ................................................................................................. 12 5.1
Application Example ................................................................................................. 14 6
Step-By-Step Procedure ................................................................................... 14 6.1
Header Files Inclusion ............................................................................... 14 6.1.1
Class Instance Creation ............................................................................. 14 6.1.2
InnoSwitch3-Pro Initialization ..................................................................... 14 6.1.3
Basic Control Functions .............................................................................. 15 6.1.4
Basic Code Examples .................................................................................. 16 6.1.5
Building the Project .................................................................................................. 18 7
Arduino board selection .................................................................................... 18 7.1
Select the Active Com Port ............................................................................... 18 7.2
Verify / Compile ................................................................................................. 19 7.3
Upload ............................................................................................................... 19 7.4
Demonstration of Operation ..................................................................................... 20 8
Running the Program ........................................................................................ 20 8.1
Constant voltage operation ............................................................................... 21 8.2
Constant current operation ................................................................................ 21 8.3
Doxygen Documentation .......................................................................................... 22 9
Opening html file ............................................................................................... 22 9.1
Viewing the API Functions ................................................................................ 23 9.2
Functions summary ........................................................................................... 24 9.3
Functions definition ........................................................................................... 25 9.4
Examples .......................................................................................................... 26 9.5
Revision History .................................................................................................... 27 10
Page 2 of 28
AN-77 Getting Started with InnoSwitch3-Pro using Arduino 06-Sep-18
Power Integrations
Tel: +1 408 414 9200 Fax: +1 408 414 9201
www.power.com
1 2 3 4 5
6 7 8 9 10
Introduction 1
This application note describes the structure and the application interface of the InnoSwitch3-Pro Arduino Code Library as well as using it on a demo application. The code was designed to be highly portable to other microcontroller platforms, and was written in C++ language to be compatible with the Arduino library standards. This demo application runs on Reference Design RDK-641 (Figure 1) and Arduino UNO (Figure 3).
Figure 1 – RDK-641 Board Top
Figure 2 – RDK-641 Board Bottom
Page 3 of 28
AN-77 Getting Started with InnoSwitch3-Pro using Arduino 06-Sep-18
Power Integrations
Tel: +1 408 414 9200 Fax: +1 408 414 9201
www.power.com
Number
Description
Label
1
AC Input Terminals
TP1, TP2
2
DC Output Terminals
TP3, TP4
3
MCU GPIO Headers
J8
4
Green LED Indicator
D5
5
Pickit3 Programming Header
J5
6
Push Buttons
SW1, SW2
7
uVCCand I2C Isolation Jumpers
J3, J6, J7
8
External Interface Header
J4
9
PIC16F18325 microcontroller
U3
10
InnoSwitch3-Pro IC
U1
SCL SDA GND
The RDK-641 board’s key features are indicated on the table below
System Requirements 2
The following are required to run the InnoSwitch3-Pro Arduino demo application
Arduino Software version 1.8.2 or later Arduino UNO Rev3 SMD RDK – 641 Board rev C InnoSwitch3-Pro Arduino Library version 1.0.0
Page 4 of 28
Figure 3 – Arduino Uno Rev 3
AN-77 Getting Started with InnoSwitch3-Pro using Arduino 06-Sep-18
Power Integrations
Tel: +1 408 414 9200 Fax: +1 408 414 9201
www.power.com
Jumper
Description
Settings
J3
uVCC and MCU
Supply Jumper
If connected the uVCC output pin of the InnoSwitch3-Pro
will provide power to the on board microcontroller and
provide pull up voltage to the I2C lines
J6 , J7
I2C Lines
Isolation
Jumper
The user can select whether or not the SDA and SCL lines
from the MCU will be connected to the InnoSwitch3-Pro
Header
Description
Settings
J4
InnoSwitch3-Pro I2C lines
Header
When J6 and J7 are removed, an external I2C
Master can be connected through these header
J5
PICkit3 Programming
Header
For MCU Firmware Update using PICkit3 In-
Circuit Debugger/Programmer
J8
MCU GPIO Header
This can be used as Debug Pins
Hardware Overview 3
The Reference Design (RDK-641) hardware consists of an 8-bit Microchip microcontroller (PIC16F18325), interface headers and the user interface elements: two push buttons and a green LED.
The InnoSwitch3-Pro can be controlled using it’s on board microcontroller or by an external I2C Master through the interface header.
This Demo Application does not use the on board microcontroller but an Arduino Uno as
2
an I
C Master and InnoSwitch3-Pro as slave device.
SDA and SCL lines pull-up resistors R24 and R23 respectively are available on the board. The output of the InnoSwitch3-Pro provides 3.6V pull up voltage from its μVCC output pin.
To further ease in development, the following documents are available and recommended as supplemental reference resources I2C
RDR-641 - 40 W Variable Output (3 V to 8 V, 5 A; 8 V – 20 V Constant Power)
Supply Using InnoSwitch3-Pro and Microchip’s PIC16F18325 Microcontroller
AN-74 InnoSwitch3-Pro Programming Manual
3.1
Headers and Jumpers Settings
The table provides the description for each jumper available on the board.
The following headers are also available on the board.
Page 5 of 28
AN-77 Getting Started with InnoSwitch3-Pro using Arduino 06-Sep-18
Power Integrations
Tel: +1 408 414 9200 Fax: +1 408 414 9201
www.power.com
By configuring the I2C lines isolation jumpers, the RDK-641 board can be controlled using Arduino UNO.
Connection details:
Remove Jumpers J6 and J7 and retain Jumper J3 Connect J4 to Arduino Uno I2C lines (SDA, SCL and GND). Make sure to check the I2C labels of J4 and Arduino UNO board
Wires on the Image above
o Blue – SDA o Red – SCL o Black – GND
Page 6 of 28
AN-77 Getting Started with InnoSwitch3-Pro using Arduino 06-Sep-18
Power Integrations
Tel: +1 408 414 9200 Fax: +1 408 414 9201
www.power.com
InnoSwitch3-Pro Arduino Code Library 4
To simplify the technicalities on controlling the InnoSwitch3-Pro, a simple code library is provided as a reference.
The library contains all the registers needed for controlling the device. These registers are organized as Command Registers and Telemetry registers. Command registers are sent to the device for performance control and Telemetry Registers are for reading back values.
Computation Macros are presented to aid in set point calculations. Register default values are also defined to simplify writing to the required registers at device initialization.
The InnoSwitch3-Pro Arduino code library is available from the Power integrations website.
https://ac-dc.power.com/design-support/articles/innoswitch3-pro-code-library-api-arduino/
4.1
Library Installation
Full installation guide can be found on the link below
https://www.arduino.cc/en/Guide/Libraries
In the Arduino IDE, navigate to
Sketch > Include Library > Add .ZIP Library
of the drop down list, select the option to "Add .ZIP Library''.
Navigate to the .zip file's location and open it.
. At the top
Page 7 of 28
AN-77 Getting Started with InnoSwitch3-Pro using Arduino 06-Sep-18
Power Integrations
Tel: +1 408 414 9200 Fax: +1 408 414 9201
www.power.com
Library Installation Complete 4.2
Images below shows the InnoSwitch3-Pro library was added to the Arduino Library
Page 8 of 28
AN-77 Getting Started with InnoSwitch3-Pro using Arduino 06-Sep-18
Power Integrations
Tel: +1 408 414 9200 Fax: +1 408 414 9201
www.power.com
For windows users, the library can be viewed on this directory:
C:\Users\username\Documents\Arduino\libraries\
Library Examples 4.3
The Library will be available to use in sketches,
File > Examples
Page 9 of 28
Loading...
+ 19 hidden pages