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.

MSP430F6769A: Regarding improving accuracy of A/D conversion_Ask again

Part Number: MSP430F6769A

Hi,

Thank you for always answering!

Sorry, I closed the question thread by mistake...

Please let me ask the question again.

e2e.ti.com/.../msp430f6769a-regarding-improving-accuracy-of- a-d-conversion/4952023#4952023

The contents of this page are listed at the end of the URL. Please refer.

You answered that a different IQ value is required to prevent overflow, but if the N value requires, for example, 24, does that mean that the N value needs to be changed if an overflow occurs?

Since the AD conversion bit number of MSPF6769A is 24 bits, I want IQ24 data, but if this causes an overflow, would it be okay to change the value of N?

Also, the value is measured around 964827590 in the offset binary state.

To avoid this, looking at the data sheet, do you think it would be correct to multiply that value by a coefficient of 2 or more as _iq6 or less, which is less than half of 16777216?

https://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/IQmathLib/latest/exports/MSP430-IQmathLib-UsersGuide.pdf

I think my thinking is wrong, so I would appreciate it if you could enlighten me.

Thank you for your understanding.

Toshiharu

  • Hi,

    I am not totally get your point.

    But for how to preventing overflow. I shows the follow examples on how to define the IQ type of the operation result for preventing overflow. 

    IQ23 data_A = IQ24 data_B + IQ24 data_C.

    IQ16 data_A = IQ9 data_B * IQ7 data_C.

    IQ2 data_A = IQ9 data_B / IQ7 data_C.

    Best regards,

    Cash Hao

  • Hi, Cash

    Sorry, I omitted a lot of what I asked before (URL in the first sentence).

    MSP430F6769A: Regarding improving accuracy of A/D conversion - MSP low-power microcontroller forum - MSP low-power microcontrollers - TI E2E support forums

    To explain in more detail, I am currently trying to obtain high resolution using the MSPF6769A's built-in AD converter.

    So now I'm thinking of using IQmathlib to increase the resolution.

    The current settings are offset binary method, OSR=1024, external power supply voltage, and external reference.

    The program changes the CPU settings based on msp430f677×A_sd24b_06.c in Resource Explorer.

    I'm thinking of using IQmathlib functions to increase the resolution here.

    MSP430F6769A has a resolution of δΣ24bit, so I would like to get more performance out of it.

    That was the content of the first sentence.

    The output value of the current program was approximately 964827590.

    In the reply in the URL of the first sentence,

    "Better would be to apply your scaling factor to the ADC result then switch to IQ24. It could in fact be done in one step. Assuming you have a scale factor in IQ24 format, just multiply. No need to use the IQmath functions, just a regular multiply.

    Since you start with a number with zero fractional bits and one with 24, the result will have 24 and thus be in IQ24 format. Assuming the scale factor doesn't result in an overflow of the integer part, this works great. If it does overflow, you need a different IQ format."

    It said. This means that if you set IQ24 and try to get the value, 24bit=16777216, so if you multiply 964827590 by 2, etc., it will overflow. Now I don't know how to set the IQN.

    Since MSP430F6769A has a maximum performance of 24 bits, I thought that IQN should be set to N=24, but I think there is no particular rule and you should just enter an appropriate N.

    However, I didn't know the appropriate value for N.

    I think that if the result obtained by AD conversion is IQN (result), it will be converted to an IQ value, but I don't know if that alone will improve the resolution accuracy or what to do.

    Could you please give me some advice since I have no knowledge?

    CCS version is 12.5.0.

    Thank you for your understanding.

    Toshiharu

  • Hi Toshiharu,

    So now I'm thinking of using IQmathlib to increase the resolution.

    I do not think using IQ format will increase the resolution in your case. The IQ format is used for represent a float data by a fixed-point data. Since the MSP430 does not include a FPU. So, a fixed point algorithm is more friendly to the MSP430 MCU. For example, convert a float data into IQ24 and a IQ30 format. 

    _IQ24(0.5243) = 0.5243*2^24 ~= 8,962,388.8 = 0x88 C155 

    _IQ30(0.5243) = 0.5243*2^30 ~= 562,962,838.3 = 0x218E 2196 

    Then convert back to float format and check the errors between those two format. 

    _IQ24:  0x88 C155/2^24 ~= 0.524299979.  Error is 0.524299979-0.5243 = 0.00000002

    _IQ30:  0x218E 2196/2^30 ~= 0.524299999.  Error is 0.524299999 - 0.5243 = 0.000000001

    As a conclusion, in this case using IQ30 to represent a float point data has less errors than IQ24. The error is coming from ignoring the decimal part of the data during conversion. However, on the other hand, the IQ30 format has less range than IQ24 format. You can only use a IQ30 format to represent a float data within the range of -2 to 1.999 999 999. And for a IQ24 format the range is -128 to 127.999 999 940.

    So, if you have a float data 101.2345 and want to convert it into IQ format, it requires to use at least IQ24 format or lower to represent that data. 

    Best regards,

    Cash Hao

  • Hi, Cash

    Thank you for your answer!

    I do not think using IQ format will increase the resolution in your case.

    Is it correct to understand that the result I am looking for cannot be calculated using IQmath? Since we need a resolution of 24 bits, we need floating point numbers instead of fixed point numbers.

    When I asked him about his story, was it correct to understand that IQmath is useful for obtaining answers that are acceptable even with fixed-point numbers, and that IQmath is not suitable for answers that require floating-point numbers?

    If so, consider ways to increase the resolution using another approach without using IQmath.

    I'm very sorry if this means that I can't use it.

    I look forward to your reply.

    Thank you.

    Toshiharu

  • Hi,

    Is it correct to understand that the result I am looking for cannot be calculated using IQmath? Since we need a resolution of 24 bits, we need floating point numbers instead of fixed point numbers.

    Both float and fixed point format can get a resolution of 24 bits. So why we prefer to use fixed point data in the MSP430 MCUs. It is because the MSP430 does not have an integrated floating process unit. If there is a lot of calculations with float data, it is preferred to convert the float data to fixed point data and then compute. It will save a lot of time and power consumption on the MSP430 platform. Using the fixed point data does not help on increasing the resolution.  

    When I asked him about his story, was it correct to understand that IQmath is useful for obtaining answers that are acceptable even with fixed-point numbers, and that IQmath is not suitable for answers that require floating-point numbers?

    No, the IQmath is also suitable for answers that require floating-point numbers. You can use fixed point data for calculation process, and then convert the final fixed point result back to float point numbers. 

    Best regards,

    Cash Hao

  • Hi, Cash

    Thank you for your answer!

    Using the fixed point data does not help on increasing the resolution.

    I see.

    This means that even if you convert it to a fixed-point number and perform calculations, it is not suitable for the purpose of improving resolution in the first place.

    Increasing accuracy using IQmath and increasing accuracy using FPU are different from treating the same idea.

    In any case, since the MSP430 does not have an FPU, it is expected that high-precision floating point operations will be difficult, so I would like to find out more about this.

    I think I may have misunderstood the above, but in that case, I would be very grateful if you could provide me with further guidance.

    Thank you very much.

    Best regards,

    Toshiharu

  • Hi Toshiharu,

    This means that even if you convert it to a fixed-point number and perform calculations, it is not suitable for the purpose of improving resolution in the first place.

    Yes. About "high-precision floating point operations", I do not have much to share. Using the fixed point format to replace float point calculation is usually used. However, it has limitations. The range for each IQ format has a limit. SO, this method might not suitable for your application. 

    Best regards,

    Cash Hao

  • Hi, Cash

    Thank you for your answer!

    I am very disappointed that it is not possible to increase the resolution with IQmathlib. However, I was able to gain knowledge about IQmath. I think it will come in handy when you have to go to work.

    Thank you very much for your guidance!

    Toshiharu

**Attention** This is a public forum