summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2013-04-08 14:28:00 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2013-04-08 14:28:00 -0400
commit9bf3eecdcb6273c92e27ad233b7497624c33b792 (patch)
tree9814697641f6c9af3fce9035f24ce60c46c0e677
parentdc99289acd9644a365bbe662deaac2fef1b3035f (diff)
add a dedicated pin to reset GPIB, becase SYS_RESETn is flaky
-rw-r--r--bus.c3
-rw-r--r--bus.h1
-rw-r--r--gpib.c7
3 files changed, 10 insertions, 1 deletions
diff --git a/bus.c b/bus.c
index e733cdf..1c77e70 100644
--- a/bus.c
+++ b/bus.c
@@ -356,7 +356,8 @@ static unsigned gpio_pins[] = { GPIO0_X + 22, // i.e., GPIO0_22
GPIO1_X + 15, // i.e., GPIO1_15
GPIO1_X + 14,
GPIO0_X + 27,
- GPIO1_X + 12
+ GPIO1_X + 12,
+ GPIO2_X + 1
};
diff --git a/bus.h b/bus.h
index 7f01cf3..f62e931 100644
--- a/bus.h
+++ b/bus.h
@@ -19,6 +19,7 @@
#define OUTPUT_RELAY 4 /* output enable/disable relay */
#define PW_ENABLE 5 /* TTL enable/disable output */
#define POWER_FAIL 6 /* pulled low if +24V OK, pulled high if power fails */
+#define RST_GPIB 7 /* don't use SYS_RESETn for this purpose - unpredictable */
// A5, A6 used to select chips
#define Octal_DACportCS_low 0x00
diff --git a/gpib.c b/gpib.c
index 46b1e14..88986b4 100644
--- a/gpib.c
+++ b/gpib.c
@@ -413,6 +413,13 @@ static void TNT_Gen_Error(int code)
/*----------------------------------------------------------------------------------------------------------*/
void GPIB_initialize(void)
{
+ // The RST_GPIB pin should already be low - defaults to low at
+ // power on.
+ bus_setpin(RST_GPIB, 0);
+ g_usleep(1);
+ bus_setpin(RST_GPIB, 1);
+ g_usleep(100);
+
INTERFACE_STATUS=0; /* Initialize Globals to zero */
INTERFACE_ERROR=0;
DATA_COUNT=0;