This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMDSDOCK28335: Implementing DF22 controller

Part Number: TMDSDOCK28335
Other Parts Discussed in Thread: C2000WARE, TMS320F28335, CONTROLSUITE

Tool/software: Code Composer Studio

Sir,

I am implementing the DF22 controller for the closed loop application of Boost Converter. I have the transfer function in z-domain (i.e, the coefficients a0, a1,a2, b1, b1, b2). I  have set the default variables. Now, I am trying to assign the values of the coefficients, but finding errors upon saving the project. How to write the assigning codes?

Please suggest me any example code to implement it, if possible.

And Is it necessary to use the precomputed term? Because I am also getting an error in the line 

vk = DCL_runDF22p (&arma2, ek, uk);

I have included the DCL header file and .asm file to the project.

Please Help.

  • Now I have assigned the value to the variables in the format like
    arma2.b0 = 0.0xxx;
    and so on.
    Now I understood that the precomputed term in DF22 is a void one so need not to return anything.

    So, Now my code is running successfully, but How to confirm that my controller is working fine.
    Please Help.
  • Soumya,

    Glad to know you have solved your earlier problems. I can tell from the function name you are using v1.0 of the DCL. There's nothing wrong with that, but you may like to consider using the latest v3.0, which you can find in C2000Ware. That version contains a couple of things which may help:

    - There is a DF22 example project which streams a sequence of test data through the controller.

    - There is a Simulink blockset which includes a functionally accurate model of the DF22. There is also a Simulink model of a PID controlled system you can use as a starting point if you want to simulate DF22 in a control loop with your own settings.

    Regards,

    Richard
  • Dear Richard,
    Thank you for your suggestion.
    I downloaded and installed the link you provided, but its still v1.0 of the DCL. Can you provide me the file that contains DCL v3.0 or directly send me the DCL v3.0?
    Or suggest me any link for working example.
    Regards,
    Soumya
  • Hi,
    I found the DCL v3.0 folder, but there are no examples listed for 28335. I am using TMS320f28335 experimenter's kit.
    And, I am doing it in coding, not in Simulink. So an example code will help me in a better way.
  • Soumya,

    Correct: most of the DCL examples were prepared for the F28069.  Actually the controller functions do not care what device they run on, so you can declare and call them in exactly the same way for your device.

    Your last question was about validating your choice of controller coefficients, which is why I suggested the Simulink models.  The block-set is not configured to support auto-code generation.

    Regards,

    Richard 

  • Dear Richard,

    Thank you for your suggestions.

    Now I have included file options and added the required files for the DF22 controller. But getting error messages upon building up the project.

    Please check the attached screenshot.

    Secondly, how to check the compensator is working fine?

    Please help me out. I am stuck here.

  • Soumya,

    Can you post the error messages please so I can see what it's not finding?  Thanks.

    Regards,

    Richard

  • Sir,
    Please find the error messages in the screenshot I attached earlier.
    When I added the files DCL_DF22_C1 and DCL_DF22_C2C3 to the project and saved the above errors came. The error was something like "[E0004 ] Absolute, well-defined".
    Secondly, I have not removed the include and source files of version 1.0 from the project. Should I remove that? As there were no errors when I was using v1.0
  • Sir, I have created a fresh new project. Here also, Whenever I am adding the files (DCL_DF22_C1, DCL_DF22_C2C3) from DCL v3.0, automatically its showing errors. Screenshots are also attached with the error messages with descriptions and the corresponding lines are highlighted.

    Is there any issue with the source files of DCL v3.0?

    While adding the DCL_DF22_C1 file,

    While adding the DCL_DF22_C2_C3 file,

    Sir, Please help me out.

  • Soumya,

    I think these errors are caused by the wrong header files. There were some struct and function naming changes between v1 and v3, so you will need to include the latest header files: "DCLF32.h" and "DCL.h" in your project and remove the old ones. There are no issues with the source files.

    I recommend going carefully through Chapter 2 in the User's Guide to ensure nothing has been missed.

    Regards,

    Richard
  • Sir,
    I have removed all the old header files, and included the header file with directory "C:\ti\c2000\C2000Ware_1_00_05_00\libraries\control\DCL\c28\include".
    Now I have to add the sources files DCL_DF22_C1 & DCL_DF22_C2C3 to my project. There are two options for doing that
    1) going through the include option in properties and add "C:\ti\c2000\C2000Ware_1_00_05_00\libraries\control\DCL\c28\source".
    2) directly using the "add files" files option in right click on project name and selecting the particular files I need (like DCL_DF22_C1 & DCL_DF22_C2C3)
    While I did the first one, there was no error, but while following the second one again the same error message is coming.
  • Soumya,

    Interesting. I'm sorry you're having this problem.

    The second method is correct for source files. What's happening is it's failing to recognize __TI_EABI__ at the .if directive. Either the source file is corrupted or the tools version doesn't support it. Could you let me know which compiler version you have please?

    To find this, in CCS select "Help - About code Composer Studio", and click the "Installation Details" button. Look for the C2800 Compiler Tools to find the version number.

    Also, could you try to open and run the DF22 example in the latest DCL and let me know if that compiles? Thanks.

    Regards,

    Richard
  • Dear Sir,

    Thank you for your kind concern regarding this.

    I am using the 6.4.6 version of C2800 Compiler Tool.  

    Attaching the screenshots for confirmation

    And about running DF22 example, I just have to create a new project and add the necessary files including DCL v3.0 and have to run the example

    by modifying 2806x to 2833x or something else you mean?

  • Soumya,

    To run the DF22 example, you just import it into CCS: "Project -> Import CCS projects...", then browse to
    C:\ti\c2000\C2000Ware_1_00_05_00\libraries\control\DCL\c28\examples\F28069_DF22

    It should build and run without modification. Please let me know.

    Regards,

    Richard
  • Sir,

    I have just imported the example F28069_DF22 from the DCL v3.0. And found these errors. The Screenshot is attached herewith.  The errors came just after importing the project, I have not debugged the same yet. 

    As I am using the TMSDOCK28335 Experimenter Kit, should I change or modify anything to the project.

  • Soumya,

    Thanks. I believe this is related to the tools version you are using. I will come back to you.

    Meanwhile, if you need to use the code, you should be able to proceed by commenting out the line where the error appears, and the two lines following it. In assembly, you comment out a line by placing a ";" character at the start of the line, as is done in the comment fields at the top of the file. You'll have to do this in all the DCL assembly files you add.

    Regards,

    Richard
  • Good Morning Sir,
    As I am using TMSDOCK28335 Experimenter Kit and while importing the example DF22 project, I am getting a lot of errors.
    I have started building a new project to run the example file of DF22, so please inform me what are the files that I should include and add to run the example code in my device?
  • Soumya,

    Are you saying you just opened the project and built it and got errors?  Or did you modify the code or project settings at all?  What errors are you getting?

    I can confirm the [E0004] & [E0300] errors you saw previously are due to the tools version you are using, and that modifying the assembly code as I described will get around it.  With that you should be able to compile your own project with DCLv3.  Please let me know.

    Regards,

    Richard

  • Dear Sir,

    I have just imported the example file F28069_DF22 (from C:\ti\c2000\C2000Ware_1_00_05_00\libraries\control\DCL\c28\examples\F28069_DF22) to CCS. And the following errors appeared.  The screenshot is attached with this showing the error details. I have not modified anything.

  • Soumya,

    Well, I can see the headers have been changed. I just wanted to build the original project to know whether the code or the tools were the problem.

    Anyway the problem is certainly the tools version. Once you have modified the .asm files these problems should go away.

    Regards,

    Richard
  • Dear Sir,
    Should I take all the header files (include folder) and the source files from C2000ware or should I take only the DCL (HEADER AND SOURCE) files from the C2000ware and the remaining from Control suite as usual?
    Regards,
    Soumya.
  • Sir,
    Thank you for your suggestion of commenting out in .asm files.
    That works fine now.
    But when I am debugging the project, error shown in
    #include "F2833x_Device.h" line.
    Again when I comment out these lines
    (#include "F2833x_Device.h"
    #include "F2833x_Examples.h"
    #include "F2833x_GlobalPrototypes.h" ), now I am getting an error in
    #include <complex.h> line , which is present in DCLF32.h file.
    Please Help.
    Regards,

    Soumya.

  • Soumya,

    I'm very sorry you're having this issue. It looks like the file may not be present on your machine.

    From an earlier post I can see you have the CG tool directory specified so I suspect it may be the tools version you are using. It's strange though. Can you search in the following directory on your machine to see if the "complex.h" file is actually there please? From an earlier screen-shot you posted it should be in:
    C:\ti\ccsv6\tools\compiler\ti-cgt-c2000_6.4.6\include

    Thanks.

    Regards,

    Richard
  • Good Morning Sir,

    Thank you for your reply.

    I searched for the directory you told, I didn't find the file complex.h there. Attaching the screenshot with this.

    But I found the file complex.h in the following directories

    C:\ti\ccsv6\tools\compiler\ti-cgt-c6000_8.1.0\include

    C:\ti\ccsv6\tools\compiler\c6000_7.4.14\include

    C:\ti\ccsv6\tools\compiler\ti-cgt-c6000_8.1.0\include

    And Sir What about the error in #include "F2833x_Device.h" ?

    Eagerly waiting for your reply.

    Regards,

    Soumya.

  • Soumya,

    I don't think there is a viable alternative to upgrading to a newer version of the tools. We need complex support (and preferably EABI support) to use DCLv3. Are you able to do upgrade to the latest CCS?

    Best regards,

    Richard

  • Dear Sir,

    I have upgraded to CCS v.8.0.

    I need a clarification about adding header (includes) files and sources files. Should I choose these files from

    C:\ti\c2000\C2000Ware_1_00_05_00\device_support\f2833x or C:\ti\controlSUITE\device_support\f2833x\v142.

    Till now I have added these files (header includes and source) from C:\ti\c2000\C2000Ware_1_00_05_00\device_support\f2833x. Also, I have commented out these files because of the errors on the lines. 

    Now I don't have any errors in the main.c file. But I am getting errors while debugging it. A Screenshot is attached with this for error details. 

    #include "F2833x_Device.h"
    #include "F2833x_Examples.h"
    #include "F2833x_GlobalPrototypes.h"

    Waiting for your kind suggestions.

    Regards,

    Soumya.

  • Soumya,

    Good.  Thanks for updating CCS.

    Probably for this device it won't make any difference, but in general I recommend always taking content from C2000Ware rather than controlSUITE.  The latter is no longer being updated, whereas you will always get the newest materials in C2000Ware.   

    The errors you are seeing are because the same symbol is defined in two different source files.  This is because you have included "DefaultIsr" and SWPrioritizedDefaultIsr" source files in the same project.  They do similar things, but the latter allows the user to prorritize interrupts in software.  If you're not doing that, jut remove the files with "SWPrioritized" in the filename and these errors will go away.  If you open the SW proritized interrupts example project you'll see the DefaultIsr.c file is not there.

    Regards,

    Richard

  • Dear Sir,

    Thank you very much for your suggestions. Most of the errors have been eliminated now. But few til remained still. Attaching the screenshot for details of errors.

    Waiting for your suggestions.

    Regards,

    Soumya.

  • Soumya,

    The unresolved symbol error is there because you need to add the source file "DCL_clamp_C1.asm" to your project.

    You can avoid the error by specifying in the linker command file where you want the DCL functions to be linked. For example, you might do something like:

    dclfuncs : > RAML0, PAGE = 0

    Regards,

    Richard
  • Thank you very much, Sir.

    The project is running successfully now.

    All the errors got eliminated though I didn't follow the suggestion #2 and took a trial.

    But I am getting a warning, which seems to be serious.

    The statement is unreachable for   InitCpuTimers();

    The screenshot is attached with this.

    One more thing, How can I check that my compensator is working fine?

    Waiting for your guidance.

    Warm Regards,

    Soumya.

  • Soumya,

    OK, glad to hear.

    The remaining problems are in your code, not in the library. The "unreachable statement" warning is telling you that program execution will never reach that line. I can see in the screen-shot there is a closing bracket in line 219 - is that an infinite loop by any chance?

    The sections warnings are because you have #pragmas in the code which specify names memory regions not referenced in your linker command file. I'm guessing you copy-pasted those lines into the F28335 example from the DF22 example code, but didn't modify the linker file. The DF22 example sets up four buffers to stream data through the controller to verify it works correctly. If you look in the linker command file for the DF22 example you'll see:

    pDataLogSection : > RAML5, PAGE = 1 align(2)
    qDataLogSection : > RAML6, PAGE = 1 align(2)
    rDataLogSection : > RAML7, PAGE = 1 align(2)
    sDataLogSection : > RAML8, PAGE = 1 align(2)

    Also, the ramfuncs section was set up like this:

    ramfuncs : > RAML3, PAGE = 0
    LOAD_START(_RamfuncsLoadStart),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    RUN_SIZE(_RamfuncsRUNSize)

    If you're going to do this you'll need to change the block names to match the memory map on the F28335.

    Regarding how to check the compensator is working, how have you selected the coefficients?

    Regards,

    Richard
  • Dear Sir,
    Regarding the coefficients for compensators, I have already calculated it.
    And about the programme, I have pasted the lines from DF222 example.
    I also added the lines to the .cmd file, what, you suggested.
    Still, the warning message coming as " #10247-D null: creating output section "PdataLogSection" without a SECTIONS specification " and similar for QdataLogSection,RdataLogSection,SdataLogSection.
    What exactly I have to do for this?
    Waiting for your guidance.

    Regards,
    Soumya.
  • Soumya,

    Most likely that is because you have spelled the section names differently from the example. Take care about upper and lower case: "PdataLogSection" is not the same as "pDataLogSection". The names have to match exactly. The DF22 example works perfectly, so if you are having issues it is always useful to go back to that and compare.

    Regarding the validation of coefficients, please open a separate post as it is a different question and this thread is too long. I will try to help but I need to know what specifications you were aiming to meet and how you did the calculation.

    Regards,

    Richard
  • Thank you, sir, for your constant and timely support in solving the matter.
    As you said, I have already created another thread and waiting for the solution from your end.
    Thank you very much.

    Warm Regards,
    Soumya.