Pages: [1]   Go Down
Author Topic: ATtiny85v and SoftwareSerial Connections  (Read 833 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an Arduino UNO, and have it connected to an ATtiny85v on a breadboard. I am using the UNO as the ISP. It is running TinyISP, and I have enabled SoftwareSerial. On the ATtiny85v, I am able to enable SoftwareSerial, and I can send data to a terminal window. That all works just fine.

But I now need to be able to send data to the ATtiny85v, but I am unsure how to set that up. I have Arduino pin 12 connected to the ATTiny pin 1 (PWM, MISO), and I use that as my TX pin in my sketches that I load up to the ATTiny85v. This has worked just fine so far for having the ATtiny85v send data to the serial monitor.

So what pin do I set for RX on my ATtiny sketches, and what pin on the Arduino UNO do I connect that to?

Thank you!
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5345
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There's only 4 possibilities...it would take about a minute to find out. smiley
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are 4 pins on the ATtiny that it could be, and 19 on the Arduino, which gives 76 possibilities.
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5345
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are 4 pins on the ATtiny that it could be, and 19 on the Arduino, which gives 76 possibilities.

(Assuming you have no manual, no google and don't know how to use your computer to find a file called "SoftwareSerial.h"...)

You could temporarily use HardwareSerial on the Uno to find out which pins work on the Tiny, then vice-versa to find out what pins SoftwareSerial is using on the Uno.

ie. use your imagination.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Obviously you do not actually know the answer, otherwise you would have simply given it rather than speaking in riddles. I have used Google, and found lots of nothing, and a few possibilities, all of which did not work for me. In one post, it was stated that the default wiring used to program the ATtiny85v with the Arduino UNO as the ISP is already set up for serial connections. I found that to be true for sending data from the ATTiny85v to the serial monitor, but receiving does not work.

Do I really need to type more to prove that I know what I am doing, but have a simple question that I have been unable to find an answer to through regular channels? I would greatly appreciate a simple and precise answer other than "RTFM and Google". Thank you.
Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1057
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The answer is in the original thread about TinyISP:

http://arduino.cc/forum/index.php/topic,123388.15.html

reply #27

• Digital pin 12 on the Uno is receive.  Connect transmit from the target to pin 12 on the Uno.  This pin is also used when programming the target (MISO).

• Digital pin 14 (A0) on the Uno is transmit.  It can be left unconnected or it can be connected to receive on the target.

And here, although not specifically clear

http://www.ernstc.dk/arduino/tinycom.html
« Last Edit: April 03, 2013, 02:07:25 pm by Erni » Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great. Thank you. So now what do I connect A0 to on the ATtiny85v? Should it be pin 0 (PWM, AREF, MOSI)? Or should it be one of the Analog In pins? I tired pin 0, and that seemed to work as a test, but when I run the TinyTuner sketch, it does not seem to be receiving anything under the same setup...
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 199
Posts: 12768
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Is the immediate goal to tune the processor using Tiny Tuner?
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5345
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tired pin 0, and that seemed to work as a test, but when I run the TinyTuner sketch, it does not seem to be receiving anything under the same setup...

So don't use TinyTuner...
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The goal is indeed to use TinyTuner to adjust the internal oscillator. This is the easiest way I have found. If it worked, of course. But I don't know that I have tried it with everything properly connected. Thus the purpose of this post. To double-check my current knowledge base. My main goal is to learn. I have no immediate NEED of any of this. Just hoping somebody can help me to learn some new things. Thank you!
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5345
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SoftwareSerial is highly dependent on the accuracy of the system clock.

It's not really surprising that changing the clock will affect SoftwareSerial.

Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1057
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am not sure if you can use the TinyTuner with the TinyISP ?

Anyway if you downloaded the TinyTuner from here:

http://arduino.cc/forum/index.php/topic,8553.0.html

There are four examle sketches in the package, and they include instructions how to use them.

You will need a Serial/USB converter. If you don't have one you can use your Arduino Uno:

Connect a jumperwire from reset to ground.

For safety you should first upload an empty sketch to the UNO, and connect a 220 ohms resistor between tx/RX on the tiny and Arduino.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 199
Posts: 12768
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The goal is indeed to use TinyTuner to adjust the internal oscillator.

The serial bit timing is used to tune.  For a real UART the method works well.  SoftwareSerial is not a real UART; the timing is not very precise.  SoftwareSerial will not work well for tuning. 

You can use the UART on your Arduino (the USB-to-serial converter) by connecting a jumper between RESET and GND (on your Arduino) and then connecting RX, TX, and GND from the programmer (your Arduino) to the target (the ATtiny).  As Erni mentioned, you need to include 220+ ohm series resistors on RX and TX to protect both sides.  I know up to 5.1K ohm resistors work well.  Higher values may also work.

Alternatively, I have a new version of Tiny Tuner that integrates with TinyISP.  If you are interested in using it let me know.
Logged

Pages: [1]   Go Up
Jump to: