Pages: [1]   Go Down
Author Topic: [SOLVED] ATtiny85 SoftSerial known to work?  (Read 1855 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 3
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have searched a lot for a SoftSerial library that is known to work for the ATtiny85 or instructions on how to get the Arduino SoftSerial library to work for the ATtiny85 but have  not found a solution verified for the ATtiny85. I did find assembler code drivers in Atmel's AVR305, AVR304, AVR307 that look promising, although not exactly ATtiny85 specific, but I'd prefer C code. Does anyone here know of a  SoftSerial library that is known to work for the ATtiny85??
« Last Edit: April 30, 2012, 10:53:10 am by celem » Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1793
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just compiled this on Arduino 1.0 and burned it to an ATtiny85 using my UNO as an AVRISP (running Ladyada code) and it worked OK.  The SparkFun board is a bit flaky sometimes, but it is the only 4 line LCD I have on the bench.  I usually use the OLED displays from phanderson.com (RevEd.... the 18M2 serial to parallel is open source.)

Code:
#include <SoftwareSerial.h>

long count = 0;

// SparkFun 4 line by 20 characters
char cLCD = 254;
char LCD1 = 0;
char LCD2 = 64;
char LCD3 = 20;
char LCD4 = 84;

SoftwareSerial oSerial(2, 3); // RX, TX from PC perspective
// RX is actually the send (output) from the ATmel to display


void setup() 
{
   // set the data rate for the SoftwareSerial port
  oSerial.begin(9600);
  delay (500);
  // oSerial.println("Hello, world?");
}

void loop() // run over and over
{
  count++ ;
      oSerial.print(cLCD);
      oSerial.print(LCD1);
      oSerial.print("Now in loop count: ");
      oSerial.print(count);
 
   count++ ;
   delay(1000);
      oSerial.print(cLCD);
      oSerial.print(LCD2);
      oSerial.print("Now in loop count: ");
      oSerial.print(count);

  count++ ;
  delay(1000);
      oSerial.print(cLCD);
      oSerial.print(LCD3);
      oSerial.print("Now in loop count: ");
      oSerial.print(count);

  count++ ;
  delay(1000);
      oSerial.print(cLCD);
      oSerial.print(LCD4);
      oSerial.print("Now in loop count: ");
      oSerial.print(count);

  delay(1000);
}

Please note that I used the boards and variants definition from MIT:
http://hlt.media.mit.edu/?p=1695

- Ray
Logged

Offline Offline
Jr. Member
**
Karma: 3
Posts: 52
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the reply. I should have updated my original POST as I resolved the issue using the standard version 1.0 SoftwareSerial.h (formerly NewSoftSerial.cpp), the Multi-instance software serial librarywith Interrupt-driven receive and other improvements by ladyada (http://ladyada.net).

It works fine with both ATtiny85 and ATtint84 chips.

FYI - I did find that I needed diode isolation (I used 1N4148) on the Rx line of the ATtiny chips when using my CP2102 based serial cable (anode towards the ATtiny Rx pin). Without the diode isolation the serial line would be all noise if booted while connected.
Logged

Pages: [1]   Go Up
Jump to: