summaryrefslogtreecommitdiff
path: root/extra/usb_power/board.README
blob: e2536604966d96c6dbcd2e035c6a9280287f5afc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Sweetberry USB power monitoring

This tool allows high speed monitoring of power rails via a special USB
endpoint. Currently this is implemented for the sweetberry baord.

To use on a board, you'll need two config files, one describing the board,
a ".board" file, and one describing the particular rails you want to
monitor in this session, a ".scenario" file.


Board files:

Board files contain a list of rails, supporting 48 channels each on up to two
sweetberries. For each rail you must specify a name, sense resistor value,
and channel number. You can optionally list expected voltage and net name.
The format is as follows, in json:

example.board:
[
{ "name": "railname",
  "rs": <sense resistor value in ohms>,
  "sweetberry": <"A" for main sweetberry, "B" for a secondary sweetberry>,
  "channel": <0-47 according to board schematic>,
  "v": <optional expected bus voltage in volts>,
  "net": <optional schematic net name>
},
{...}
]

Scenario files:

Scenario files contain the set of rails to monitor in this session. The
file format is simply a list of rail names from the board file.

example.scenario:
[
"railname",
"another_railname",
...
]


Output:
powerlog.py will output a csv formatted log to stdout, at timing intervals
specified on the command line. Currently values below "-t 10000" do not work
reliably but further updates should allow faster updating.

An example run of:
./powerlog.py -b board/marlin/marlin.board -c board/marlin/marlin_short.scenario -t 100000

Will result in:
ts:32976us, VBAT uW, VDD_MEM uW, VDD_CORE uW, VDD_GFX uW, VDD_1V8_PANEL uW
0.033004, 12207.03, 4882.81, 9155.27, 2441.41, 0.00
0.066008, 12207.03, 3662.11, 9155.27, 2441.41, 0.00
0.099012, 12207.03, 3662.11, 9155.27, 2441.41, 0.00
...


The output format is as follows:
ts:32976us:	Timestamps either zero based or synced to system clock,
		in seconds. The column header indicates the selected
		sampling interval. Since the INA231 has specific
		hardware defines sampling options, this will be the
		closest supported option lower than the requested "-t"
		value on the command line.
VBAT uW:	microwatt reading from this rail, generated on the INA
		by integrating the voltage/amperage on the sense resistor
		over the sampling time, and multiplying by the sampled bus
		voltage.
... uW:		Further microwatt entry columns for each rail specified in
		your scenario file.