Go Down

Topic: Attiny84 & Arduino Serial Monitor (Read 1 time) previous topic - next topic



I'm attempting to use the Arduino Serial Monitor for debugging an Attiny84.  I am receiving ?????????blank spaces and "ΓΏ" characters.  The sketch is set up to turn an LED on/off, and I can see the LED turning on/off, and I see the serial converter LED flash at that time as well.  I'm using the following:

- Attiny84
- Tiny AVR programmer (https://www.sparkfun.com/products/11801)
- USB to Serial TTL UART Module (http://www.amazon.com/gp/product/B00FEAMUOK/ref=oh_details_o00_s00_i00?ie=UTF8&psc=1)
- These board definitions (https://github.com/damellis/attiny) for attiny84.

I've got the serial debugger set to 9600 baud and "Newline".  attiny84 is running at 8mhz.

Code: [Select]

#include <SoftwareSerial.h>

int blinkPin = 6;
int tx = 9;
int rx = 8;

SoftwareSerial serial(rx, tx);

void setup()
  pinMode(rx, INPUT);
  pinMode(tx, OUTPUT);
  pinMode(blinkPin, OUTPUT);

void loop()
  digitalWrite(blinkPin, HIGH);
  digitalWrite(blinkPin, LOW);

Attiny PB1 -> usb converter RCV
Attiny PB2 -> usb converter TXD

I have also attempted to use this "core" (http://code.google.com/p/arduino-tiny/).  SoftwareSerial produced the same result, and TinyDebugSerial produced empty spaces only.

I'm really stuck here, i'd appreciate any advice.  Thanks!


The frequency of the internal RC oscillator is only guaranteed to be calibrated from the factory within 10%, which is not generally close enough for reliable asynchronous serial communication. I haven't tried serial comm with an ATtiny84 myself, but I've found that many or even most of the ATmega328Ps I've tried are close enough. So it may just be bad luck but there are two options. (1) Change the clock source to an external crystal or resonator, or(2) Calibrate the internal RC oscillator (the datasheet says it can be calibrated within 1%).


I've found using software serial with an Attiny84's internal oscillator works just fine, especially at lower baud rates (e.g. 9600).  I use the arduino-tiny cores on code.google

The symptoms you're having suggest a baud rate mismatch.  Since it seems that you have it set to 9600 baud on both sides, my first guess is that the chip is actually running at 1 MHZ.  Did you "Burn bootloader", i.e. flash the fuses to set the chip to run at 8 MHZ?

If my guess is wrong, then... well very curious.  I'd maybe want to rule out the serial adapter as the problem.  Do you have an Arduino etc with a hardware UART you could use to test the setup?


Oh! Actually, I just noticed- get rid of the pinmode statements for rx and tx

Go Up