Upload fails, serial output has begun before sync

Hi,

I'm using an Arduino Pro Mini 328 16MHz / 5V together with a generic PL230X USB ttl serial converter.

Until today I haven't experienced any issue with this combination. Now whenever I try to upload, I get this error:

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xa6
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x79
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x73
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x74
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x65
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x6d
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x53
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x74

While my code starts with:

void setup() {
  Serial.begin(19200);
  pinMode(SERIAL_WREN_PIN, OUTPUT);
  digitalWrite(SERIAL_WREN_PIN, LOW);
  
  Serial.println("System Started");

So it seems on this unit, the code starts before avrdude can synchronise with the bootloader. (The responses are ASCII for the println command :wink:

I've tried different programmers, units, code, with or without external power supplies and about thirty times with manual resetting the unit. Also when trying to use avrdude directly, I can only get to this error. I have multiple units running this code and I've never had to place a time delay in front of my setup code.

Is there anyone who might have a suggestion how to overcome this issue and/or why this happens in the first place?

Thanks,
Teun

tkteun@tk-2540p:~$ avrdude -v -v -v -v -pm328p -b19200 -cSTK500v1 -P/dev/ttyUSB0 -e

avrdude: Version 6.0.1, compiled on Sep 20 2013 at 18:33:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/tkteun/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : STK500v1
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: . [a6] 
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xa6
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: y [79] 
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x79
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: s [73] 
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x73
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: t [74] 
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x74
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: e [65] 
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x65
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: m [6d] 
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x6d
avrdude: Send: 0 [30]   [20] 
avrdude: Recv:   [20] 
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x20
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: S [53] 
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x53
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: t [74] 
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x74
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: a [61] 
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x61

avrdude done.  Thank you.

I probably have no idea what it actually is, but have you tried holding reset to upload?

Yes, that's what I meant by manually resetting: Instead of using the DTR lead, I hold the reset button until Arduino is finally finished compiling and starting the upload.

(why must it always fully compile the project?)

What pin is SERIAL_WREN_PIN?

Ahh, yes, I meant to take that out for clarity.
It's a pin which normally is connected to the /RE and DE pins of a MAX485 tranceiver.

I normally leave it connected to the RX and TX pins while programming, but I've disconnected it while troubleshooting this module.