Please forgive my ignorance as I am just starting out having never used Arduino or programmed anything prior to 2013.
I am using a clone Pro Mini 5V, 16MHz W/ATmega 328. I am trying to upload code that has worked on the Uno and the Nano. This time I keep getting the following error message:
avrdude: stk500_getsync(): not in sync: resp=0x00
I have tested the Mini Pro by messing around with the basic pin 13 blink program which does upload and seems to work fine. What am I missing? What other information can I provide that may help?
Here is the code:
(All it does is randomly flash 5 LEDs in sequence with a re-purposed voltmeter gauge needle for a toy. I am working on some simple tone oscillation to work with it as well, but that is not included yet.)
/*
By Luke Thomas
*/
#define LED_PIN 13 //LED in on pin 13
#define DELAY_AMOUNT_MIN 20 //500m == 0.5s
#define DELAY_AMOUNT_MAX 100 //500m == 0.5s
#define BETWEEN_CYCLE_DELAY_MIN 200
#define BETWEEN_CYCLE_DELAY_MAX 800
#define LONG_DELAY_COUNT_MIN 5
#define LONG_DELAY_COUNT_MAX 10
#define NUM_LEDS 5
#define LED_1 6
#define LED_2 5
#define LED_3 4
#define LED_4 3
#define LED_5 2
#define VOLT_METER_PIN 9
#define VOLT_METER_MAX_VAL (255/45)
// Pin 13 has an LED connected on most Arduino boards. ZX
// give it a name:
int led_global = LED_PIN;
int leds[NUM_LEDS] = {LED_1, LED_2, LED_3, LED_4, LED_5};
int globalCycleCount = 0;
int globalLongDelayCount = 0;
int voltMeterLookup[] = {1, 2, 3, 4, 6};
// the setup routine runs once when you press reset:
void setup() {
//Local variables
int ct = 0;
// initialize the digital pin as an output.
pinMode(led_global, OUTPUT);
pinMode(VOLT_METER_PIN, OUTPUT);
for(ct = 0; ct < NUM_LEDS; ct++){
pinMode(leds[ct], OUTPUT);
}
//Intialize global variables
globalCycleCount = 0;
globalLongDelayCount = 0;
}
// the loop routine runs over and over again forever:
void loop() {
//Local variables
int ct = 0;
int randNumLedVal = rand() % NUM_LEDS + 1;
int tempDelayVal = rand() % (DELAY_AMOUNT_MAX - DELAY_AMOUNT_MIN) + DELAY_AMOUNT_MIN;
int topDelayVal = 3 * randNumLedVal * tempDelayVal;
int betweenCyleDelayVal = rand() % (BETWEEN_CYCLE_DELAY_MAX - BETWEEN_CYCLE_DELAY_MIN) + BETWEEN_CYCLE_DELAY_MIN;
int voltMeterIncrVal = (VOLT_METER_MAX_VAL / (NUM_LEDS));
/*
digitalWrite(led_global, HIGH); // turn the LED on (HIGH is the voltage level)
delay(DELAY_AMOUNT); // wait for DELAY_AMOUNT
digitalWrite(led_global, LOW); // turn the LED off by making the voltage LOW
delay(DELAY_AMOUNT); // wait for DELAY_AMOUNT
*/
digitalWrite(led_global, HIGH);
//Run the LEDs up - from the low to high LEDs, with a delay between each
for(ct = 0; ct < randNumLedVal; ct++){
analogWrite(VOLT_METER_PIN, voltMeterLookup[ct]);
digitalWrite(leds[ct], HIGH); // turn the LED on (HIGH is the voltage level)
delay(tempDelayVal); // wait for DELAY_AMOUNT
}
//DEBUG - toggle the onboard LED for debug purposes.
digitalWrite(led_global, LOW);
//Delay at the top of the LEDs for a bit
delay(topDelayVal);
//Run the LEDs back down - from the high to low LEDs, with a delay between each
for(ct = randNumLedVal-1; ct >= 0; ct--){
analogWrite(VOLT_METER_PIN, voltMeterLookup[ct]);
digitalWrite(leds[ct], LOW); // turn the LED off by making the voltage LOW
delay(tempDelayVal); // wait for DELAY_AMOUNT
}
//Reset the volt meter to no output...
analogWrite(VOLT_METER_PIN, 0);
//Increment the global cycle counter
globalCycleCount++;
//Check if a 'long' delay should be ran
if(globalCycleCount >= globalLongDelayCount){
//If there should be one here, reset the global cycle counter and determine a new cycle wait delay
globalCycleCount = 0;
globalLongDelayCount = rand()%(LONG_DELAY_COUNT_MAX - LONG_DELAY_COUNT_MIN) + LONG_DELAY_COUNT_MIN;
//Delay 5 times the previously determined random delay
//TODO - make this random?
delay(5*betweenCyleDelayVal);
//If it isn't a long delay, just delay the normal amount
} else {
//Wait for a bit between cycles
delay(betweenCyleDelayVal);
}
}
That error message is the most common error message you will get uploading. It means that the Arduino has not responded to the bootloader. This is probably because of your programming setup.
Odd you are having a program loading problem but you don't mention how you are doing it so we can only guess what you are doing wrong.
So in the absance of any real information provided by you read this page:-
especially the bit that says "Automatic (Software) Reset"
I am using a tinyosshp.com FTDI Basic Breakout and the Arduino 1.0.5 software. I selected the Arduino Pro or Pro Mini (5V, 16 MHz) w/ATmega328 on COM5, brought up my sketch, clicked the verify button, then clicked the upload button. I even tried a manual reset using the button on the board before uploading.
I am using a tinyosshp.com FTDI Basic Breakout and the Arduino 1.0.5 software.
Broken link!
Have you wired in the auto reset wire?
I even tried a manual reset using the button on the board before uploading.
You have to do it at exactly the right time. You hold down the reset button click the upload button. When you see it say "uploading" you count 1 and 2 and 3, then you release. It works about 5 times out of ten.
I changed the link, thanks; It should work now. I tried the 1, 2, 3, count thing with no luck. =( I'll keep reading and trying. I have a couple more Pro mini's still in their packaging. Think it'd be worth it to open 'em up and try them? I wonder if the problem is with the PC, the Pro Mini, the break out board, or the connection(s) between them.
Think it'd be worth it to open 'em up and try them?
No.
You still haven't said how you have wired up the auto reset circuit.
Please forgive my ignorance. I have the 5 pins soldered up between the breakout and the pro mini. GND, CTS, VCC, TXD, RXD, DTR. Is the auto reset circuit something separate?
The auto reset is the DTR connected to the reset pin.
That looks all wrong, the pins might fit but none of the signals match up with the signals on the Pro Mini.
You say you have a clone, is this pinned out differently from the real one?
The auto reset is the DTR connected to the reset pin.
That looks all wrong, the pins might fit but none of the signals match up with the signals on the Pro Mini.
You say you have a clone, is this pinned out differently from the real one?
Excellent observation! Here is how they are laid out when plugged into one another:
Break out to Pro Mini
GND = BLK
CTS = GND
VCC = VCC
TXD = RX
RXD = TX
DTR = GRN
Some things I learned when I was trying to do the same thing a while ago:
RTS on the serial side gets connected to the RST (Reset) on the Pro Mini. On my USB converter this is up the side of the small PCB.
In the Windows Device Manager for the COM port, go to the Advanced Setting tab and make sure that "Set RTS on Close" is checked.
For manual reset:
Start the download from the IDE
Hold down the reset on the Mini Pro
When the Tx/Rx light on the USB converter blinks the first time, let the reset go.
The manual reset method works almost 100% of the time if you do it this way. The IDE will retry 3 times to establish connection and then give you the message you see.
I have tested the Mini Pro by messing around with the basic pin 13 blink program which does upload and seems to work fine. What am I missing? What other information can I provide that may help?
Is that still the case? Could it be you just forgot to select the correct processor in the tools menu when you switched over from a UNO?
I have tested the Mini Pro by messing around with the basic pin 13 blink program which does upload and seems to work fine. What am I missing? What other information can I provide that may help?
Is that still the case? Could it be you just forgot to select the correct processor in the tools menu when you switched over from a UNO?
No I made a mistake and did not change the variables enough. The light flashed on the MiniPro like it was trying to accept a new upload and went back to flashing. I fooled myself into thinking it was fast slow fast slow. As far as I know I have the right tool selections. Mini Pro 5V, mega 328P.
Here is the board configuration I have on my mini. I am not sure at all now what should be connected to what. I am looking for any spec sheets I can for it but so far have not found any specific to this clone board.
marco_c:
Some things I learned when I was trying to do the same thing a while ago:
RTS on the serial side gets connected to the RST (Reset) on the Pro Mini. On my USB converter this is up the side of the small PCB.
In the Windows Device Manager for the COM port, go to the Advanced Setting tab and make sure that "Set RTS on Close" is checked.
For manual reset:
Start the download from the IDE
Hold down the reset on the Mini Pro
When the Tx/Rx light on the USB converter blinks the first time, let the reset go.
The manual reset method works almost 100% of the time if you do it this way. The IDE will retry 3 times to establish connection and then give you the message you see.
I don't see a RTS on my FTDI Breakout board.
I tried the manual reset using the FTDI breakout board connected to the Mini Pro as-as (see below) with no success. I the programmer is set on AVRISPmkII. Is my my FTDI to Min Pro connection incorrect? Should the RXD be connected to RX and TXD to TX?
In my setup Rx to Rx and Tx to Tx. The pins are basically connected straight through from one board to the other (5V and GND included), but that clearly depends on the USB converter design.