The Collect Data function reads
the desired result registers and sends the data based on the specified settings.
This function works best with continuous conversion mode and does not configure the
EVM or associated register settings. Collect mode started and stopped via the serial
COM port, however the results are sent over the USB BULK channel. To use this mode,
use the following format:
- Start collecting data format:
collect timerPeriod collectFlags channelAddressIDs numDevices.
- Where collect is always
lower case, and each parameter is the decimal representation of the
value in the following format:
- timerPeriod
- The timer
delay used in the MCU to allow data collection sample
sets (in µs, unsigned 32-bit value).
- collectFlags
- a byte of
data that has a 1 to collect and a 0 to not collect each
register value type, according to the following
definitions (note to only use energy and charge flags
when the device supports that, otherwise set to 0):
- VBUS = 0b0100000
- DIETEMP = 0b0010000
- CURRENT = 0b0001000
- POWER = 0b0000100
-
ENERGY = 0b0000010
- CHARGE = 0b0000001
- channelAddressIDs
- I2C
- This is the 4 LSBs of each address chained
together, starting with the LSBs.
- For example, if EVM 1 is on channel 0x41 and EVM
2 is on ox43, the value here is 0b00110001.
- NumDevices
- The
number of EVMs chained together (1-4).
- For example, to start
data collection for VBUS, and DIETEMP every 3.156 ms, for two INA745s
with EVM 1 address = 0x44 and EVM 2 address=0x46, the user needs to
send: collect 3156 48 100 2.
- For this example,
the EVM returns the acknowledgment and state in JSON format:
- {"acknowledge":"collect 3156 48 100 2"}
- {"evm_state":"collecting"}
- The USB BULK channel
receives data in the format: frameID deviceNumID address registerSize
data.
- Where each
parameter is the decimal representation of the value in the
following format:
- frameID
(1 byte)
- Always reads 0. Used to verify data is
aligned.
- deviceNumID (1 byte)
- An ID number corresponding to the EVM number.
- From the above example, this is 1 if reading from
EVM 1 which had an address set to 0x44, and 2 if
reading from EVM 2 which had an address set to
0x46.
- address
(1 byte)
- The register address that was read from the
device.
- registerSize (1 byte)
- The number of bytes that the following data
has.
- data (1
byte at a time)
- The register data value, given in bytes with the
most significant byte first.
- Stop collecting data format:
stop
- Where stop is always
lower case.
- The EVM returns the
acknowledgment and state in JSON format:
- {"acknowledge":"stop"}
- {"evm_state":"idle"}