After trying a lot of tutorials and manuals around the web including at least 20 solutions here on StackExchange, I don't know what to try anymore.
My goal is to write a message in the serial monitor window of the Arduino IDE from my ATMEGA328P-PU.
I have written the Arduino bootloader (tried 8 and 16MHz) to the ATMEGA and I use a 'blink' sketch as follows:
void setup() {
Serial.begin(9600);
delay(100);
pinMode(9, OUTPUT);
}
void loop()
{
digitalWrite(9, HIGH);
Serial.print("high");
delay(1000);
digitalWrite(9, LOW);
Serial.print("low");
delay(1000);
}
The blinking works fine, the timing looks good, not overly fast or slow.
I connect PIN3 (PCINT17, PD1, TXD) directly to the RX on the Arduino (lower red wire) and the serial monitor responds by returning nonsense like ����������
.
I have checked the baud rate. I have also tested with all other baud rates in combination with and without 8Mhz and 16MHz.
I have tested the entire setup with another ATMEGA328P-PU and using an entirely other PC. Same results.
It is not possible to upload a sketch while leaving the TXD -> RX connected, so I disconnect this cable when I upload a sketch. I have also tested with only power and TXD -> RX connected.
I have also tried a few types of resistor between the TXD and RX, one of many tutorials recommended this.
This is what I am trying: http://www.instructables.com/id/Attiny-serial-monitor-using-arduino-walkthrough/
And this is my boards.txt:
##############################################################
atmega328bb.name=ATmega328 (8 MHz internal clock)
atmega328bb.upload.protocol=arduino
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600
atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xDA
atmega328bb.bootloader.extended_fuses=0x05
atmega328bb.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F
atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=16000000L
atmega328bb.build.core=arduino:arduino
atmega328bb.build.variant=arduino:standard
atmega328bb.bootloader.tool=arduino:avrdude
atmega328bb.upload.tool=arduino:avrdude