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/TMS320F28020: TMS320F28020 question about 2P2Z function

Part Number: TMS320F28020

Tool/software: Code Composer Studio

Issue description:

Message information
55 AA 00 00 00 00 00 02 FB 95 00 01 CD 1C 42 5B 00 6E 31 9D 05 04 00 00 00 C8 00 66 66 66 FF 37

1.I used TMS320F28020, The frequency is 50M, I call the CNTL_2P2Z.Asm function.

2. After I power on the PCB, I found 2P2Z operation result error, is a great value, is not between set the Max and Min.

3.Doing experiment 1.Set the progRAM length 400, from the map view the actual length of (160), set the dataRAM length B00,
from the map view the actual length of for (65). Then the 2P2Z_1 calculation results in the setting of range (000000C0-00666666)
,but 2P2Z_2 value is not within the scope of, and as a fixed value (4158465A) is beyond the scope .

4.Doing experiment 2.Set the progRAM length 800, from the map view the actual length of (160), set the dataRAM length 800,
from the map view the actual length of for (65). Then the 2P2Z_2 calculation results in the setting of range (000000C0-00666666)
,but 2P2Z_1 value is not within the scope of, and as a fixed value (319D0504) is beyond the scope .

5. The proggram is only modify the length of the progRAM and dataRAM CMD file, and other places do not make any changes.

6. A message reading: (55 AA) begin message -- -- -- (00 00 00 00) - reference value
                                          (00 02 FB 95) 2P2Z - 2 of 2 input, (00 01 CD 1C) 2P2Z - 1 input
                                          (42 5B 00 6E) flag, no practical significance
                                          (31 9D 05 04) 2P2Z - 2 output, (00 01 CD 1C) 2P2Z - 1 output

7. Can you tell me how to make 2P2Z-1 and 2P2Z-2 the output of the normal at the same time? Where is my problem ?
 
10. How to properly allocate the size of the progRAM and dataRAM, whether to have this document or notice?

  • Hello Roy,

    If I understand correctly, you are downloading the program and initialized data over a serial link to internal RAM and running the program. I see the coefficients and limit values are initialized in your code, but I do not see where the internal states are initialized. It might be that these are producing the unexpected outputs when you run the code. Can you check you are correctly setting up the 2P2Z vars structure in your code - including the reference, feedback, and the two delay lines? I recommend setting a break-point just before the 2P2Z call and verifying these data are correct.

    If you know in advance the size of your code and data sections you just need to allocate sufficient memory in the linker file. Keep in mind the linker file specifies memory size in 16-bit words. I'm not clear on why the code & data size is connected to the 2P2Z operation, unless the uninitialized data are taking previously loaded values.

    Regards,

    Richard
  • Dear Richard:

    ok, thanks.

    please check the file of the map.

    what is the mean about "CNTL_2P2Z_CoefStruct1.i_min" ?

    How can I use this function about CNTL_2P2Z_CoefStruct1.i_min ?

  • Dear Roy,

    The coefficient "i_min" is used to allow the internal control variable to have negative values, even when the controller output is saturated to a lower limit of zero.  This prevent oscillations from building up and allows the controller output to converge on zero steady state.  Here is the description from the library User's Guide:

    "i_satmin is the value used for saturating the lower bound of the control effort when storing the history of the output. This allows the value of the history have negative values which can help avoid oscillations on the output in case of no load. The user can specify it’s own value however it is recommended to use _IQ24(-0.9)."'

    If you're driving a PWM duty cycle, for example, typically you want the lower bound of the control variable u(k) to be zero.  However the 2P2Z controller structure used in the library won't perform properly if the data going into the recursive path isn't allowed to go negative.  For that reason there is a different structure element for the recursive lower clamp.

    Regards,

    Richard