Arduino on Breadboard: Serial comm. doesn't work in combination with delay

Hi,

General Setup:
I have followed several guidelines and tutorials (mainly Arduino ISP (In System Programming) and stand-alone circuits - Open Electronics - Open Electronics and https://www.arduino.cc/en/Main/Standalone) to build an Arduino on Breadboard, that I'm exclusively programming via ISP. Thus, I have no use for an Arduino bootloader and don't use it (although the problem also occurs if I flash the UNO or Duemilanove bootloader first and then upload my sketch).

Here is drawing of my set-up: Fritzing Breadboard (also attached to this post).

Minimal code example to illustrate my problem:

void setup() {
  Serial.begin(9600);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("Some text.");
  delay(1000);
}

There's nothing else in the sketch. The code runs perfectly on an Arduino UNO, however, with the breadboard version, there is one problem.

Problem:
Using an oscilloscope on the breadboard pin 3 (TX), I see a high level all the time. Deleting the delay(1000) line, I get the correct signal on the TX pin (using the UNOs TTL2RS232 converter it's even showing the correct output in the IDE's serial monitor). A delay of 1 or 2 ms won't do much noticeable harm either, but already with 20 ms, I get a sporadic high for some time, and with 100 ms, there's almost exclusively high. With 1000 ms (as in the code) I can hardly get anything other than high.

Tried solutions:
If I add a blinking LED (breadboard ATMEGA pin 19), the LED is blinking as it is supposed to (indicating other pins and the clock are working fine and there are no hidden resets). Using a pull-up resistor (whether internal or 10k external) on the RX line doesn't make it work, either. Replacing the uC doesn't make any difference, either.

More information:
This is the relevant section of my boards.txt (both the original section with bootloader and also the one I added, mostly to set the fuses differently - as mentioned above, both don't work, though).

uno.name=Arduino/Genuino Uno

uno.vid.0=0x2341
uno.pid.0=0x0043
uno.vid.1=0x2341
uno.pid.1=0x0001
uno.vid.2=0x2A03
uno.pid.2=0x0043
uno.vid.3=0x2341
uno.pid.3=0x0243

uno.upload.tool=avrdude
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.maximum_data_size=2048
uno.upload.speed=115200

uno.bootloader.tool=avrdude
uno.bootloader.low_fuses=0xFF
uno.bootloader.high_fuses=0xDE
uno.bootloader.extended_fuses=0xFD
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.bootloader.file=optiboot/optiboot_atmega328.hex

uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.board=AVR_UNO
uno.build.core=arduino
uno.build.variant=standard

##############################################################

atmegasa16.name=ATmega328P Stand Alone (Arduino as ISP)

atmegasa16.upload.protocol=stk500
atmegasa16.upload.maximum_size=32768
atmegasa16.upload.speed=115200
atmegasa16.upload.tool=avrdude

atmegasa16.bootloader.tool=avrdude
atmegasa16.bootloader.low_fuses=0x9e
atmegasa16.bootloader.high_fuses=0xd7
atmegasa16.bootloader.extended_fuses=0xFD
atmegasa16.bootloader.file=optiboot/optiboot_atmega328.hex
atmegasa16.bootloader.unlock_bits=0x3F
atmegasa16.bootloader.lock_bits=0x0F

atmegasa16.build.board=AVR_UNO
atmegasa16.build.mcu=atmega328p
atmegasa16.build.f_cpu=16000000L
atmegasa16.build.core=arduino
atmegasa16.build.variant=standard

Conclusion:
This problem seems very strange to me. I've double checked the wiring to be exactly as in the attached image (in fact, I've drawn it according to what my breadboard looks like now), and it seems alright. I can't imagine any other problem than an external connections issue, although I have even no idea how a bad wiring could influence the combination of delay and serial communication in any way.

Do you have any idea at all? I take all suggestions happily. :wink:

Best regards,
Henrik

I get the correct signal on the TX pin (using the UNOs TTL2RS232 converter it's even showing the correct output in the IDE's serial monitor).

This makes no sense. Either you still have a chip in the Uno board (which you cannot have when using it as a serial converter only) or you haven't shown a correct schematic when testing as there is no physical connection shown between the at328 on the breadboard and the USB connection.

Thank you for your reply!

avr_fred:
This makes no sense. Either you still have a chip in the Uno board (which you cannot have when using it as a serial converter only) or you haven't shown a correct schematic when testing as there is no physical connection shown between the at328 on the breadboard and the USB connection.

Let me clarify: My set-up is as shown in the drawing (no connections between the RX/TX lines of UNO and at328 on BB). The problem identifies only using the oscilloscope in that case (since I don't have a separate TTL2USB conveter just yet).

What I mean by "using the UNO's TTL2RS232 converter" is that it's an additional way I can identify the same problem. In that case, I would always either put a wire between the UNO's RESET and GND or take out its own at328 as you suggested. Without delay, this works, and shows the output on serial monitor. With delay, it doesn't.

Let me know if there's more cases which I haven't clearly pointed out. :slight_smile: