aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy.green@linaro.org>2013-09-17 11:01:31 +0800
committerAndy Green <andy.green@linaro.org>2013-09-17 11:01:31 +0800
commit289d743f6bb6c80af4128e941e0a3b75c0842f7c (patch)
treeeb76ff39e8df01f9b473408c53d38dabca7c9292
parent1391180075c406c75b28602b8b0f0c2254bd89ae (diff)
downloadarm-probe-289d743f6bb6c80af4128e941e0a3b75c0842f7c.tar.gz
add html autozero button
Signed-off-by: Andy Green <andy.green@linaro.org>
-rw-r--r--aepd/aepd.h1
-rw-r--r--aepd/main.c6
-rw-r--r--aepd/share/aepscope.html12
-rw-r--r--aepd/websocket-protocol.c4
-rw-r--r--config6
-rw-r--r--libarmep/aepd-interface.h2
-rw-r--r--libarmep/libarmep.h3
-rw-r--r--libarmep/sample.c39
8 files changed, 65 insertions, 8 deletions
diff --git a/aepd/aepd.h b/aepd/aepd.h
index 0e013af..588df0c 100644
--- a/aepd/aepd.h
+++ b/aepd/aepd.h
@@ -58,6 +58,7 @@ struct aepd_shared {
unsigned long modulo_integer_chan_size;
int stop_flag;
double trigger_level;
+ int zero;
};
extern struct aepd_shared *aepd_shared;
diff --git a/aepd/main.c b/aepd/main.c
index 3b5ea21..3a45e5d 100644
--- a/aepd/main.c
+++ b/aepd/main.c
@@ -296,6 +296,12 @@ int main(int argc, char *argv[])
if (aepd_shared->stop_flag)
goto done;
+ if (aepd_shared->zero) {
+ fprintf(stderr, "setting az in libaep thread\n");
+ aep_context.aepd_interface->auto_zero = 2;
+ aepd_shared->zero = 0;
+ }
+
/*
* we have the next result in aepd_interface_result..
* voltage and current per channel
diff --git a/aepd/share/aepscope.html b/aepd/share/aepscope.html
index 5def4c2..0c9edf9 100644
--- a/aepd/share/aepscope.html
+++ b/aepd/share/aepscope.html
@@ -144,6 +144,11 @@ td.heading { font-size:9pt; font: Arial; font-weight:bold; vertical-align:middle
<div id="val2" class="caliper_invalid"></div>
</div>
</td>
+ <td height="100%" style="width:100px;">
+ <div class="group">
+ <div class="control"><button id="zero" onclick="do_zero();">Zero</button></div>
+ </div>
+ </td>
</tr>
</table>
</td>
@@ -458,6 +463,13 @@ function trigger_level_changed()
socket.send("T" + trigger_level + "\n");
}
+function do_zero()
+{
+ if (socket)
+ if (socket.readyState == 1)
+ socket.send("Z\n");
+}
+
function read_local_stg(stg_name, element_name, default_value)
{
var n;
diff --git a/aepd/websocket-protocol.c b/aepd/websocket-protocol.c
index 1937a94..62425df 100644
--- a/aepd/websocket-protocol.c
+++ b/aepd/websocket-protocol.c
@@ -381,6 +381,10 @@ send:
case LWS_CALLBACK_RECEIVE:
switch (*(char *)in) {
+ case 'Z': /* zero */
+ fprintf(stderr, "zero\n");
+ aepd_shared->zero = 1;
+ break;
case 't': /* set trigger level */
if (sscanf(((char *)in) + 1, "%lf\n", &d[0]) == 1) {
aepd_shared->trigger_level = d[0];
diff --git a/config b/config
index 2daed86..dc30074 100644
--- a/config
+++ b/config
@@ -5,9 +5,9 @@ PandaBoardES-B1-ANDY
# <device path>
/dev/serial/by-id/usb-NXP_SEMICOND_ARM_Energy_Probe_S_NO00000000-if00
- VDD_VCORE1 0.220000 -14.500000 -0.009721 0.011774 -0.000311 0.000943 0 SoCVCORE1/MPU VBAT #ff0000 SoC
- VDD_VCORE2 0.470000 -45.000000 -0.015710 0.007876 -0.002165 0.000874 0 SoCVCORE2/IVA\\_AUDIO VBAT #c00000 SoC
- VDD_VCORE3 0.470000 -27.500000 -0.016074 0.002175 -0.000272 0.000625 0 SoCVCORE3/CORE VBAT #a00000 SoC
+ VDD_VCORE1 0.220000 -14.500000 -0.074000 0.137000 -0.029400 0.034100 0 SoCVCORE1/MPU VBAT #ff0000 SoC
+ VDD_VCORE2 0.470000 -45.000000 -0.174000 0.253000 -0.001600 0.008400 0 SoCVCORE2/IVA\\_AUDIO VBAT #c00000 SoC
+ VDD_VCORE3 0.470000 -27.500000 -0.164000 0.254000 -0.000000 0.003377 0 SoCVCORE3/CORE VBAT #a00000 SoC
#/dev/serial/by-id/usb-NXP_SEMICOND_ARM_Energy_Probe_S_NO00010002-if00
# VDD_1V8 0.470000 -8.000000 -0.004642 0.006818 -0.000242 0.000600 0 SoCVIO\\_1V8 VBAT #a0c0e0 SoC
diff --git a/libarmep/aepd-interface.h b/libarmep/aepd-interface.h
index cf1f34c..3c0d1f0 100644
--- a/libarmep/aepd-interface.h
+++ b/libarmep/aepd-interface.h
@@ -67,6 +67,8 @@ struct aepd_interface {
int chans; /* number of active acquisition channels above */
int vchans; /* virtual channels (summing supplies) appear after probed physical channels in the arrays */
int finished; /* are we going down? */
+
+ int auto_zero;
};
/*
diff --git a/libarmep/libarmep.h b/libarmep/libarmep.h
index 10ca101..c3d8084 100644
--- a/libarmep/libarmep.h
+++ b/libarmep/libarmep.h
@@ -54,7 +54,7 @@
#define ADC_COUNT_CURRENT_CLIP_LIMIT 1640
#define REJECT_AUTOZERO_VOLTAGE 1.0
-#define IGNORE_AUTOZERO_VOLTAGE 0.1
+#define IGNORE_AUTOZERO_VOLTAGE 0.2
#define AEP_INVALID_COVER 100
@@ -267,6 +267,7 @@ struct aep_context {
int exit_after_capture;
int poll_timeout_ms;
double do_average;
+ int done_az_channels;
/* shared memory output buffer + metadata */
diff --git a/libarmep/sample.c b/libarmep/sample.c
index f44e61b..d11550c 100644
--- a/libarmep/sample.c
+++ b/libarmep/sample.c
@@ -85,6 +85,21 @@ int process_sample(struct aep *aep, int ch_index)
vo1 = ch->voffset[1];
}
+ aepd_interface = aep->aep_context->aepd_interface;
+ if (aepd_interface && aepd_interface->auto_zero) {
+ fprintf(stderr, "setting inline autozero\n");
+ aepd_interface->auto_zero = 0;
+ aep->aep_context->auto_zero = 2;
+
+ aep->aep_context->no_correction = 1;
+ aep->aep_context->mv_min = 0;
+ aep->aep_context->mw_min = 0;
+ aep->aep_context->average_len = 5000;
+ aep->aep_context->ms_capture = aep->aep_context->average_len / 10;
+ aep->aep_context->decimate = aep->aep_context->average_len;
+ aep->aep_context->done_az_channels = 0;
+ }
+
if (ch->pretrig_ring) {
ch->pretrig_ring[ch->head].v = aep->voltage;
ch->pretrig_ring[ch->head].i = aep->current;
@@ -242,8 +257,6 @@ unripe:
ch->decimation_counter = 0;
if (aep->aep_context->auto_zero) {
- fprintf(stderr, "Autozero for %s done \n",
- ch->channel_name);
if (v1 > IGNORE_AUTOZERO_VOLTAGE || v1 < -IGNORE_AUTOZERO_VOLTAGE)
fprintf(stderr, " Voltage Autozero skipped as %fV "
"unfeasibly high\n", v1);
@@ -254,10 +267,28 @@ unripe:
ch->voffset[1] = -avg_mean_us(&ch->avg_mean_current) /
ADC_COUNTS_PER_VOLT_CH2;
ch->vnoise[1] = ch->max[1] - ch->min[1];
+ ch->samples = 0;
+
+ fprintf(stderr, "Autozero for %s done (voltage %f) \n", ch->channel_name, ch->voffset[0]);
+
if (configure(aep->aep_context, aep, aep->dev_filepath, aep->aep_context->config_filepath, ch) < 0)
fprintf(stderr,
"Failed to write autozero info to config\n");
- goto done;
+ aep->aep_context->done_az_channels++;
+ fprintf(stderr, "done %d autozero channels of %d\n", aep->aep_context->done_az_channels, aep->aep_context->count_channel_names);
+ if (aep->aep_context->done_az_channels == aep->aep_context->count_channel_names) {
+
+ if (aep->aep_context->auto_zero == 2) { /* as part of larger collection */
+ aep->aep_context->auto_zero = 0;
+ aep->aep_context->no_correction = 0;
+ aep->aep_context->mv_min = 0;
+ aep->aep_context->mw_min = 0;
+ aep->aep_context->average_len = 1;
+ aep->aep_context->ms_capture = 0;
+ aep->aep_context->decimate = 1;
+ } else
+ goto done;
+ }
}
/* not everyone else may be ready, save the data first in per-channel sync ring buffers */
@@ -339,7 +370,7 @@ unripe:
done:
- if (aep->aep_context->ms_capture && (ch->samples / 10 - aep->aep_context->ms_holdoff) > aep->aep_context->ms_capture) {
+ if (aep->aep_context->auto_zero != 2 && aep->aep_context->ms_capture && (ch->samples / 10 - aep->aep_context->ms_holdoff) > aep->aep_context->ms_capture) {
fprintf(stderr, "%s: %dms capture complete ",
ch->channel_name, aep->aep_context->ms_capture);
ch->ignore = 1;