Arduino Due recognized but "Port not available"

Hey guys,

It seems that the Arduino Due is really sensitive. It seems to always get itself unrecognized by my computer. This is the first time that restarting my computer hasn't fixed this. Could anyone give me some advice?

When I try to plug it in, Windows says "USB device not recognized", so I try to reinstall the drivers but I see that they are already up to date and recognized by my operating system (windows 7 64-bit). When I go into the properties, I see that the device status is "Windows has stopped this device because it has reported problems. (Code 43)". In the arduino IDE, it sees the Arduino Due (Programming Port) on COM7, but when I go to select a port, the option is unselectable. I tried hitting the erase button on the Due, but that didn't help. I also unplugged it and plugged it back in, that didn't help.

The last thing I tried to do was implement some port manipulation using the analog inputs A0-A11. Specifically, I wanted to enable writing to bit20 of port B, and then write a 0 then 1 in it in the loop (with a 250 ms delay). Here's the code:

void setup() {

  
  //Set all PORTB bits to inputs by disabling write register
  PIOB->PIO_OWDR = 0xFFFFFFFF;
  //Set bit 20 of PORTB (Analog input A11 on Due) as output
  PIOB->PIO_OWER = 0x100000;
}

void loop() {

    //Set A11 (ADC clock) to 0V then 3.3V to trigger ADC
  PIOB->PIO_ODSR = 0x0;       // could also use "= 0<<20;"
  PIOB->PIO_ODSR = 0x100000;  // could also use "= 1<<20;"
  delay(250);
}

Did I mess my Due up with this code?

Hey,

So it's working again :fearful: I hit the erase button for a few seconds, then unplugged it for a few seconds, then the port became selectable again in the arduino ide. Can never really tell what's gonna throw this guy off...

but on the same token, can anyone tell me if the above code is valid for putting a signal on pin 65 aka Analog input 11? I'm trying to measure it with an oscilloscope but all I see is a 3.3V level

Hey again,

So I got it to make a 500Hz square wave (50% duty cycle)! Here's the code for anyone interested:

  //Set A11 (ADC clock) to 0V then 3.3V to trigger ADC
  PIOB->PIO_ODSR = 0x0;       
  delay(1);
  PIOB->PIO_ODSR = 0x100000;  
  delay(1);

put this in" loop()", and remember to include the code from my first post in "setup()"....hopefully this will help fellow Due noobs

oof... I should note that this code is only working when I use pinMode() to set the pin. The code I included in "setup()" in my first post isn't working