Description of example project
==============================
This example implements a Buck Converter in Voltage Control Mode controller 
for being used together with the XMC Digital Power Explorer kit.
The project is implemented using XMC1300, a 32-bit ARM Cortex M0
based microcontroller. It has dedicated control peripherals
such as the CCU8 PWM module for PWM generation and a Versatile Analog-to-Digital
(VADC) module for analog signal measurement, making it suitable for applications that require fast
calculation such as the Voltage Control mode.

The voltage Control loop is implemented by a classic 3 poles 3 zeros filter using fixed points values.
The provided filter coefficients has been selected to have the following controller characteristics:
 + Switching freq = 100kHz
 + Crossover freq = 5kHz
 + Phase margin   = 50 degrees
 + PWM resoluiton = 15.625 ns
 + ADC resolution = 12 bits 
 
VADC conversion is being continuously triggered by the Compare Match 2 of the CCU8(set by default to the maximum, period value).
Once the output voltage has being measured by the VADC an interrupt is generated. 
Inside the ISR, the 3 poles 3 zeros controller is applied and new value for the duty cycle is set.

ADC Trigger                        ADC Trigger
   ;                                   :
   ;_______                            :________
PWM|    <--|-->                        |     <--|-->
___|  20%  |___________________________|  20%   |_______
   ;                                   :
   ;                                   :
   ;   ADC                             :   ADC
   ;<--------> __________              :<--------> __________
ISR;          | Filter + |             :          | Filter + |
   ;          |  PWM     |             :          |  PWM     |
___;__________|  update  |_____________:__________|  update  |_______

One instance of each of those DAVE 4 APPs has been used to easy the peripherals configuration:

PWM_CCU8 (PWM, generates the ADC trigger through the CCU8 peripheral(Compare Match 2) and the PWM(Compare Match 1))
ADC_MEASUREMENT_ADV(Output Voltage measurement)
INTERRUPT (NVIC configuration)

Filter related APIs are implemented in the xmc_3p3z_filter_fixed.h file
while the PWM initialization and control ISR are implemented in the main.c.
   
Hardware Setup
===============
XMC1300 Digital Power Control Card + XMC Digital Power Explorer Kit
Vout P2.3
CCU8 direct output P0.0
CCU8 inverted output P0.5
Vin  P2.10 (not measured in project)

How to test the application
============================
a. Import the project
b. Prepare board set up: connect XMC1300 Digital Power Control Card into 
    XMC Digital Power Explorer and supply power with included power adapter to it. 
    Make sure power on switch is in the "on" position and that the jumper in power board
	is in the XMC4000 position	
c. Compile and flash the application onto the device 
d. Run the application.
e  Check via oscilloscope the different test points available
   in XMC Digital Power Explorer.
   Vout is now controlled to be stable at 3,3 V independent of load switching
   LEDs next to load switches must turn on when that particular load is activated
f. If changes are needed in APPs configuration, make sure code is generated again before compiling
