     /* Concatenate 2 8-bit blocks into one 16-bit block */
     tempVariable = (uint16_t)(Data[i]);
     tempVariable = tempVariable | ((uint16_t)(Data[i + 1]) << 8);
+    /* Load 16-bit key block to AESADIn register */
+    AESADIN = tempVariable;
+  }
+
+  /* Initiate encryption by setting AESKEYWR to 1 */
+//  AESASTAT |= AESKEYWR;
+
+  /* Wait unit finished ~167 MCLK */
+  while( AESASTAT & AESBUSY );
+
+
+  for(i = 0; i < 16; i = i + 2){
+    /* Concatenate 2 8-bit blocks into one 16-bit block */
+    tempVariable = (uint16_t)(Data2[i]);
+    tempVariable = tempVariable | ((uint16_t)(Data2[i + 1]) << 8);
     /* Load 16-bit key block to AESADIn register */
     AESADIN = tempVariable;
   }

void loop()
{
  // put your main code here, to run repeatedly:
  P2OUT ^= BIT0;
  delay(1000);

}



  boolean all_good = true;
  for(i = 0; i < 16; i ++){
    if (DataAESdecrypted[i] != Data2[i]){
      all_good = false;

    }
