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.

DPS library and CNTL_2P2Z

Expert 2730 points


What is the idea of having the reference, Feedback and output to be in Q24 format? The feedback usually comes from ADC which is Q15 and the output usually goes to PWM which is again Q15 so what is the point for Q24? To use this I have to convert ADC to Q24 and also if I don't want to use PWM driver then I will have to convert output from Q24 to Q15 to get it work properly, right? I'm not very familiar with the IQ math so is this done by left shifting 9 times to get Q24->Q15? You can also do it by right shifting 5 to get Q31 and then get only high bytes from the 32-bit register?

  • Jhi,

    The reason to choose the format is to preserve maximum resolution, along with accounting for larger bandwidth,

    The ADC Result register read as such would not be Q15, but Q12...

    We always follow normalization on our control algorithms, and choosing Q24 we get 24 bit of resolution as compared to Q15,

    Q24 was selected because we wanted ti to be consistent with the typical use of  Q24 format in our DMC library,

    No, to go from Q24 to Q15 you have to right shift by 9 not left,

    Regards

    Manish Bhardwaj

  • But can I just give the values to CNTL_2P2Z as they are ,I mean ADC value for feedback as is and reference value according to ADC, and I will get the right result for the PWM or do I have to make conversions?

  • Not sure what exactly you are trying to do,

    We specify in the DPLib document that all the inputs should be Q24.. and provide blocks for that..including ADC conversion and PWM Drivers...

    using different Q's for everything would not give you the desired results,

  • What I try to do is avoid unnecessary shift operations. I know it takes only a cycle to do that but why to do it if not necessary. And I like to configure my ADC and everything by my own and not via assembly macros. Why is the ADC Q12 and not Q15? Isn't it usigned 16-bit value? This is why I don't like IQ math. In my opinion it's much more complicated than using only fixed point and I can scale the values if really needed.

  • JHi,

    You need to understand what may be unnecessary for you may not be for some one else,

    A controller block may not always take ADC input as a feedback and hence choosing a Q point for your application is very important,

    otherwise yes, an alternative is to keep track of using whatever you may call it,

    the Q point is not determined by the max number of bits, it's just a method to view the same number of bits such that you can extract the maximum resolution out of it,

    here is a free course offered by TI, i think this would be helpfull for you,

    http://training.ti.com/courses/CourseDescription.asp?iCSID=46234