diff --git a/cc3200/mods/pybpin.c b/cc3200/mods/pybpin.c
index c1c0350548374b7e01031f5d4779b169b3fb7864..4a2c313edbb099dae359d69af291ee8be98c4d28 100644
--- a/cc3200/mods/pybpin.c
+++ b/cc3200/mods/pybpin.c
@@ -290,16 +290,14 @@ STATIC void pin_obj_configure (const pin_obj_t *self) {
             default:
                 break;
             }
-
+            // configure the direction
+            MAP_GPIODirModeSet(self->port, self->bit, direction);
             // set the pin value
             if (self->value) {
                 MAP_GPIOPinWrite(self->port, self->bit, self->bit);
             } else {
                 MAP_GPIOPinWrite(self->port, self->bit, 0);
             }
-
-            // configure the direction
-            MAP_GPIODirModeSet(self->port, self->bit, direction);
         }
         // now set the alternate function
         MAP_PinModeSet (self->pin_num, self->af);
diff --git a/tests/wipy/pin.py b/tests/wipy/pin.py
index 9f2eadb963db34522cdbf9be23958184b56c0425..22c7c6176c13a1a01dd13f6781390f0a9437425b 100644
--- a/tests/wipy/pin.py
+++ b/tests/wipy/pin.py
@@ -1,5 +1,7 @@
-""" This test need a set of pins which can be set as inputs and have no external 
-    pull up or pull down connected.
+""" 
+This test need a set of pins which can be set as inputs and have no external 
+pull up or pull down connected.
+GP12 and GP17 must be connected together 
 """
 from machine import Pin
 import os
@@ -14,6 +16,13 @@ elif 'WiPy' in mch:
 else:
     raise Exception('Board not supported!')
 
+# test initial value
+p = Pin('GP12', Pin.IN)
+Pin('GP17', Pin.OUT, value=1)
+print(p() == 1)
+Pin('GP17', Pin.OUT, value=0)
+print(p() == 0)
+
 def test_noinit():
     for p in pin_map:
         pin = Pin(p)
diff --git a/tests/wipy/pin.py.exp b/tests/wipy/pin.py.exp
index 7ca85ebdfcd597ed5b30053efd0c001cafc024ab..0e3dddcf2b1e5d23164ecb0195d84577abf242b4 100644
--- a/tests/wipy/pin.py.exp
+++ b/tests/wipy/pin.py.exp
@@ -1,3 +1,5 @@
+True
+True
 1
 1
 1