               Serial.println(F("Evt Device Started: Standby"));
               //Looking for an iPhone by sending radio advertisements
               //When an iPhone connects to us we will get an ACI_EVT_CONNECTED event from the nRF8001
+              if (aci_evt->params.device_started.hw_error)
+              {
+                //do nothing, wait for the HW-error.
+              }
+              else
+              {
               lib_aci_connect(180/* in seconds */, 0x0050 /* advertising interval 50ms*/);
               Serial.println(F("Advertising started"));
+              }
+              
               break;
           }
         }

        As soon as you reset the nRF8001 you will get an ACI Device Started Event
        */
        case ACI_EVT_DEVICE_STARTED:
        {          
          aci_state.data_credit_total = aci_evt->params.device_started.credit_available;
          switch(aci_evt->params.device_started.device_mode)
          {

          aci_state.data_credit_available++;
        }
        break;
      
        //test code start
      case ACI_EVT_HW_ERROR:
        Serial.print(F("HW error: "));
        Serial.println(aci_evt->params.hw_error.line_num, DEC);
        
        for(uint8_t counter = 0; counter <= (aci_evt->len - 3); counter++)
        {
        Serial.write(aci_evt->params.hw_error.file_name[counter]); //uint8_t file_name[20];
        }
        Serial.println();
        lib_aci_connect(180/* in seconds */, 0x0050 /* advertising interval 50ms*/);
        Serial.println(F("Advertising started"));
        break;
        //test code end
           
    }
  }
