Greetings!
I've been making a project for my masters thesis involving controlling a rather simple device of my own making with an ATTiny85, and I've been having problems with one part of the serial communication:
I successfully managed to send data from the ATTiny85 to my computer through an FTDI cable and even through an Arduino Uno and Leonardo serving as USB-serial converters. However I can't for the life of me get the ATTiny to read anything but garbage with the actual data scattered through that noise signal.
I checked to see if it was a problem with the FTDI cable by using the Uno and Leonardo to recieve information from my computer and echo it back, and they send it back fine.
The ATTiny also sends information of its own fine, the problem is really on what it's reading from the RX line.
I'm using SoftwareSerial and I've tried several BAUD rates so far: 2400 through to 19200. I'm also using the ArduinoISP using the Uno as an ATTiny programmer.
Looking around the web gave me no answers, most of the problems were related with the transmission from the ATTiny, not the ATTiny itself recieving.
Here's the ATTiny code (excuse the mess, I've been commenting lines in and out):
#include <SoftwareSerial.h>
#include <avr/io.h>
#include <avr/delay.h>
#define RX 3
#define TX 2
int a=0;
char error[]="ERROR";
SoftwareSerial mSerial(RX,TX);
void setup(){
pinMode(RX,INPUT);
pinMode(TX,OUTPUT);
mSerial.begin(9600);
}
void loop(){
if(mSerial.available()>0){
a=mSerial.read();
if(a<0){
mSerial.write(error);
}
else{
mSerial.write(a);
}
}
}
The circuit is just the normal Vcc + Gnd from the cable/Arduino powering the ATTiny, and the RX/TX lines of one connected to the TX/RX lines of the other.
Anyone has any ideas why I'm having so much noise in the RX input of the ATTiny?
I'll try to get this hooked up to an oscilloscope when I can get access to one here in the university and see what's going on with the signal waveform itself, it might help pinpoint the problem.
Thank you for your time!