3.8kW / 7.6 kW dsPIC33 Totem Pole Demonstration Application
- Introduction/Summary
- Highlights
- Related Collaterals
- Directory Structure
-Programming the Digital Power Development Plug in Module (DP-PIM)
-Recompiling the code - Quick Start Guide
-Hardware Setup
-Powering On Board - Firmware Overview
-Controllers in the system
-States
-Messages
The dsPIC33C Totem Pole Demonstrator platform, based on Microchips dsPIC33C and Silicon Carbide (SiC) devices, supports rapid prototyping and code development for high voltage Single Phase PFC/Grid Tied Inverters(GTI). The primary target application is automotive On-board chargers (OBC), but it can be used for any other industrial or telecom application that requires high power PFC/GTI.
This readme aims to provide a quick start guide in controlling and running the PFC and GTI, once the hardware is setup and electrical connections are made.
- Supports the following operating modes at both low voltage and high voltage
- Single phase PFC with two legs interleaved
- Single phase voltage inverter
- Forward operation, current mode
- CAN communication to PC running Power Board Visualizer GUI
- SPI communication to Isolated Voltage Acquisition Board
- I2C communication to PIC16 on main power board (for housekeeping)
- dsPIC33C Totem Pole PFC Development Platform
- Power Board
- Isolated Voltage Acquisition Board
- SiC FET PIM
Hardware Documentation
- dsPIC33C Totem Pole PFC Development Board User's Guide
- Isolated Voltage Acquisition Board User’s Guide
- SiC FET Plug-In Module (SiC FET PIM) User’s Guide
- Operational Manuals
Target Device Documentation
- dsPIC33CH512MP506 Family Data Sheet
- dsPIC33CH512MP506 Family Silicon Errata and Data Sheet Clarification
Please always check for the latest data sheets on the respective product websites:
- MPLAB® X IDE v6.20
- MPLAB® XC-DSC Compiler v3.00
- Microchip Code Configurator v5.7.0
- MPLAB® PowerSmart™ Development Suite
- Digital Compensator Design Tool
Note that there are two MPLABx projects associated with this deployment, one for the primary core and one for the secondary core.
├───dspic33ch_totem_pole_single_phase_primary.X dspic33ch512mp506 Primary core Project
├───dspic33ch_totem_pole_single_phase_secondary.X dspic33ch512mp506 Secondary core Project
├───images Images for the Readme
├───power_board_visualizer_xmls Power Board Visualizer Projects
├───pre_compiled_hex_files Pre compiled Hex files for PFC and GTI modes
└───sources_common Common Sources between both primary and secondary projects
In this example ICD4 is being used, but any of the available debuggers/programmers can be used.
- Open MPLAB X IPE
- Select the device on DP-PIM : dsPIC33CH512MP506 (not S1)
- Memory Model : Single Partition
- Connect computer to ICD4 via USB cable, connect ICD4 to 6 pin header on DP-PIM via RJ11 cable and RJ11 to ICSP adapter.
- Power the dpPIM through a microUSB cable.
- Click connect on the MPLAB X IPE
- Wait for the device to connect
- Navigate to the folder pre_compiled_hex_files, and select the correct hex file
- Click program
- Wait for the program/verify complete message.
- Disconnect programmer from Digital Power Plug-in Module.
The project can be configured in six different configurations,
High Voltage PFC and Low Voltage PFC
High Volage Grid Tied Inverter and Low Voltage Grid Tied Inverter
High Voltage Interleaved PFC and Low Voltage Interleaved PFC
When the project has high voltage flag enabled, a different compensator is used. Make sure that the correct voltage divider is being used on the hardware. Refer to the Users Guide/Operational Manual for more information.
The same codebase works with all modes. To recompile the code in a different mode open the file sources_common/Totempole_Application_Setup.h and comment out the mode in which you want to compile the project.
In the following code snippet, taken from the Totempole_Application_Setup.h header file, the project is configured to run in low voltage PFC mode.
#define HIGH_VOLTAGE 0
#define MODE_PFC
//#define MODE_GRID_TIE_INVERTER
//#define MODE_INTERLEAVED
This Section will guide you on how to run and control the PFC or GTI application using power board visualizer, once the electrical connections are made.
Please refer to the operational manual on PFC hardware setup considerations. Ensure the correct load and source selection has been made. This readme does not cover the electrical setup for the Totempole Application board.
To enable the CAN commuincation from the PC to Totem pole application board a USB to CAN dongle is needed. Note that the Power Board Visualizer can only work with PEAK System USB CAN-FD dongles. You can use a RS232 DB9 Straight Through cable to connect the Totempole board to PEAK dongle.
3.8kW / 7.6 kW dsPIC33 Totem Pole PFC Hardware Setup Overview
3.8kW / 7.6 kW dsPIC33 Totem Pole GTI Hardware Setup Overview
Following software must be installed on your pc to control/communicate between Power Board Visualizer and dsPIC33CH.
Once the hardware setup is all done, Navigate to the power board visualizer xmls folder. Open the relevant project using Power Board Visualizer. Here PFC mode is taken as an example. Once the project is open you will be greeted by the following screen.
The basic unit of commuincation for Power board Visualizer is unsigned 16 bits. Each message sent and received, therefore, consists of words(16bits). For more information refer to the Power Board Visualizer's users guide.
PFC project running on Power Board Visualizer GUI
This button turns on and off the application. Each button corresonds to a message over CANFD. Click on Info tab for CAN message description.
This slider is used to set a output voltage/current referece for the PFC/GTI. Its important to press Set button underneath the slider to communicate the reference value to the micrcontroller.
The "COM?" button lists all the available commuincation ports available to the PBV. If the Peak Dongle drivers are installed and the Peak USB dongle is connected to the system, then you will see the Peak USB dongle listed here as PCAN_USB:FD. Select the right port and then click enable. Power Board Visualizer will then open the Comm port.
This Status group lists the Line AC voltage Status word.
This controller status group communicates the current state of the system. More information on what each state does, and statemachine can be found in state machine overview in detail.
This Status flag group lists the current mode, and highlevel state of the system.
Thie status group lists the health and communication of SiC cards, as well as the Auxillary supplies.
After opening the right Power board Visualizer Project, following sequence of actions are to be taken to start the board
- Select the right comm port and enable the port.
- If everything is setup correctly, you will see some status/housekeeping data, and the system in PCS_STANDBY state.
- Change reference voltage/current if you want to.
- Click on Start. The system will jump quickly through the states, and then should land on PCS_UP_AND_RUNNING.
PFC Up and Running
GTI Up and Running
dspic33CH Peripheral Setup is done through Microchip Code Configurator.
The main microcontrollers used in this project that are central to the PFC operation are
- A dsPIC33CK on the Isolated Voltage Acquisition Board
- A dsPIC33CH (dual core) on the main power board
There are also two PIC16 microcontrollers used for housekeeping functions.
- A PIC16 on the main power board
- A PIC16 on each SiC card
See the following for an illustration of the processes running on the different microcontrollers. Note that for all microcontrollers, only two priority levels are used. The higher priority interrupt-driven processes are show in green and the lower priority background processes are shown in orange. Any schedulers are driven by polling timer overflow/interrupt flags in the background loop, and are interrupted by the higher priority processes.
Overview of microcontrollers in the system
Microcontroller | Located on | Main Functions |
---|---|---|
dsPIC33CK32MC102 | Isolated Voltage Acquisition Board | Measuring line voltage (L1) with 12-bit ADC Measuring AC sense offset with 12-bit ADC Sending results to dsPIC33CH on power board via SPI |
dsPIC33CH512MP506 Primary Core | Power Board | Comms handling (I2C, CAN, SPI) AC input voltage monitoring |
dsPIC33CH512MP506 Secondary Core | Power Board | PFC control |
PIC16F15323 | Power Board | Aux rail monitoring Fan speed control Push-pull PWM for 2x isolated 5V rails Gathering data from PIC16 on SiC cards via I2C Sending housekeeping data to dsPIC33CH via I2C |
PIC16F15323 | SiC Card | Local rail monitoring Local Temperature Monitoring I2C client to PIC16 on main board |
Please refer to the users guide of Isoloated Voltage Acquisiton board for indepth understanding.
The main responibility of the core is line voltage sensing. It does so by receiving the SPI message from Isoloated Acquisiton board. It unpacks the message, and sends the data to the secondary core.
The sequence of events is as follows
- dsPIC33CH secondary core (on PFC power board) sets digital output pin to trigger external interrupt on dsPIC33CK on Isolated Voltage Acquisition board.
- Input voltage are measured with ADC, processed and sent to dsPIC33CH via SPI.
- DMA interrupt triggered on dsPIC33CH primary core upon receipt of 4x SPI words. Data is unframed.
- Finished processing of input voltage data. Send results to secondary core via mailbox B.
- dsPIC33CH secondary core reads mailbox B.
AC Voltage Acquistion Sequence
Data sent from primary core to the secondary core of dspic33ch
word | Description | comments |
---|---|---|
0 | Rectified ADC reading of phase 1 voltage | |
1 | Rectified ADC reading of phase 2 voltage | not used |
2 | Rectified ADC reading of phase 3 voltage | not used |
3 | Phase 1 voltage loop feedforward term | |
4 | Phase 2 voltage loop feedforward term | not used |
5 | Phase 3 voltage loop feedforward term | not used |
6 | Status Flags | |
7 | Phase 1 average voltage |
The primary core also takes care of the CAN message framing and unframing, and I2C data pricessing from the Housekeeping PIC 16.
The secondary core is responsible for controlling the power stage of the PFC/GTI.
main function of the primary core
Power controller waits in this state until the Line Voltage is determined to be ok. Afterwards, it calibrates the input current sensor.
If the current sensor calibration fails, then jump to this state.
Iniitalize PFC status flags. Wait for start PFC message
Adding a delay of 1 second.
Turn on the Relay (bypassing NTCs)
Wait in this state for 50ms.
In this state history of the control loops are cleared and Set loop ref = measured voltage / current
Linearly ramp voltage loop reference to setpoint.
The System is up and running. In this state, the referernce point can be changed from the PBV GUI.
Debug State. If line voltage is bad, then jump into this state.
All the commuincation done with the Power Board Visualizer is done over CAN-FD. Power Board Visualizer works only with PEAK CAN-FD USB dongle, and using 1/4 M bit rates. The messages to and from the PBV are documented in the Power Board Visualizer projects, and can be accessed through Info Tab.