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.

TMS320F28069: Using PID library

Part Number: TMS320F28069
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE

I have implemented PID by referring "C:\ti\controlSUITE\libs\control\DCL\v1_00_00_00\docs".

This document says about mapping library to RAM in page 0

dclfuncs : > RAML4, PAGE = 0

By doing this I was not able to program MCU using C2Prog as it used to give me sector violation error.

so I changed 

dclfuncs : > FLASHF, PAGE = 0

which solved C2Prog problem, and the program was also working properly. 

I wanted to ask experts is this correct? Can PID library be assigned to flash ?

Please guide.

  • Yes, you can safely assign the library functions to flash. Keep in mind that code execution from flash is slower than it is from RAM. Typically we want the controllers to execute as fast as possible to minimize delay in the loop, so the DCL functions were assigned to the named section "dclfuncs" to allow the user to copy them into RAM before execution, if desired.

    By the way, a more recent version of DCL is available in C2000Ware. I recommend downloading that as there have been some improvements since v1. In the newer version you will find code examples for F28069 which may help you.

    Regards,

    Richard
  • Richard Poley said:
    Keep in mind that code execution from flash is slower than it is from RAM.

    Sir,

    1) By how much will the execution time be affected. I'm calling controller function

    uk = DCL_runPID(&pid1, rk, yk lk);

    in 30 us ADC interrupt.

    2) Is there any way to get over "sector violation (range: 0x8090 ... 0x809f)" in C2Prog by assigning dclfuncs to RAM ? As we use serial programming. 

  • Raw flash access time on this device is about 30ns, but code execution will be faster because the C28x uses a 128-bit fetch buffer.  Providing this is kept full (no branches), you have initialized the flash correctly, and depending on the 16-bit vs 32-bit opcode mix, you should see flash execution around 70 MIPS on a 90 MHz device.  The PID controller you are using executes in 70 cycles, so it would take 778 ns in RAM and about 1 us in flash. 

    I am not familiar with C2Prog, but I'm guessing the issue happens because you are linking the "dclfuncs" section directly into RAM.  For functions executing in RAM you should assign a load address in flash and a run address in RAM, so the linker places the code in flash (where C2Prog loads it) and your code copies it into RAM when the program starts.  There is a good application note describing the process here:

    www.ti.com/.../spra958l.pdf

    There is also a code example for F28069 under the "device_support" directory in controlSUITE (and C2000Ware).

    I hope this helps.

    Regards,

    Richard