Not In Sync issue

Hi Folks, new to the forum, new to the arduino, but I am familiar with coding, network administration, etc but I consider myself very much a noob with this.

I am having a problem with uploading the code to the Mega328P - I am under the impression the board is the same hardware effectively, but is considered a clone.

I have tried two different USB-TTL cables, two different Operating Systems (Linux Mint and Windows 10), three different USB ports, the com port is installed in the device manager on Windows, and appears as a valid device in linux. Also assuming this is a clone, I have tried the options of arduino uno, mini, micro, but no matter what, I keep getting a variation of the error

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xff

When I connect the device, I hook up the TTL cables and there is a solid red light centre board, and then at the reset button end of the device, there is a blinking LED circa every second.

Any advice?

I have tried browsing but I missed the search function on the forum, apologies if this has already been answered a thousand times.

Images enclosed of the board.

NB: I forgot to add as well, when I get the software to get the board information, I see the board detected information is as follows:

BN: Unknown board
VID: 067B
PID: 2303
SN: Upload any sketch to obtain it

NBB: Windows 10 believes the drivers for my USB > TTL cable and its “virtual com port” are the most suitable - “Prolific version 3.8.31.0 30/07/2019”

…there is a blinking LED circa every second.

This is probably default program loadedin MCU, the “Blink” sketch. It points at least to two facts: the board is powered correctly, MCU works as it is expected.

First, you could check your USB/TTL transmitter by loop-back test. Connect Rx and Tx on TTL side and with any terminal you should receive anything you type on the keyboard.

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xff This usually points to some shortage on data wire.

Hi Budvar,

Thanks for your reply. I have done a short between TX/RX and can confirm data input is returned, I am confident the cable is working correctly, I know VCC and GRND work also due to the powering.

As for the message, 0xFF, 0x00, 0x07 and 0x17 are various messages received.

Currently (today at least) I am getting only 0x00

So, the postman just delivered an Duo which I have hooked up, tried to upload the file and after quite some time saying "uploading", it seems to suggest the upload has completed, however after a restart, the blink code appears to still be running on the Duo, so I am not sure the upload really was successful.

Not sure if there is a way I can test it, but for now I am stumped.

the code I am uploading is below, at the moment its mostly a simple counter, and at the moment extends on the blink program which should extend the time to 10 on 10 off.

I dont see any reason the why its not uploading, despite stating its uploaded successfully?

void setup() {
  // put your setup code here, to run once:

 pinMode(LED_BUILTIN, OUTPUT);
}


int x = 0;
bool up = true;

void loop() {
  // put your main code here, to run repeatedly:
  
if (up == true) {
  x = x +1;
}

if (up == false) {
  x = x -1;
}

if (x = 255) {
    up = false;
}

if (x = 0) {
    up = true;
}

analogWrite(13,x);

  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(10000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(10000);                       // wait for a second
  
analogWrite(9,255);
}

You want these if()s to be == not =

if (x = 255) {
    up = false;
}

if (x = 0) {
    up = true;
}

If I were you I'd put a serial print in setup() to say it's "starting", and one in loop() to say "looping" each time through.

@ard2dee2

Moved your topic to it's current location / section as it is more suitable.

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

twinkleyan:
You want these if()s to be == not =

if (x = 255) {

up = false;
}

if (x = 0) {
    up = true;
}





If I were you I'd put a serial print in setup() to say it's "starting", and one in loop() to say "looping" each time through.

Thanks for the reply. It seems to be passing the verification stage, so perhaps this is causing the issue. I will make the adjustment and give it another crack!

The == vs = thing is not a syntax error, so it verifies: just doesn’t do what you expect.

And a serial print in setup() at least will show you if your new sketch is running.

If you put this in setup() you’ll actually print out the compile time too, so you can check the one running is the one you (think you) just uploaded:

Serial.begin(9600);
Serial.print("Created: ");
Serial.print(__TIME__);
Serial.print(", ");
Serial.println(__DATE__);

OK so, I have amended the boolean “==” and ran it through, it seems OK but again appears to only be operating the blink program (this time on the full “UNO” (I will get round to the mega later).

I have added your code into the start, but, I only have the Uno, which is not connected to any screen, or any other cabling. In fact its simply connected to the laptop by its USB cable and that is it, so I am unable to tell anything further. but I am not seeing anything being output to the screen, unless I need to close the arduino program and open a serial link to the device? or can I run the code on the Arduino and watch the operations complete on the arduino program?

I attach the screenshot

ard2dee2:
I only have the Uno, which is not connected to any screen, or any other cabling. In fact its simply connected to the laptop by its USB cable and that is it,

You need to open the serial monitor from the IDE, either by control, shift, m or Tools > Serial monitor, or hit the magnifying glass icon (or whatever it is) top right of IDE.

You should get a window like this:

SerialMonitor.png

Check the baud rate in the window matches the Serial.begin value.

Thanks, I am just uploading the app again, and then will try again.

is there anything else I need to do to start he program, or is it just as soon as the arduino is started, the program commences?

Actually opening the serial monitor resets the Arduino, at which point the program starts again.

So, it seems it doesnt like linux. I took the same code, threw it into a file on the windows drive, booted into windows instead of linux, uploaded the app and it just works fine. So it might be a case of develop the code on Linux, then transfer over to Windows to upload it!

ard2dee2:
So it might be a case of develop the code on Linux, then transfer over to Windows to upload it!

It's many many years since I used Linux, and that was never in the Arduino world, but I don't believe that will be a requirement.

But on the bright side, it proves your Arduino's not stuffed.

Also previously you had said this:

ard2dee2:
I have tried two different ... Operating Systems (Linux Mint and Windows 10)

... so I wonder why it didn't work before in Windows?

I wont rule out a combination of "no-idea-what-I-was-doing-itis" combined with potentially the fact the UNO is working (I am just about to try an get the mega board running the same code).

Will let you know if it works.

well, I still cant get it to play ball.

thats the device I have and I am trying to get working! upload fails this time with "code resp=0x39"

judging by the look of this:

even my Uno is a clone, but it is at least working!

moved back over to Linux to try it again, now I keep getting a consistent failure, which is nice!

Arduino: 1.8.12 (Linux), Board: "Arduino Mini, ATmega328P"

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/home/james/Downloads/arduino-1.8.12/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/james/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude done.  Thank you.

Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.