SoftwareSerial with ATTiny84 using ATtiny library

I tried the same thing with an ATTiny85 and for some reason it does only work when VCC is not connected. I haven't tried it with an 84 yet, but I guess it's not that much different. Hope that helps.

Hi,

daywalkerdha:
...low baud rates would be fine since the interface will only be used for debugging...

Then I suggest using TinyDebugSerial in the Tiny Core.

I tried the TinyDebugSerial, same problem.

MontySylver:
I tried the same thing with an ATTiny85 and for some reason it does only work when VCC is not connected. I haven't tried it with an 84 yet, but I guess it's not that much different. Hope that helps.

What do you mean by not connecting VCC? Two different power supplies for the two microcontrollers? Because at the moment the AtTiny receives power from the Arduino 5V rail.

Maybe you need the updated version mentioned in this thread:

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

I used an ATTiny85 to send serial data and an Arduino Uno to receive it. First I got some strange gibberish too until I pulled the ATTiny's VCC out by accident. Without VCC on the ATTiny it sent what I wanted, after reconnecting VCC it was gibberish again. There were no pins except Tx, Rx and GND connected.

EDIT: Don't do this, a 100nf capacitor between the signal line and GND should do the trick.

Erni:
Maybe you need the updated version mentioned in this thread:

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

I used the current version (15) which should work as well, shouldn't it? But I switched back to http://hlt.media.mit.edu/?p=1695 after it didn't work.

MontySylver:
I used an ATTiny85 to send serial data and an Arduino Uno to receive it. First I got some strange gibberish too until I pulled the ATTiny's VCC out by accident. Without VCC on the ATTiny it sent what I wanted, after reconnecting VCC it was gibberish again. There were no pins except Tx, Rx and GND connected.

Not sure how this is supposed to work without power but just to test everything I tried it as well and the AtTiny stopped transmitting after pulling out the VCC cable.

Just tried it with some more stuff connected, it seems that the whole disconnecting VCC thing only works when the ATTiny does only transmit serial data and nothing else is supposed to happen in the sketch. Reading serial data works as it should.

The Arduino must get it's power from somewhere else in your setup, otherwise it wouldn't work. Could you post a picture/schematic?

The data I'm receiving ist 0xFF every time if that helps someone to help me. I used a Processing sketch to display the actual binary data because the Arduino serial monitor only prints this character: ÿ

@Coding Badly
Now I'm using your library again.
It doesn't seem to matter if I just use the standard

Serial.begin(9600);
//and so on...

or if I use

#include <TinyDebugSerial.h>
TinyDebugSerial mySerial = TinyDebugSerial();
mySerial.begin(9600);
//and so on...

the output is always 0xFF with 2.5secs delay in between which I defined to check if it would be far off the expected value

With some baud rates, the Arduino serial interface on my Mac receives some gibberish data and with others nothing at all. The TX led on the Arduino blinks when data is being sent btw.

Are you using your Arduino as a serial converter?

daywalkerdha:
Not sure how this is supposed to work without power...

It won't.

...but just to test everything I tried it as well and the AtTiny stopped transmitting after pulling out the VCC cable.

Don't do that again. It violates the specifications (meaning it could damage the processor).

No, I'm just trying to use the Arduino board as a serial interface because I don't have a separate one. The 84's TX pin goes to the RX pin on the Arduino Uno R3 board which makes the TX led blink on the Arduino board. I also connected a 10µF cap between RESET and GND on the Arduino and leave the 4 pins used for programming the 84 connected during testing. The only thing I change during programming is disconnecting the 84's serial line temporarily.

That's what they taught me in EE :wink:

daywalkerdha:
No, I'm just trying to use the Arduino board as a serial interface because I don't have a separate one.

That is what I was trying to ask. Got it.

The 84's TX pin goes to the RX pin on the Arduino Uno R3 board which makes the TX led blink on the Arduino board.

I think that's correct.

I also connected a 10µF cap between RESET and GND on the Arduino

The Arduino processor has to be removed (not recommended) or forced into reset (recommended). Remove the 10µF capacitor. Connect a jumper between RESET and GND. (Actually, you can probably leave the capacitor in place.)

As you've discovered, the Arduino processor interferes with serial communications. In addition, unless the Arduino processor is essentially removed from the circuit, it is possible to damage one or both processors (some current limiting resistors will protect both sides).

If you are interested, I have a version of the ArduinoISP sketch that makes what you are trying to do much simpler.

I already ordered a zif-header to be able to remove the 328 easily and without damage.

What does your modified sketch do to make it simpler and would it allow me to program the external micro and still get serial data without changing the connections every time?

daywalkerdha:
What does your modified sketch do to make it simpler and would it allow me to program the external micro and still get serial data without changing the connections every time?

The sketch provides a "serial relay" which has two on-wire options... the standard TTL-serial and something I call Knock-Bang. The Knock-Bang protocol is designed specifically for debugging a tiny processor when using an Arduino as a programmer. It's more robust and faster than TTL-serial.

In either case, you don't need to fiddle with the wiring. MISO (one of the programming lines) is used for serial communications.

That sounds great, could you post the library here? I'll try the serial interface without the 328 once the zif socket arrives.

Ok, I couldn't wait for the zif socket;) Once I removed the Arduino and plugged the Serial cable into the TX(not RX as before) pin on the Arduino board, everything worked just fine! So it seems as if the Arduino blocks the communication if its inserted and your library should be able to solve my problem.

The latest version of the sketch (TinyISP) can be downloaded from here...
https://github.com/Coding-Badly/TinyISP/zipball/master

Or, the source can be browsed here...

As published, it is a drop-in replacement for the ArduinoISP sketch. Please download it and try it. At this point, the only noticeable difference should be shorter upload times. I will add more instructions later (probably tonight).

Thanks, but it won't compile

In file included from TinyISP.cpp:43:
TinyISP_SanityChecks.h:45:6: error: #error The Knock-Bang Relay and Serial Relay are mutually exclusive for this processor. Enable one or the other but not both. See the <TinyISP_BuildOptions.h> file.
TinyISP_SanityChecks.h:51:10: error: #error Ensure the "#include <SoftwareSerial.h>" line in the sketch is not commented-out or set RELAY_SERIAL_ENABLED to 0 in the <TinyISP_BuildOptions.h> file.

I can remove the 2nd error by removing the comment from the "//#include <SoftwareSerial.h>" line but once I changed the "#define RELAY_KNOCK_BANG_ENABLED 1" to "#define RELAY_KNOCK_BANG_ENABLED 0" in "TinyISP_BuildOptions.h" a whole bunch of compile errors appear.

SoftwareSerial/SoftwareSerial.cpp.o: In function `__vector_3':
/Applications/Arduino.app/Contents/Resources/Java/libraries/SoftwareSerial/SoftwareSerial.cpp:302: multiple definition of `__vector_3'
KnockBangReceiver.cpp.o:KnockBangReceiver.cpp:271: first defined here
TinyISP/KnockBangParser.cpp.o: In function `TinyDebugKnockBangParserClass::process()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangParser.cpp:51: multiple definition of `TinyDebugKnockBangParserClass::process()'
KnockBangParser.cpp.o:KnockBangParser.cpp:51: first defined here
TinyISP/KnockBangParser.cpp.o:/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangParser.cpp:51: multiple definition of `TinyDebugParser'
KnockBangParser.cpp.o:KnockBangParser.cpp:51: first defined here
TinyISP/KnockBangReceiver.cpp.o: In function `TinyDebugKnockBangClass_AssemblyMacros()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangReceiver.cpp:155: multiple definition of `TinyDebugKnockBangClass_AssemblyMacros()'
KnockBangReceiver.cpp.o:KnockBangReceiver.cpp:155: first defined here
TinyISP/KnockBangReceiver.cpp.o: In function `KnockBangReceive_begin()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangReceiver.cpp:184: multiple definition of `KnockBangReceive_begin()'
KnockBangReceiver.cpp.o:KnockBangReceiver.cpp:184: first defined here
TinyISP/KnockBangReceiver.cpp.o: In function `KnockBangReceive_end()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangReceiver.cpp:211: multiple definition of `KnockBangReceive_end()'
KnockBangReceiver.cpp.o:KnockBangReceiver.cpp:211: first defined here
TinyISP/KnockBangReceiver.cpp.o: In function `KnockBangReceive_available()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangReceiver.cpp:238: multiple definition of `KnockBangReceive_available()'
KnockBangReceiver.cpp.o:KnockBangReceiver.cpp:238: first defined here
TinyISP/KnockBangReceiver.cpp.o: In function `KnockBangReceive_read()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangReceiver.cpp:250: multiple definition of `KnockBangReceive_read()'
KnockBangReceiver.cpp.o:KnockBangReceiver.cpp:250: first defined here
TinyISP/KnockBangReceiver.cpp.o: In function `__vector_3':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangReceiver.cpp:271: multiple definition of `__vector_3'
KnockBangReceiver.cpp.o:KnockBangReceiver.cpp:271: first defined here
TinyISP/KnockBangReceiver.cpp.o: In function `KnockBangReceive_getStats(kbr_stats_t&)':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangReceiver.cpp:598: multiple definition of `KnockBangReceive_getStats(kbr_stats_t&)'
KnockBangReceiver.cpp.o:KnockBangReceiver.cpp:598: first defined here
TinyISP/KnockBangReceiver.cpp.o: In function `KnockBangReceive_getLastFault()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangReceiver.cpp:637: multiple definition of `KnockBangReceive_getLastFault()'
KnockBangReceiver.cpp.o:KnockBangReceiver.cpp:637: first defined here
TinyISP/KnockBangReceiver.cpp.o: In function `KnockBangReceive_getLastDebug1()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/KnockBangReceiver.cpp:656: multiple definition of `KnockBangReceive_getLastDebug1()'
KnockBangReceiver.cpp.o:KnockBangReceiver.cpp:656: first defined here
TinyISP/TinyISP_AispLED.cpp.o: In function `AispLEDClass::setMode(AispLEDClass::mode_t)':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_AispLED.cpp:94: multiple definition of `AispLEDClass::setMode(AispLEDClass::mode_t)'
TinyISP_AispLED.cpp.o:TinyISP_AispLED.cpp:94: first defined here
TinyISP/TinyISP_AispLED.cpp.o: In function `AispLEDClass::update()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_AispLED.cpp:108: multiple definition of `AispLEDClass::update()'
TinyISP_AispLED.cpp.o:TinyISP_AispLED.cpp:108: first defined here
TinyISP/TinyISP_AispLED.cpp.o: In function `AispLEDClass::flash()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_AispLED.cpp:77: multiple definition of `AispLEDClass::flash()'
TinyISP_AispLED.cpp.o:TinyISP_AispLED.cpp:77: first defined here
TinyISP/TinyISP_AispLED.cpp.o: In function `AispLEDClass::error()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_AispLED.cpp:66: multiple definition of `AispLEDClass::error()'
TinyISP_AispLED.cpp.o:TinyISP_AispLED.cpp:66: first defined here
TinyISP/TinyISP_AispLED.cpp.o: In function `AispLEDClass::begin(unsigned char)':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_AispLED.cpp:53: multiple definition of `AispLEDClass::begin(unsigned char)'
TinyISP_AispLED.cpp.o:TinyISP_AispLED.cpp:53: first defined here
TinyISP/TinyISP_AispLED.cpp.o:/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_AispLED.cpp:94: multiple definition of `StatusIndicator'
TinyISP_AispLED.cpp.o:TinyISP_AispLED.cpp:94: first defined here
TinyISP/TinyISP_Monitor.cpp.o: In function `monitor_run(unsigned char&)':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_Monitor.cpp:123: multiple definition of `monitor_run(unsigned char&)'
TinyISP_Monitor.cpp.o:TinyISP_Monitor.cpp:123: first defined here
TinyISP/TinyISP_Programmer.cpp.o: In function `programmer_toggle_hold_in_reset()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_Programmer.cpp:820: multiple definition of `programmer_toggle_hold_in_reset()'
TinyISP_Programmer.cpp.o:TinyISP_Programmer.cpp:820: first defined here
TinyISP/TinyISP_Programmer.cpp.o: In function `programmer_error_occurred()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_Programmer.cpp:857: multiple definition of `programmer_error_occurred()'
TinyISP_Programmer.cpp.o:TinyISP_Programmer.cpp:857: first defined here
TinyISP/TinyISP_Programmer.cpp.o: In function `programmer_release_target_from_reset()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_Programmer.cpp:829: multiple definition of `programmer_release_target_from_reset()'
TinyISP_Programmer.cpp.o:TinyISP_Programmer.cpp:829: first defined here
TinyISP/TinyISP_Programmer.cpp.o: In function `programmer_hold_target_in_reset()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_Programmer.cpp:852: multiple definition of `programmer_hold_target_in_reset()'
TinyISP_Programmer.cpp.o:TinyISP_Programmer.cpp:852: first defined here
TinyISP/TinyISP_Programmer.cpp.o: In function `programmer_reset_target()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_Programmer.cpp:834: multiple definition of `programmer_reset_target()'
TinyISP_Programmer.cpp.o:TinyISP_Programmer.cpp:834: first defined here
TinyISP/TinyISP_Programmer.cpp.o: In function `programmer_toggle_hold_in_reset()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_Programmer.cpp:820: multiple definition of `param'
TinyISP_Programmer.cpp.o:TinyISP_Programmer.cpp:820: first defined here
TinyISP/TinyISP_Programmer.cpp.o: In function `programmer_process_command(unsigned char)':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_Programmer.cpp:689: multiple definition of `programmer_process_command(unsigned char)'
TinyISP_Programmer.cpp.o:TinyISP_Programmer.cpp:689: first defined here
TinyISP/TinyISP_Programmer.cpp.o: In function `programmer_toggle_hold_in_reset()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_Programmer.cpp:820: multiple definition of `programmer_active'
TinyISP_Programmer.cpp.o:TinyISP_Programmer.cpp:820: first defined here
TinyISP/TinyISP_SPI.cpp.o: In function `spi_begin()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_SPI.cpp:67: multiple definition of `spi_begin()'
TinyISP_SPI.cpp.o:TinyISP_SPI.cpp:67: first defined here
TinyISP/TinyISP_SPI.cpp.o: In function `spi_end()':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_SPI.cpp:102: multiple definition of `spi_end()'
TinyISP_SPI.cpp.o:TinyISP_SPI.cpp:102: first defined here
TinyISP/TinyISP_SPI.cpp.o: In function `spi_send':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_SPI.cpp:120: multiple definition of `spi_transaction(unsigned char, unsigned char, unsigned char, unsigned char)'
TinyISP_SPI.cpp.o:TinyISP_SPI.cpp:120: first defined here
TinyISP/TinyISP_SPI.cpp.o: In function `spi_transaction2(unsigned long)':
/Users/daniel/Dropbox/Code/Arduino/libraries/TinyISP/TinyISP_SPI.cpp:183: multiple definition of `spi_transaction2(unsigned long)'
TinyISP_SPI.cpp.o:TinyISP_SPI.cpp:183: first defined here