The Collect Data function can also be
started and stopped through the serial COM port, however the results
will be sent over the USB BULK Channel. To do this, use the
following format:
- Start collecting data format: collect timerPeriod
collectFlags channelAddressIDs numDevices
- Where each parameter is the decimal representation of the value in the
following format:
- timerPeriod: The delay used in the internal timer
to allow data collection sample sets (in
milliseconds, 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):
- VSHUNT = 0b1000000
- VBUS = 0b0100000
- CURRENT = 0b0001000
- POWER = 0b0000100
- channelAddressIDs
- 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 0x43, the value here would be
0b00110001
- NumDevices is the number of EVMs chained together (1-4).
- For example, to start data collection for VSHUNT,
VBUS, and CURRENT and POWER every 10 ms, for four
INA236s with EVM 1 SW0 = GND, EVM 2 SW0 = VS, EVM
3 SW0 = SDA and EVM 4 SW0 = SCL, you would send:
collect 10 108 12816 4
- For this example, the EVM would return the
acknowledgment and status in JSON format:
{"acknowledge":"collect 10
108 12816 4"}
{"evm_state":"collecting"}
-
Note, for the rreg and wreg functions above, the
EVM will return "collecting" instead of "idle" if
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 ensure
data is aligned.
- deviceNumID (1 byte): An ID number corresponding to the
EVM number.
- From the above example, this will be 1 if reading
from EVM 1, 2 from EVM 2, 3 from EVM 3, and 4 from
EVM 4.
- address (1 byte): The register address that was read
from the device.
- registerSize (1 byte): The number of bytes that the
following data will have.
- data (1 byte at a time): The register data value, given
in bytes with the most significant byte first.
- Stop collecting data format: stop
- The EVM would return the acknowledgment and status in JSON format:
{"acknowledge":"stop"}
{"evm_state":"idle"}