Other Parts Discussed in Thread: TPS2HCS08-Q1,
Tool/software:
Hi team,
I would like to check with you how we conversion below ADC result to voltage/current/temperature value? Can you provide the formula?
Thanks!
Ethan Wen
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.
Tool/software:
Hi team,
I would like to check with you how we conversion below ADC result to voltage/current/temperature value? Can you provide the formula?
Thanks!
Ethan Wen
Ethan,
We do have the following C driver package that has reference implementations on how to convert the raw ADC value to a float value:
https://www.ti.com/lit/pdf/slvaft2
/** * @brief Converts a raw ADC voltage value to a read float value * * This is a convenience function that will take a raw value read from * one of the ADC result registers and convert it into a human readable * float value. * * @param[in] rawValue Raw value to convert * * @retval returnCode Floating point representation of voltage */ float_t HCS_convertVoltage(uint16_t rawValue); /** * @brief Converts a raw ADC current value to a readable float value * * This is a convenience function that will take a raw value read from * one of the ADC result registers and convert it into a human readable * float value. * * @param[in] rawValue Raw value to convert * @param[in] ksnsVal KSNS constant from the datasheet * @param[in] snsRes Value of resistor on the SNS pin * * @retval returnCode Floating point representation of current */ float_t HCS_convertCurrent(uint16_t rawValue, uint16_t ksnsVal, uint16_t snsRes); /** * @brief Converts a raw ADC temperature value to a readable float value * * This is a convenience function that will take a raw value read from * one of the ADC result registers and convert it into a human readable * float value. * * @param[in] rawValue Raw value to convert * * @retval returnCode Floating point representation of temperature */ float_t HCS_convertTemperature(uint16_t rawValue);
and the implementations:
float_t HCS_convertVoltage(uint16_t rawValue) { return ((50.092f * ((float_t)rawValue))) / 1705.341f; } float_t HCS_convertCurrent(uint16_t rawValue, uint16_t ksnsVal, uint16_t snsRes) { return (((float_t)rawValue * ksnsVal * HCS_ADCREF) / (1023.0f * snsRes)); } float_t HCS_convertTemperature(uint16_t rawValue) { return ((((float_t)rawValue * 0.002737f) - 1.3815f) / (-0.003344f)); }
Best Regards,
Tim
Hi Tim,
Please correct me if my understanding is not correct.
Voltage=(50.092*rawValue)/1705.341
Current=(rawValue*ksnsVal*HCS_ADCREF)/(1023*Rsns)
Temp= ((rawValue*0.002737)-1.3815)/(-0.003344)
1. rawValue is the decimal from 10 bit ADC result, is it correct?
2. KsnsVal=5000
3. HCS_ADCREF=2.8V(below is from TPS2HCS08 datasheet, but I am not sure if it is the same for TPS2HCS10)
Take an example: if ADC_RESULT_CH1_V=460(decimal), then the real voltage should be (460*50.092)/1705.341=13.51V. Correct?
Thanks!
Ethan Wen
Ethan,
This is how we calculate it today, correct. Are you seeing something different with your results?
Best Regards,
Tim
Hi Tim,
Yes, customer tried but the results not align with actual value.
The actual load current is about 5A. ADC read value is about 128. So according to this formula, Current=(rawValue*ksnsVal*HCS_ADCREF)/(1023*Rsns)=(128*5000*2.8)/(1023*1000)=1.752A
Device put in the room temperature environment, so the temperature should be not much high. ADC read value is about 94. Temp= ((rawValue*0.002737)-1.3815)/(-0.003344)=((94*0.002737)-1.3815)/(-0.003344)=336.
Could you please help double check all the formula?
Thanks!
Ethan Wen
Ethan,
Could you let me know the following:
Best Regards,
Tim
Hi Tim,
See my reply below.
1. TPS2HCS10-Q1, B0 silicon
2. Customer is using a 25ohm resistor connect to the output.
3. Customer own board.
Is it not align with your measurement?
Thanks!
Ethan Wen
Ethan,
One thing that I do see that might be different is the resistor that they put on the SNS pin. Could you confirm this value? This will affect the reference that the internal ADC has (essentially it will change the KSNS value).
Best Regards,
Tim
Hi Tim,
RSNS is 1kohm. It seems that the calculated value has big difference with actual value. Could you double confirm if the formula is correct?
Even for VOUT voltage, the actual value is 12.5V(use multimeter to measure), the calculated value=(50.092*419)/1705.341=12.3V. Does 0.2V error align with our spec?
Thanks!
Ethan Wen
Ethan,
The 0.2V deviation would align with what we would expect for the accuracy numbers. It is meant more of a way to detect open load conditions or VOUT errors such as erroneous VDS.
The 1kOhm will shift the I2T trip values- but shouldn't affect the KSNS ratio. Could you share the schematic again? The ground end of the SNS resistor, is it connected to the IC ground of the 2HCS10 or is there a resistor/ground network?
Best Regards,
Tim
Hi Tim,
See below the schematic from customer.
I don't see the problem of GND.
Thanks!
Ethan Wen
Ethan,
Got it- no issue with the ground network.
Just to make sure:
You are masking out the RDY bit, correct?
I put 1.5 ohm on the output with 12V supply and I am getting decimal 357. That would translate to:
(357 * 2.8 * 5000) / (1023 * 698) = 6.999A... which tracks well with the load current.
Could you confirm the SNS resistor and if they are masking out the actual raw value?
Best Regards,
Tim
Hi Tim,
Thanks!
I am not quite understand about masking out the RDY bit. You want to make sure that ADC read value should be refreshed correctly? When ISNS ADC data new conversion is done, ISNS_RDY_CH1 will toggle to 1?
Regards,
Ethan Wen
That's correct- but I am just making sure that you are not actually calculating the ADC value with the ready bit in the raw value.