Digital Power Starter Kit 3 Firmware  DM330017-3, Rev.3.0
dsPIC33C Buck Converter Peak Current Mode Control Example
Firmware Architecture

Firmware Flowchart. More...

+ Collaboration diagram for Firmware Architecture:

Modules

 Device Start Up
 Device Start Up.
 
 Main Loop
 Main Loop.
 

Functions

int main (void)
 Application main function executed after device comes out of RESET. More...
 

Detailed Description

Firmware Flowchart.

Firmware Task Scheduling


The SMPS Firmware Framework used in this application is organizing high and low priority tasks by a very simple task scheduler providing one common low-priority task level executed on priority level #0 and one high-priority task level executed on priority level #2. The interruption of processes on priority level #0 is enforced by a programmable timer. During system startup, the timer is set to overrun every 100 us, providing a stable high-priority task execution frequency of 10 kHz. All low-priority tasks are only allowed to run after all high-priority tasks have been completed. The real-time control system takes the highest priority within the firmware. This is ensured by using hardware triggers generated by the PWM signal generator logic with its high resolution time-base. The extremely short and optimized control loop code is implemented as monolithic Assembly routine to be most deterministic. Being triggered directly by the switching signal waveform generator, the execution is tightly coupled to the physical power conversion process and also independent from any other software process of the firmware.

Function Documentation

◆ main()

int main ( void  )

Application main function executed after device comes out of RESET.

Returns
Signed Integer (0=failure, 1=success)

This function is the starting point of the firmware. It is called after the device is coming out of RESET, starting to execute code. The startup sequence is as follows:

1) SYSTEM_Initialize:

a) Configures the fundamental system components such as

Fundamental components are peripherals which are essential for the CPU to run, such as

  • system oscillator
  • auxiliary oscillator
  • general purpose input/output configuration

b) User-defined Peripheral Module Configurations

This hardware requires some specific peripheral modules to support circuit functions, such as

  • Digital-To-Analog Converter (DAC): This peripheral instance is used to provide an analog debugging signal which can be used to output internal high-speed signals/values on an oscilloscope.
  • Operational Amplifier (OPA) The analog debugging signal generated by the DAC is buffered by one of the internal operational amplifiers to stabilize the signal when probed.

2) Software Modules Initialization

This application executes five tasks simultaneously:

  • High Priority Tasks
    • Power Supply State Machine & Control
    • System Fault Handler & Diagnostics
  • Low Priority Tasks
    • LCD Display Control & Update
    • On-Board Push-Button HMI Control
    • On-Board Debugging LED Control

Each 'Task' is an independent process which is called at a constant execution frequency. The default frequency (OS base clock) set in this code version is 100 us (= 10 kHz). Tasks may slow down their individual execution rate by using internal counters to be executed as integer multiples of the OS base clock.

Definition at line 80 of file main.c.

+ Here is the call graph for this function: