2024-06-27 03:32 AM
i bought a TSC1641 evaluation board, I can't read the power information from the DC power register. I can successfully read shunt voltage, current, load voltage data.
the configuration is as follows:
Rshunt register value = 0x01F4; the shunt resistance on my semim development
board is 5 mili ohms.(decimal=500).
configration register value = 0x0037; conversion time 1024 µs (default),
7h: shunt and load voltage, continuous mode (default).
I check the FLAG register data zeroth (CVNF) bit to see if the data is ready,
but regardless of this, I do a reading at any time.does this cause problems
with reading dc power information?
2024-06-27 03:36 AM - edited 2024-06-27 03:42 AM
Print the value you're actually getting from the register - maybe the problem is in your calculation?
Correction:
What you're printing here is somehow arriving via a pointer - have you checked the point at which it's actually read from the chip?
Please use this button to properly post source code - rather than a screenshot:
2024-06-27 03:42 AM
the decimal value I got from the recording is zero. therefore, the result of the multiplication used from the calculation of the actual power is also zero
2024-06-27 03:43 AM
I am printing the value I read from the recording on the screen. the value returns as zero.
2024-06-27 03:45 AM - edited 2024-06-27 03:46 AM
Sorry - I corrected the post:
What you're printing here is somehow arriving via a pointer - have you checked the point at which it's actually read from the chip?
What do you mean by "recording" ?
2024-06-27 04:07 AM
By "register" I mean DC POWER REGISTER.
ret = HAL_I2C_Mem_Read(&hi2c1, (uint16_t)0x81 , (uint16_t)REG, (uint16_t)1, Read_reg_data, (uint16_t)2, 50);
I perform a read operation with a length of 2 bytes and the value read from the
corresponding record is transferred to the variable "read_reg_data". the content
of this variable is zero when the reading process is finished.
2024-06-27 04:18 AM
2024-06-27 05:09 AM
OK - you didn't show that before.
ret = HAL_I2C_Mem_Read(&hi2c1, (uint16_t)0x81 , (uint16_t)REG, (uint16_t)1, Read_reg_data, (uint16_t)2, 50);
do you check the value of ret - to see that the read was actually successful?
@fog.1 wrote:By "register" I mean DC POWER REGISTER
So "recording" was just a typo for "register" ?
2024-06-27 05:37 AM
I'm checking the "rejection" value. there is no mistake. the rejection value appears as "HAL_OK". in addition, everything is normal when I check the "SDA" line on the "I2c" interface with the logic analyzer.
the same "I2C" reading function is used in these two operations. he from both "return= HAL_OK."
as I said, all other recording values can be read successfully, but only the "dc power recording" value returns as zero when the reading is done.
2024-06-27 05:41 AM
OK - out of ideas, then.