ProTrinket Problems

USB AVR Programmer and SPI interface. Adafruit's USBtinyISP.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
chasirish
 
Posts: 18
Joined: Tue Sep 30, 2014 8:47 pm

ProTrinket Problems

Post by chasirish »

Hi, I recently purchased a couple of ProTrinkets for use in my audio visualizer project. I'm having trouble uploading my code to the trinket though. I'm able to successfully upload the blink sketch, but when I try my code I get a couple of errors:

avrdude: error: usbtiny_transmit: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


avrdude: error: usbtiny_transmit: usb_control_msg: sending control message failed, win error: A device attached to the system is not functioning.

Here is my code:

Code: Select all

int analogPin = 1; // MSGEQ7 OUT
int strobePin = 12; // MSGEQ7 STROBE
int resetPin = 11; // MSGEQ7 RESET
int spectrumValue[7];
 
// MSGEQ7 OUT pin produces values around 50-80
// when there is no input, so use this value to
// filter out a lot of the chaff.
int filterValue = 80;
 
// LED pins. I used 2 common cathode RGB LEDs.
// They're connected to the PWM pins on the Arduino
int ledPinR1 = 3;
int ledPinG1 = 4;
int ledPinB1 = 5;
 
void setup()
{
  // Read from MSGEQ7 OUT
  pinMode(analogPin, INPUT);
  // Write to MSGEQ7 STROBE and RESET
  pinMode(strobePin, OUTPUT);
  pinMode(resetPin, OUTPUT);
 
  // Set analogPin's reference voltage
  analogReference(DEFAULT); // 5V
 
  // Set startup values for pins
  digitalWrite(resetPin, LOW);
  digitalWrite(strobePin, HIGH);
}
 
void loop()
{
  // Set reset pin low to enable strobe
  digitalWrite(resetPin, HIGH);
  digitalWrite(resetPin, LOW);
 
  // Get all 7 spectrum values from the MSGEQ7
  for (int i = 0; i < 7; i++)
  {
    digitalWrite(strobePin, LOW);
    delayMicroseconds(30); // Allow output to settle
 
    spectrumValue[i] = analogRead(analogPin);
 
    // Constrain any value above 1023 or below filterValue
    spectrumValue[i] = constrain(spectrumValue[i], filterValue, 1023);
 
    // Remap the value to a number between 0 and 255
    spectrumValue[i] = map(spectrumValue[i], filterValue, 1023, 0, 255);
 
    // Remove serial stuff after debugging
//    Serial.print(spectrumValue[i]);
//    Serial.print(" ");
 
    digitalWrite(strobePin, HIGH);
   }
 
//   Serial.println();
 
   // Write the PWM values to the LEDs
   analogWrite(ledPinR1, spectrumValue[0]); // 63Hz
   analogWrite(ledPinR1, spectrumValue[1]); // 160Hz
   analogWrite(ledPinB1, spectrumValue[3]); // 1000Hz
   analogWrite(ledPinB1, spectrumValue[4]); // 2500Hz
   analogWrite(ledPinG1, spectrumValue[5]); // 6250Hz
   analogWrite(ledPinG1, spectrumValue[6]); // 16KHz
}
I've commented the serial lines out since the protrinket can't use it.

Please help if you can! Thank you!
Last edited by adafruit_support_rick on Wed Oct 01, 2014 9:54 am, edited 1 time in total.
Reason: please use Code tags when posting code (</> button)

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ProTrinket Problems

Post by adafruit_support_rick »

That error indicates a bad connection between the computer and the Pro Trinket. Please try a different cable and a different USB port. also try connecting through a self-powered hub if possible.

User avatar
chasirish
 
Posts: 18
Joined: Tue Sep 30, 2014 8:47 pm

Re: ProTrinket Problems

Post by chasirish »

adafruit_support_rick wrote:That error indicates a bad connection between the computer and the Pro Trinket. Please try a different cable and a different USB port. also try connecting through a self-powered hub if possible.
I tried switching the cord and also tried a different port. I still end up with the same errors. How come the blink code will work, but mine doesn't if that is the case.

Thanks for your help!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ProTrinket Problems

Post by adafruit_support_rick »

There's nothing about your code that will prevent an upload. Are you sure the blink example is uploading? Try changing the blink rate to verify that you're not just seeing a pre-loaded blink program.

User avatar
chasirish
 
Posts: 18
Joined: Tue Sep 30, 2014 8:47 pm

Re: ProTrinket Problems

Post by chasirish »

adafruit_support_rick wrote:There's nothing about your code that will prevent an upload. Are you sure the blink example is uploading? Try changing the blink rate to verify that you're not just seeing a pre-loaded blink program.
You were right, it just showed the same error for that sketch as well

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ProTrinket Problems

Post by adafruit_support_rick »

What do you have your Programmer set for in the Tools menu? It should be set to USBtinyISP

User avatar
chasirish
 
Posts: 18
Joined: Tue Sep 30, 2014 8:47 pm

Re: ProTrinket Problems

Post by chasirish »

adafruit_support_rick wrote:What do you have your Programmer set for in the Tools menu? It should be set to USBtinyISP
It's set to USBtinyISP

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ProTrinket Problems

Post by adafruit_support_rick »

Hmmm... Let's try replacing it
Please email [email protected] with a link to this thread for a replacement Pro Trinket

User avatar
chasirish
 
Posts: 18
Joined: Tue Sep 30, 2014 8:47 pm

Re: ProTrinket Problems

Post by chasirish »

adafruit_support_rick wrote:Hmmm... Let's try replacing it
Please email [email protected] with a link to this thread for a replacement Pro Trinket
Well I bought 3, and I just tested it on the other 2. Same problem. I'm going to try a different computer next

User avatar
chasirish
 
Posts: 18
Joined: Tue Sep 30, 2014 8:47 pm

Re: ProTrinket Problems

Post by chasirish »

I get the same problem on the other computer as well

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ProTrinket Problems

Post by adafruit_support_rick »

What do you see in Device Manager? How does the Pro Trinket appear?
When the bootloader is running (red LED is pulsing), it should appear under LibUSB-Win32 Devices as a "USBtinyISP AVR Programmer"

User avatar
chasirish
 
Posts: 18
Joined: Tue Sep 30, 2014 8:47 pm

Re: ProTrinket Problems

Post by chasirish »

adafruit_support_rick wrote:What do you see in Device Manager? How does the Pro Trinket appear?
It appears as usbtiny

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ProTrinket Problems

Post by adafruit_support_rick »

I'm stumped. You've got the driver installed, and the system is communicating with the Pro Trinket. So I don't understand why you're getting errors from avrdude.
I'll see if somebody else has an idea...

User avatar
chasirish
 
Posts: 18
Joined: Tue Sep 30, 2014 8:47 pm

Re: ProTrinket Problems

Post by chasirish »

adafruit_support_rick wrote:I'm stumped. You've got the driver installed, and the system is communicating with the Pro Trinket. So I don't understand why you're getting errors from avrdude.
I'll see if somebody else has an idea...
Thanks! I appreciate the help even if we can't find an answer

User avatar
Virgil_Machine
 
Posts: 121
Joined: Sun Apr 13, 2014 6:39 pm

Re: ProTrinket Problems

Post by Virgil_Machine »

I have the same problem, same message. 3V Pro Trinket delivered yesterday.

After fussing with the IDE mods, changing the board and programmer, and installing the driver, I got it to upload once: blink works.

After that I soldered the headers and came back to try again and get the message. Windows also barked at me a couple of times about unsupported device or device failing, but it's showing USBTiny in device manager as working now.

I uninstalled the driver and attempted to reinstall--it said there was an error in the driver. I deleted the driver, unzipped it again, and reinstalled. After a few tries it reinstalled ("device cannot start code(10"). I went to upload blink--same message. I pressed the reset button--it worked. Then I tried to upload one of my sketches, same message. Back to blink, same message.

I downloaded the driver again and tried to install that. Now I'm getting the "device cannot start" message consistently.

Next I rebooted (becuse it's Windows). Windows barked a few times and also refused to install the driver a few times as above, but it finally installled. However, I'm still getting the avrdude message.

Also, sometimes, but not every time, when I press the reset button to initialize the bootloader, the device is no longer recognized, and I have to disconnect and reconnect the USB cable a few times to get it back.

Meanwhile, my 3V Pro Trinket is happily running blink from the times I was able to upload.

Any ideas?.
Last edited by Virgil_Machine on Wed Oct 08, 2014 5:30 pm, edited 1 time in total.

Locked
Please be positive and constructive with your questions and comments.

Return to “USBtinyISP”