Other Parts Discussed in Thread: TPS659037
I'm trying to measure the SMPS current values from TPS65038 (PMIC powering my AM5728 platform) following the description of the feature in the 6.3.2.1.3 Current Monitoring and Short Circuit Detection [1] .
#!/bin/bash
# From 5.12 Electrical Characteristics: 12-Bit Sigma-Delta ADC I_FS0=3.958 I_OS0=0.652
# Dual-phase SMPS45
K=2 #GPADC_SMPS_ILMONITOR_EN - Enable current monitoring on SMPS 45 i2cset -f -y 0 0x59 0xD4 0x22 #GPADC_AUTO_SELECT - Auto Conversion enabled on ADC Channel 11: i2cset -f -y 0 0x59 0xC8 0x0B #GPADC_AUTO_CTRL - Enable Conversion i2cset -f -y 0 0x59 0xC3 0x30 # Read Channel 11 MSB0=`i2cget -f -y 0 0x59 0xCA` MSB0=$((($MSB0 & 16#FFF) << 8)) LSB0=`i2cget -f -y 0 0x59 0xC9` CODE0=$(($MSB0 | $LSB0)) echo $(perl -e "print (((($CODE0*$I_FS0*$K)/(4096 - 1)) - ($I_OS0*$K)))")
This script is giving me a negative value all the time:
./getSMPS45Current.sh
-1.29820073260073
May I please have someone check my script?
Thank you,
Adam