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.

TMS320F280049: PPBxRESULT TRIPHI and TRIPLO Comparisons using OFFREF

Part Number: TMS320F280049

Please reference section 13.1.9 in the F280049 TRM.

In a certain application, the goal is to use the ADC post processing blocks to handle offsets.  The use case is for both TWOSCOMPEN on and off (i.e. one case with RESULT - OFFREF and the other with OFFREF - RESULT), each with their own PPB.

The question relates to the math and how it applies to the Threshold Compare.  For the TWOSCOMPEN off case, the goal is to have a TRIPHI threshold set which can be used to trigger a TZ.  But in this case, it is desired to also use the OFFREF feature.  Furthermore, it would ideal for a result lower than OFFREF to produce the trip (ex: ground bounce).

There is some clarification required in the documentation regarding how the compare works.  It states "TRIPHI and TRIPLO do NOT perform a signed comparison.  It is recommended to leave OFFREF as 0 when using limit compare functionality."

So for simple example:  Say threshold 0x800 and offset is 0x100.  If the result is above threshold, the TRIPHI will occur.  That is clear in the docs.  However, what exactly happens if the ADCRESULT is less then 0x100 in this case?  The docs state that this will produce a signed result.  Will this be interpreted as a large positive number (0xF00)  in the compare and still produce a TRIPHI?  I.e. the  ADCPPBxRESULT is sign extended and should work, assuming that the offset is smaller then the ADC Max value minus the threshold value.  In other words, if the twos complement math is handled correctly, in certain cases we can properly use the Threshold Compare with OFFREF non-zero.

The assumption is the same principle applies when setting TWOSCOMPEN to 1. Can you please confirm this rationale?

Thanks,
Eric

  • Hi Eric,

    There is a known issue with the PPB in that threshold comparisons do not function correctly with the result if it is signed, hence performing a threshold comparison with OFFREF functionality may not work.

    You can accomplish the task described in the above example (i.e. - TRIPHI threshold compare to 0x800 and offset correction of 0x100 at the same time) using two PPBs.  You can configure PPB1 to perform threshold compare and use PPB2 to make the OFFREF correction on the same SOC.  For example, you are using channel A2 as your input channel and have assigned A2 to SOC0.  You can set up the PPB as follows:

              - Set up PPB1 config to use SOC0 (ADCPPB1CONFIG.CONFIG)

              - Set PPB1 OFFREF to 0

              - Set PPB1 TRIPHI value to 0x800 (ADCPPB1TRIPHI.LIMITHI)

              - You can even set PPB1 TRIPLO to 0x100 (ADCPPB1TRIPLO.LIMITLO) to signal a ground bounce event if desired.

              - Set ADCEVTSEL accordingly (enable event detection of PPB1 TRIPHI and even PPB1 TRIPLO)

              - Set up PPB2 config to use SOC0 (ADCPPB2CONFIG.CONFIG)

              - Set PPB2 OFFREF to 0x100

    With the above setup, you should be able to have the threshold functionality in PPB1 and the offset-corrected result available in ADCPPB2RESULT.  Hope this helps.

    Best regards,

    Joseph

  • Thanks Joseph. Definitely will approach it this way. Ideally was looking to conserver PPB's for other functions, but this can still work (will do offset in CLA at cost of an extra cycle).