Use the serial COM port to read and write registers through USB commands using the following format:
- Set device address format: setdevice DEVID
- Where setdevice is always
lower case, and DEVID is defined as:
- The 4 LSBs of the
address in decimal format. Ex, for an address of 0x4A, use
10.
- Note, when the SCB is reset
while one or more EVMs are connected, the address defaults to the lowest
address found.
- The SCB checks for
I2C or SPI at start up. If no device is attached, then the
device defaults to SPI. Reset the SCB with an I2C EVM connected
to use I2C.
- For example, to set the
INA220 with a register address of 0x4A, send the command: setdevice
10.
- For this example, the EVM
returns the acknowledgment and state ("idle" or "collecting") in JSON
format:
- {"acknowledge":"setdevice 10"}
- {"evm_state":"idle"}
- Read register format: rreg ADR
- Where ADR is the address in
hex, and rreg is always lower case.
- Register addresses can be
in upper or lower case, and do not need to be led by '0x'. 0 padding
register addresses is also optional. For example, to read register
address 0x02, some valid commands include:
- rreg 2
- rreg 0002
- rreg 0x02
- When '0x'
is used, the 'x' must be lower case.
- For this example, the EVM
returns the results and state ("idle" or "collecting") in JSON format:
- {"acknowledge":"rreg 0x02"}
- {"register":{"address":2,"value":6626}}
- {"evm_state":"idle"}
- Write register format: wreg ADR VAL
- Where ADR and VAL are in hex, and wreg is always lower case.
- Register addresses and values can be in upper or lower case, and do not need to be led by '0x'. 0 padding register addresses and values is also optional. For example, to write register address 0x0 with the value 0x3ccf, some valid commands include:
- wreg 0 3ccf
- wreg 00 0x3ccf
- wreg 0x00 0x3CCF
- When '0x' is used, the 'x' must be lower case.
- For this example, the EVM returns the results and
state ("idle" or "collecting") in JSON format:
- {"acknowledge":"wreg 0x00 0x4ccf"}
- {"console":"Writing 0x3ccf to CONFIGURATION register"}
- {"evm_state":"idle"}