USBasp to Arduino Pro Mini error

First time trying to program a microcontroller, got this error when uploading a sketch:

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
the selected serial port
does not exist or your board is not connected

That is the end of the error message. I believe the warning about sck period is irrelevant, based off what I've read on other people's forum post. I could be wrong, however, as I used Zadig from USBasp - USB programmer for Atmel AVR controllers - fischl.de to install the driver, and I don't know much about Zadig. I have double checked that my MISO/MOSI connections are proper, and the LEDs on the Pro Mini are active when connected to the USBasp's jumper cable. What is rc? Why might the sck period be in error, if the sck output on my USBasp is connected to pin 13 on my Pro Mini? Why might the target not answer, even though the LEDs prove it is receiving current?

vince1899:
I believe the warning about sck period is irrelevant, based off what I've read on other people's forum post.

Correct.

vince1899:
I used Zadig from USBasp - USB programmer for Atmel AVR controllers - fischl.de to install the driver

Which driver did you install?

vince1899:
I have double checked that my MISO/MOSI connections are proper

You won't get this specific error from bad connections.

vince1899:
What is rc?

Maybe it's "return code"?

pert:
Correct.
Which driver did you install?
You won't get this specific error from bad connections.
Maybe it's "return code"?

Hi pert, thanks for addressing all that. I installed the driver WinUSB (v6.1.7600.16385)

Try installing the libusbK driver with Zadig instead of WinUSB. That solves this error for me and everyone else I've help with it.

pert:
Try installing the libusbK driver with Zadig instead of WinUSB. That solves this error for me and everyone else I've help with it.

Unfortunately, I'm exceptional. Got the same error, and haven't gotten my LCD to show the pixels I want.

Oops, I was looking at the wrong error message in my troubleshooting guide "target doesn't answer. 0" is the indicator for the driver issue. "target doesn't answer: 1" indicates a different problem.

Here is my answer for this error message:

Make sure the programmer’s cable is correctly connected to the target board. Pin 1 on the cable is indicated by a small triangle embossed on the plastic. Pin 1 on the Arduino board’s ICSP header is indicated by a white dot on the PCB’s silkscreen.

If your USBasp programmer has the official firmware, you must short the JP3 jumper to program chips that are running at <=1 MHz clock speed. The factory default clock configuration is running on the internal oscillator at 1 MHz. Many of the common Chinese USBasp clones come with a modified firmware that is able to work with chips running at the slower clock speeds without needing to set the jumper. There is also an alternate open source firmware provided by the community that has this functionality.

Unfortunately, you already said you have the connections right and if you're using an unmodified Pro Mini then the clock should either be running at 8 MHz or 16 MHz, which wouldn't require the slow clock jumper.

What is your reason for programming this Pro Mini with the USBasp?

pert:
Oops, I was looking at the wrong error message in my troubleshooting guide "target doesn't answer. 0" is the indicator for the driver issue. "target doesn't answer: 1" indicates a different problem.

Here is my answer for this error message:

Unfortunately, you already said you have the connections right and if you're using an unmodified Pro Mini then the clock should either be running at 8 MHz or 16 MHz, which wouldn't require the slow clock jumper.

What is your reason for programming this Pro Mini with the USBasp?

Thanks for getting back so fast, pert. I'm trying to build an FM radio, which will have an LCD display for tracking which channel the user is on, as well as volume. The Pro Mini will use the input from a rotary encoder, a PAM8403 amplifier, and a TEA5767 to those ends. I'll paste the sketch I'm using:

#include <SPI.h>
#include <Wire.h>
#include <LiquidCrystal.h>
#define clk 2
#define dt 3
#define sw 4
#define cs A0
LiquidCrystal lcd(5,6,7,8,9,10);
double frequency;
unsigned char frequencyH = 0;
unsigned char frequencyL = 0;
unsigned int frequencyB;
int Vol;
boolean mode;

volatile boolean TurnDetected;
volatile boolean up;

byte customChar[8] = {  //creates the arrow 
  0b10000,
  0b11000,
  0b11100,
  0b11110,
  0b11110,
  0b11100,
  0b11000,
  0b10000
};

void isr0 ()  {
  TurnDetected = true;
  up = (digitalRead(clk) == digitalRead(dt));
}

void setFrequency()  {
  frequencyB = 4 * (frequency * 1000000 + 225000) / 32768;
  frequencyH = frequencyB >> 8;
  frequencyL = frequencyB & 0XFF;
  Wire.beginTransmission(0x60);
  Wire.write(frequencyH);
  Wire.write(frequencyL);
  Wire.write(0xB0);
  Wire.write(0x10);
  Wire.write((byte)0x00);
  Wire.endTransmission(); 
} 

void setVolume() {
 digitalWrite(cs, LOW);
 SPI.transfer(0);
 SPI.transfer(Vol);
 digitalWrite(cs, HIGH);
}

void displaydata(){
 lcd.setCursor(1,0);
 lcd.print("FM:");
 lcd.print(frequency);
 lcd.setCursor(1,1);
 lcd.print("Vol:");
 lcd.print(100-Vol*100/255);
 lcd.print("%");
} 

void arrow(){
 lcd.begin(16, 2);
 if (mode == 1){
   lcd.setCursor(0,0);
   lcd.write((uint8_t)0);}
 else{
   lcd.setCursor(0,1);
   lcd.write((uint8_t)0);} 
}

void setup() {
  SPI.begin();
  Wire.begin();
  lcd.begin(16, 2);
  pinMode(cs,OUTPUT);
  pinMode(clk,INPUT);
  pinMode(dt,INPUT);  
  pinMode(sw,INPUT);
  mode = 1; //frequency mode
  lcd.createChar(0, customChar); // arrow Char created
  frequency = 99.8; //starting Frequency
  Vol = 220; //starting Volume
  setFrequency();
  setVolume();
  arrow();
  displaydata();
  attachInterrupt (0,isr0,FALLING);
}

void loop() {
  if (!(digitalRead(sw))){
    mode=!mode;
    arrow();
    displaydata();
    delay(500);}
    
  if (TurnDetected && mode == 1){
    if(up){
      if (frequency >= 107.90){
        setFrequency();
        arrow();
        displaydata();}
      else{   
      frequency = frequency + 0.1;
      setFrequency();
      arrow();
      displaydata();}}
    else{
      if (frequency <= 87.6){
        setFrequency();
        arrow();
        displaydata();}
      else{
      frequency = frequency - 0.1;
      setFrequency();
      arrow();
      displaydata();}}
      TurnDetected = false;
    }

  if (TurnDetected && mode == 0){
    if(up){
      Vol = Vol - 10;
      if (Vol <= 0){
        Vol = 0;
        setVolume();
        arrow();
        displaydata();}
      else{
      setVolume();
      arrow();
      displaydata();}}
    else{
      Vol = Vol + 10;
      if (Vol >= 255){
        Vol = 255;
        setVolume();
        arrow();
        displaydata();}
      else{
      setVolume();
      arrow();
      displaydata();}}
      TurnDetected = false;
    }   
  }

As to why particularly I'm using a USBasp to program, I don't have my own serial-ttl converter, so I've borrowed this one from a friend. I should explicate, the connections are correct according to this website: https://www.instructables.com/id/Uploading-Sketch-to-Arduino-Pro-Mini-using-usbASP/#:~:text=%20Uploading%20Sketch%20to%20Arduino%20Pro%20Mini%20Using,we%20are%20ready%20to%20upload%20your...%20More%20

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

What operating system are you using?
What version of the IDE are you using?

Thanks.. Tom... :slight_smile:

TomGeorge:
Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

What operating system are you using?
What version of the IDE are you using?

Thanks.. Tom... :slight_smile:

Hey Tom, thanks for the formatting tip. Should be easier to read now. I'll also update my post on Monday with some more details as recommended in that link. I'm using Windows 10, and the most recent version of the IDE.