Go Down

Topic: What is the status of serial on a tiny85 (Read 10725 times) previous topic - next topic

Erni

Success.
I tried with attiny85 at 8Mhz and it worked just fine.
I only tried with 4800, but will  test with higher baudrate.

my test sketch:

Code: [Select]


#include <SoftwareSerial.h>
const int rx=2;
const int tx=3;


SoftwareSerial mySerial(rx, tx);

int i=0;
char buf[10];

void setup()
{
  pinMode(rx,INPUT);
  pinMode(tx,OUTPUT);
   mySerial.begin(4800);
 
}

void loop()
{
  if (mySerial.available()>0){
   
    buf[i]= mySerial.read();
   
    if (int(buf[i])==13 || int(buf[i])==10 ){  //If Carriage return has been reached
 
        mySerial.println(buf);
       
      for(int x=0;x<=8;x++){
      buf[x]=' ';
      }
     i=0;  //start over again
   
    } //if enter
    i++;
    } //IF mySerial.available
   
}//LOOP

JohnO

Hi, I am keen to see this fix in the tiny84 currently I get the compile error:
~~~~
C:\Users\John\Documents\arduino\libraries\jeelib/Ports.h:325: error: conflicting return type specified for 'virtual void UartPlug::write(byte)'
C:\Dropbox\SKETCHES\hardware\tiny\cores\tiny/Print.h:73: error:   overriding 'virtual size_t Print::write(uint8_t)'
~~~~

Erni


In the first sketch I used the serial monitor as input.

Now I tried this sketch on my Uno, connected UNO tx->tiny rx
It works as it should, no garbled characters and at 9600 baud.

I use a CP2103 serial/USB converter from Ebay to test the output from the Tiny

Code: [Select]

int x=0;
char buffer[10];

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

}

void loop()
{
  sprintf(buffer, "Test:%03d",x);
Serial.println(buffer);
  x++;
  delay(500);
}//LOOP

Coding Badly

Hi, I am keen to see this fix in the tiny84 currently I get the compile error:


With the version in Reply #14?


JohnO

With the version in Reply #14?

Hi, I tried the above version before posting. It doesn't appear to clear the issue for me.

Coding Badly


Where did you get this file...
C:\Users\John\Documents\arduino\libraries\jeelib/Ports.h

JohnO

Hi,

This file is part of the jeelib library: https://github.com/jcw/jeelib/

Do you think the issue is in this library?

Coding Badly

Hi,

This file is part of the jeelib library: https://github.com/jcw/jeelib/
Do you think the issue is in this library?


You will have to use a previous version of the Tiny Core...
http://arduino-tiny.googlecode.com/files/arduino-tiny-0100-0013.zip

JohnO

No joy yet I'm afraid:

In file included from TinyRF12_Demo.cpp:7:
C:\Users\John\Documents\arduino\libraries\SoftwareSerial/SoftwareSerial.h:92: error: conflicting return type specified for 'virtual size_t SoftwareSerial::write(uint8_t)'
C:\Dropbox\SKETCHES\hardware\tiny\cores\tiny/Print.h:71: error:   overriding 'virtual void Print::write(uint8_t)'

I replaced my tiny & tools directory with the ones in arduino-tiny-0100-0013.zip

Thank you for spending time on this.

Coding Badly


Please post the sketch you are trying to compile.


Coding Badly


I hate to be a pain but in the long run it will be worth it...

• Remove the previous version of the Tiny Core (arduino-tiny-0100-0013.zip).

• Install the latest version of the Tiny Core...
http://arduino-tiny.googlecode.com/files/arduino-tiny-0100-0014.zip

• Navigate to the [font=Courier New]libraries/JeeLib[/font] directory

• Locate and open [font=Courier New]Ports.h[/font] in a text editor

• Towards the top of the file make this change...

Quote
[font=Courier New]// keep the ATtiny85 on the "old" conventions until arduino-tiny gets fixed
#if ARDUINO >= 100 // && !defined(__AVR_ATtiny84__) && !defined(__AVR_ATtiny85__) && !defined(__AVR_ATtiny44__) && !defined(__AVR_ATtiny45__)
#define WRITE_RESULT size_t
#else
#define WRITE_RESULT void
#endif[/font]


• Save and close [font=Courier New]Ports.h[/font]

• If the Arduino IDE was running, close it and restart it

• Try again to compile the sketch

JohnO

You are certainly not a pain! I have made the changes you recommended and you have indeed move the problem forward. I am now seeing:
C:\Users\John\Documents\arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':
C:\Users\John\Documents\arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:396: error: 'digitalPinToPCICR' was not declared in this scope
C:\Users\John\Documents\arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:398: error: 'digitalPinToPCICRbit' was not declared in this scope
C:\Users\John\Documents\arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:399: error: 'digitalPinToPCMSK' was not declared in this scope
C:\Users\John\Documents\arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:399: error: 'digitalPinToPCMSKbit' was not declared in this scope
C:\Users\John\Documents\arduino\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::end()':
C:\Users\John\Documents\arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:414: error: 'digitalPinToPCMSK' was not declared in this scope
C:\Users\John\Documents\arduino\libraries\SoftwareSerial\SoftwareSerial.cpp:415: error: 'digitalPinToPCMSKbit' was not declared in this scope

Coding Badly


Do you have an ATtiny25, ATtiny45, or ATtiny85 board selected?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy