     result = 0;
     for(uint8_t i=0; i<32; i++)
     {
-      result <<= 1;
+      result >>= 1;
       if (SWDReadBit())
-        result |= 1;
+        result |= 0x80000000;
     }
 
     bool parity = SWDReadBit();
 
-    SWDIdle();
+    // turn-around    
+    SWDReadBit();
     
     //TODO: get SWD code
     //      and check parity.. 

  {
    SWDWriteBit(true);
  }
  
  SWDWord(0x6DB7);
    
  for(uint32_t i=0; i<64; i++)
  {
    SWDWriteBit(true);
  }
  
  SWDIdle();
  

    SWDWriteBit(false);
  }
}



uint32_t SWDTransaction(bool APnDP, bool RnW, uint8_t A23, uint32_t data)
{
