Genuino 101 Analog Input and USB Connection troble

Hi, I found some strange phenomenon on Genuino 101.

Because of Analog input performance evaluation, I wrote following sketch.

#define ADC_IN A0
#define BUFSIZE 512
unsigned short readValue[BUFSIZE];

void setup() {
Serial.begin(9600);
}

void loop() {
int lpCnt;
for(lpCnt = 0; lpCnt < BUFSIZE; lpCnt++)
{
readValue[lpCnt]=(unsigned short)analogRead(ADC_IN);
}

Serial.println("*****");
for(lpCnt = 0; lpCnt < BUFSIZE; lpCnt++)
{
Serial.print(readValue[lpCnt]);
Serial.print(",");
}
Serial.println("");
}

I connected signal generator’s output to A0 pin.

This sketch can run normally on Arduino UNO R3 and Gallileo Gen2.
Read 512 times from Analog Input, and output results to console via USB.

But I tried on Genuino 101, I can’t use console. When I connected wire from signal generator to A0(or A1 or A2 or … or A6), USB port(COM4 in my environment) suddenly missed. And I disconnected wire, USB port(COM4) re-arrived. Do you have any Ideas?

I uses Arduino IDE 1.6.8 with curie core 1.0.5 on Windows 7 environment. Without using Analog input, Anything seems well.

Maybe you can try putting : while (!Serial); ?

Serial ports on the 101

The 101 has a number of facilities for communicating with a computer or other microcontrollers.
The USB connector exposes as a virtual serial port that can be controlled by writing and reading to the Serial object. Pins 0/1, instead, expose a Hardware serial port mapped to Serial1 object.
Opening and closing the USB Serial port at a baud rate other than 1200bps will not reset the 101. To use the serial monitor, and see what your sketch does from the beginning, you’ll need to add few lines of code inside the setup(). This will ensure the Curie module will wait for the serial port to open before executing the sketch:
while (!Serial) ;
Pressing the Reset button on the 101 causes the microcontroller to reset as well as resetting the USB communication.
This interruption means that if the serial monitor is open, it’s necessary to close and reopen it to restart the communication. The SoftwareSerial library allows serial communication on any of the 101’s digital pins up to 57600 bps.

Thanks FredBlais,

Unfortunately, Situation is much serious.

Because COM4 missed, Arduino IDE can not uploading my sketch to Genuino 101.

Without connecting wire to A0, Surely sketch can uploaded and probably sketch can run. But connecting wire to A0, COM4 missed, and serial monitor disconnected. I tried to wait 30 min(!) but COM4 not recovered. Yes, I also try while(!Serial); and 1200bps settings but no effects.