Trouble creating more than a simple PWM in Simulink Embedded Coder

Hello,
I've been setting up an environment with Matlab / simulink 2012b and CCSv5, with a Piccolo 2806ControlStick as test platform. I used this: http://www.mathworks.nl/help/ecoder/ug/tutorial-using-xmakefile-with-code-composer-studio-4-x-1.html document to set up my system.
I wrote some code to test the setup. In simulink I created a simple ePWM block to PWM pin EPWM-1A (pin 17 on ControlStick) with a fixed dutycycle and frequency, all variables were set in the ePWM dialog. This works like a charm; I can 'build' which generates the makefile, then go to commandline to make the files and use dss to program the device. I checked the output on the scope: PWM just as I set it up; great!
Now I changed one thing: I made the PWM dutycycle available as port on the block, and hooked up a constant. I can generate the makefile, but the linker is complaining that '_pwm_P' cannot be found, referred to by pwm.obj. Inspecting the generated code, I found that pwm.c uses a variable pwm_P declared in pwm.h as extern. However, the variable is not defined in any file! When changing pwm.c by adding the declaration, the value used in the declaration is written to the PWM dutycycle ( not the value declared in the simulink model!).
I then tried using a sine wave for controlling the duty cycle, resulting in the same linker error. When defining an empty pwm_P variable, the code would compile, but I only see 6 periods of PWM, then the output remains high.
Any solution how I can make simulink generate code that compiles and links, and does what I describe in the block diagram?

Answers (0)

Communities

More Answers in the  Power Electronics Control

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products

Asked:

on 4 Feb 2013

Community Treasure Hunt

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

Start Hunting!