File Exchange

image thumbnail

DC/DC Buck Converter Example

version (69.9 KB) by Antonin
This example shows how to design a DC/DC Buck Converter controller


Updated 31 Oct 2017

View License

This example shows how to design a DC/DC Buck Converter controller with the Embedded Coder Support Package for TI® C2000 Processors and run it on the TI® F28377S Launchpad (LAUNCHXL-F28377S) connected to the C2000 DPS BoosterPack (BOOSTXL-BUCKCONV). You can monitor signal and tune parameters using the provided host model running on your host computer.

Cite As

Antonin (2021). DC/DC Buck Converter Example (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (12)

Benjamin Hoepfner

Hi Antonin,

many thanks for that example. It helps a lot!

But i have a problem dealing with the 200 kHz system time as you told us in the video.

The ePWM module that triggers the system is set to a timer period of 1000 in an up counting mode. The formula: T_CTR = (TBPRD + 1) * TBCLK gives us the period / system frequency. In the Hardware Settings the epwm clock divider (EPWMCLKDIV) is set to SYSCLKOUT/2 which means (according to my imagination) that the TBCLK is half of the SYSCLK of 200 MHz which means 100 MHz.

With this assuming T_CTR is equal to T_CTR = (1000+1)*1/100MHz = 10,01µs --> 100 kHz

Am i right? Or what is my fallacy?

g g

Rolando Aguilera

Can you explain the ADC fixed point conversion? Shouldn't you use a gain (based on the voltage divider and ADC resolution) to get real voltage value and run the control algorithm?

Nicholas Tyler

Hi, I'm trying to get this working on my LaunchXL-F28379D so that I can have a go at using and understanding the serial comms.
I am following your videos and documentation exactly, but have two strange issues:

1) The model will not build unless I change the SCI Module from A to B in the SCI RCV/XMT blocks. The following message appears:

Error evaluating 'InitFcn' callback of C28x SCI Transmit block (mask) 'DCDC_Buck_2019b/PI_Controller_ISR/Serial Send1/While Iterator Subsystem/SCI Transmit'.
Callback string is 'validateC280xSCI('Tx');
Caused by:
The SCI module A is already used by another block or by External Mode.
Component:Simulink | Category:Model error
Error evaluating 'InitFcn' callback of C28x SCI Receive block (mask) 'DCDC_Buck_2019b/Serial Receive/SCI Receive'.
Callback string is 'c28xsci_callback('renderDisplay')

Caused by:
The SCI module A is already used by another block or by External Mode.

If I change the SCI blocks to Module B, the code builds and appears to download to the target, but then:

2) The host fails to connect to the target - this message appears:
Error occurred while executing External Mode MEX-file 'ext_comm':
Failed to connect to the target. A time-out occurred while waiting for the connection response from the target. Possible reasons for the time-out:
a) The target is not switched on.
b) The target is not connected to your host machine.
c) The application for the model is not running on the target. You might have clicked the Stop button. If the Run button is not dimmed, click it. Otherwise, click the Build button, which downloads and runs your application on the target.

a) and b) certainly do not apply. I do not understand what c) means as this does not describe anything I can see in the Simulink Hardware tab.

I have other examples working fine on this system and am using R2019b. Do you have any suggestions?
Thanks Nick


Rui Moreira

I cannot download the examples.
Its possible to insert them again?



Here are pages that can help understand:
* Why the baudrate is set to 12.5Mbps on the target and 12Mbps on the host:
* What is happening in the Serial_Send subsystem:

I hope it helps,


Ehsan S. Sali

Will Wang

Luis Sarmiento

Ali Jalali

This project done by matlab 2016b
If for you possible,exporp this file to 2016a

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!