Go Down

Topic: SoftwareSerial with ATTiny84 using ATtiny library (Read 115036 times) previous topic - next topic

Coding Badly

It's not a problem to use the capacitor, but it's a little hassle to get it to contact into the headers good or otherwise jumper it from a breadboard.

Arc the pins so the capacitor hangs over the middle of the board.  If you always use the same capacitor arcing the pins also helps to ensure the capacitor is connected the correct way around.

It appears that avrdude does not invoke the auto-reset when using the stk500v1 protocol to the Uno R3 or Mega2560 R3.

Huh.  So it doesn't.  I wonder if that changed or if I have been a dumb-ass.

So the reset capacitor really doesn't do anything in this case, except for going into Serial Monitor.

Beats waiting 10 seconds.

Thoughts on moving Serial Relay to Serial1?


Thoughts on moving Serial Relay to Serial1?

Serial1 works fine for me.  Will it complicate things to allow it on MISO as an option?


Hi All,

Does anyone know if this can be used with something else that uses the MISO/MOSI? I need to debug an ATTiny84 connected to an NRF24L01+ transmitter, but I just get knock bang faults when trying to debug. I assume its conflicting on the MISO/MOSI pins.

Is there an alternative? Can the TinyDebugKnockBang use a different pin? (I understand I would have to move the pin once the programming is done, but its better than no debug!)



Coding Badly


Can the TinyDebugKnockBang use a different pin?


The pin assignment for the ATtiny84 is here...

Or, you could assign values to the KBS_* macros at an earlier point in the compilation...

On the TinyISP side, enable RELAY_KNOCK_BANG_USE_ALTERNATE_PIN in _TinyISP_BuildOptions.h ...

The alternate pins on 328 processors is digital pin 7 (PD7)...


Nov 26, 2013, 11:13 pm Last Edit: Nov 27, 2013, 06:11 pm by smithy Reason: 1
Hi, I´m currently trying to get Tiny Debug Knock-Bang to work with my Attiny 85 @ 8mhz. I followed the guide from page 2 #33 and succeeded in getting Serial Monitor response to "!" . Then i followed on to the Knock-Bang debug but i cant get it to work even though my baud rate in Serial Monitor was set to 19200. When the capacitor between gnd and reset isnt set my arduino (328 nano) led blinks every time i change the baud rate in the monitor. Totally have no clue what is going on, i can compile the example sketch and upload it but i can´t read my tiny :( I even tried it with 1 mhz makes no difference.
The only option i have left is using Serial and switching pins all the time but it works.

Now i´ve gotten a way bigger problem, flashed following sketch :

Code: [Select]

void setup(){
  pinMode( A1, INPUT );  //PB2 (ADC1) 

void loop(){

Now my nano led keeps blinking all the time, the analog read on the CLK pin on the tiny seems to mess up with tinyISP, i can´t upload any more and getting sync errors ( i can see it is being initialized RX/TX on nano blinking shortly). I just need to "reset" or overwrite the progmem of the tiny. What are my options here ?


I don't think the sketch you uploaded to the tiny is the problem.
I just tried to upload your sketch, and afterwards I could upload the blink sketch without problems.

I use TinyISP on a UNO, (and a 10uF capacitor from reset to ground)

Do you have something else connected to the tiny while programming ?


Nov 28, 2013, 08:01 pm Last Edit: Nov 28, 2013, 08:07 pm by smithy Reason: 1
I don´t know i´ve read  that using pinmode can cause some problems, i tried flashing arduinoISP and tinyISP again. Somehow i got lucky and the led didn´t blink any more maybe the setting of tinyISP was wrong (buildoptions) and i was able to flash, now i still wanna try tinydebugknockbang. From what i have understood the reply to the ! message is arduino based not tiny based so i kinda didnt figure out how to get a Serial read from  my tiny except using Serial and a Serial USB converter (used for programming pro mini).

Yes i have connected a line from pb3 (Serial TX) to RX of my Serial USB converter, even while i Flash since the port is not used. I can definately tell that the blinking only occured when PB2 was connected to D13 ( i guess there was a bug because i used Serial in my programm but had turned the settings to using Knockbang).

Since I wanted to programm differential read and I´m getting strange offset readings (around 1000), i thought maybe because I use Serial. Does the DIDR0 reg set off the ADC ? I am measuring PB4-PB4 and i still get high values even though my DIDR0 reg is --11 1111.
Only when I leave the BIN in ADSCRB 0 i get 0 as measurement, which should be not true.
Sorry for going offtopic here, maybe u tried smth. similar and had same issues.


I'm not sure what you're asking about and certainly not in the last section.

To get started with Knockbang, here is what I do:

In  _TinyISP_BuildOptions_h i put these lines:

Code: [Select]

And in TinyISP I comment this:

Code: [Select]
//#include <SoftwareSerial.h>

Then I upload this sketch to the ATtiny85:

Code: [Select]
#include <TinyDebugKnockBang.h>

int x=0;

void setup( void ) {
  Debug.begin( 250000 );

void loop( void )
  delay( 1000 );

Open the serial monitor @19200 and enter  !

More details can be found here:



Open the serial monitor @19200 and enter  !

It wasn´t clear to me that you have to start the monitor for KnockBang aswell :) tyvm


Dec 09, 2013, 10:02 am Last Edit: Dec 09, 2013, 10:43 am by nightcrawler218 Reason: 1

Modify TinyISP to use Knock-Bang instead of Serial...

• Load TinyISP.pde into Arduino 1.0.1

• Navigate to the TinyISP_BuildOptions.h tab

• Change RELAY_KNOCK_BANG_ENABLED to this (change the zero to a one)...

[font=Courier New]#define RELAY_KNOCK_BANG_ENABLED           1  [/font]

• Change RELAY_SERIAL_ENABLED to this (change the one to a zero)...

[font=Courier New]#define RELAY_SERIAL_ENABLED               0  [/font]

• Navigate to the TinyISP tab

• Add a comment to this line...

[font=Courier New]// #include <SoftwareSerial.h>[/font]

• Upload the sketch to your Uno

I have a couple of ATtiny2313 chips & I want to burn thr arduino bootloader into it & upload sketches. I have an uno board, a couple of breadboards & jumper wires etc.
I followed This tutorial http://www.ernstc.dk/arduino/2313.htm
& this ATtiny core to setup my IDE http://code.google.com/p/arduino-tiny/
In that page the author refers your posts from arduino community http://arduino.cc/forum/index.php/topic,123388.30.html

Need to clarify a few things before I finally burn the bootloader....
1. What core is the most appropriate? The one that is referred in the tutorial or should I use your github core files? I am using arduino 1.5
2. Will you please tell me in brief what is serial relay & knockBang protocol?
I searched google but didn't find anything appropriate. Tried searches...

KnockBang - https://www.google.co.in/search?q=what+is+relay+knockbang&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a&channel=fflb&gws_rd=cr&ei=noWlUvWlOIWErAfMzoHoBA#channel=fflb&q=knockbang+protocol&rls=org.mozilla:en-US%3Aofficial

Relay Serial - https://www.google.co.in/search?q=relay+serial&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a&channel=fflb&gws_rd=cr&ei=54WlUvfFJMiKrQeQsoHwCQ
Thanking you in anticipation.
"Imagination is more important than knowledge."


Dec 09, 2013, 01:14 pm Last Edit: Dec 09, 2013, 01:32 pm by Erni Reason: 1
I want to burn thr arduino bootloader into

Do you realy want ton use a bootloader ?
If you use a programmer as mentioned in that tutorial, you don't need a bootloader.
Burning bootloader is just a way to set the fuses for the desired clock frequense

I am using arduino 1.5

If you use version 1.5 you will have to make a few changes.


what is serial relay & knockBang protocol

It is a very smart way to communicate with the t2313. If you use it you don't have to use a external serial/USB converter,
and you don't need to change between programming and serial connection, it is almost like programming an Arduino Uno.

You have to use a special sketch. Use this called TinyISP


Instead of the usual ArduinoISP, that is included with the IDE

BTW: I am the author of the page you mentioned:
If you have any comments, improvements please let me know

Coding Badly

If you use version 1.5 you will have to make a few changes.

No longer necessary.  Tiny Core 1 has been packaged for Arduino 1.5.  Both are available on the home page...


Dec 09, 2013, 10:41 pm Last Edit: Dec 09, 2013, 10:59 pm by nightcrawler218 Reason: 1
Hello  :)

Thanks for your response. I was a little bit surprised to find the author here. Thanks for your time & effort that you put in the article to help us. Thanks to Coding Badly too.
I have successfully uploaded sketches to ATtiny2313 by using (Arduino UNO) ArduinoISP & SPI protocol. I used the ATtiny core for arduino1.5

Now the other half. I have a sketch loader circuit (FTDI based breakout board). I want my ATtiny to get burnt using the FTDI chip just like we  upload sketches in ATmega328 on BreadBoard.

I want to replace the UNO board by FTDI breakout board (Tx, Rx, RST pin). I did this but IDE says NO USB aavailable. Any help please.
What it TinyISP? Has it something to do with my issue? I have downloaded the coding-badly tinyISP zip file. What should I do now? Thanks for all your support & guidance
"Imagination is more important than knowledge."


Dec 09, 2013, 11:33 pm Last Edit: Dec 09, 2013, 11:36 pm by Erni Reason: 1
What it TinyISP?

It is just a replacement for ArduinoISP, with extra features

If you want to use a  FTDI  board , you will need a bootloader. I haven't heard of any bootloader for the t2313, maybe because of the very small memory :2K Flash, 128 SRAM

I saw that there should be a bootloader for ATtiny85
But the t85 has 4 times as much memory

Thanks for your response. I was a little bit surprised to find the author here. Thanks for your time & effort that you put in the article to help us

You are welcome.

And just to avoid any mistakes.
The Tiny core, TinyISP and so on are developed and maintained by Coding Badly.
Something like that far exceeds my programming skills, I am just a hobbyist


Thanks for your response. Glad to be here in this community
"Imagination is more important than knowledge."

Go Up