SoftwareSerial with ATTiny84 using ATtiny library

sej7278:
however if i'm doing anything useful in my sketch (some counting, analogWrite, random, delay....) knockbang seems to sit there doing nothing, gets stuck at monitor startin.....

Are you asking for helping? Or did you just need a whine to vent some frustration?

That sounds interesting. So Knock-Bang will continue to use MISO for debugging and you would also relay Serial via the USART? They both show up on Serial Monitor? Are you also implying two way with Serial?

hiduino:
This could be avoided also if the Mega2560 bootloader did something similar to Optiboot, where it will skip out of bootloader if the wrong baud rate is detected?

I have an Uno with the framing-error-quick-escape feature. I had problems getting it to work as a programmer. The capacitor makes a significant positive difference. It is worth the 10 cent investment. :wink:

hiduino:
That sounds interesting. So Knock-Bang will continue to use MISO for debugging and you would also relay Serial via the USART?

Yes. (With the addition that an alternate pin can be used for Knock-Bang if MISO is otherwise needed.)

They both show up on Serial Monitor?

Yes.

Are you also implying two way with Serial?

Yes.

While I have not tested it, that is the way it should work now.

Not to beat this subject dead, but I've been using an Uno R3 without the capacitor and no problems with TinyISP or ArduinoISP. The bootloader escape seems to work fine on the Uno R3. 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.

It appears that avrdude does not invoke the auto-reset when using the stk500v1 protocol to the Uno R3 or Mega2560 R3. It does if you use the "arduino" protocol. So the reset capacitor really doesn't do anything in this case, except for going into Serial Monitor.

hiduino:
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?

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!)

Thanks

Kihon

Hello,

kihon:
Can the TinyDebugKnockBang use a different pin?

Yes.

The pin assignment for the ATtiny84 is here...
http://code.google.com/p/arduino-tiny/source/browse/TinyDebugKnockBang.h?repo=debugknockbang#55

Or, you could assign values to the KBS_* macros at an earlier point in the compilation...
http://code.google.com/p/arduino-tiny/source/browse/TinyDebugKnockBang.h?repo=debugknockbang#108

On the TinyISP side, enable RELAY_KNOCK_BANG_USE_ALTERNATE_PIN in _TinyISP_BuildOptions.h ...
http://code.google.com/p/arduino-tiny/source/browse/_TinyISP_BuildOptions.h?repo=isp#42

The alternate pins on 328 processors is digital pin 7 (PD7)...
http://code.google.com/p/arduino-tiny/source/browse/TinyISP_SelectBuildOptions.h?repo=isp#200

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 :frowning: 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 :

void setup(){
  Serial.begin(9600);
  pinMode( A1, INPUT );  //PB2 (ADC1)  
}

void loop(){
  Serial.println(analogRead(A1));
  delay(100);
}

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 ?

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:

#define RELAY_SERIAL_ENABLED  0
#define RELAY_KNOCK_BANG_ENABLED 1

And in TinyISP I comment this:

//#include <SoftwareSerial.h>

Then I upload this sketch to the ATtiny85:

#include <TinyDebugKnockBang.h>

int x=0;

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

void loop( void )
{
  Debug.print("Test-");
  Debug.println(x++);
  delay( 1000 );
}

Open the serial monitor @19200 and enter !

More details can be found here:

http://www.ernstc.dk/arduino/tinycom.html

Open the serial monitor @19200 and enter !

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

Greetings,
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 Programming Attiny2313 with Arduino Uno
& this ATtiny core to setup my IDE Google Code Archive - Long-term storage for Google Code Project Hosting.
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 - what is relay knockbang - Google Search

Relay Serial - relay serial - Google Search
Thanking you in anticipation.

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.

http://forum.arduino.cc/index.php?topic=51984.msg1463698#msg1463698

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

https://github.com/Coding-Badly/TinyISP/zipball/master

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

BTW: I am the author of the page you mentioned:
http://www.ernstc.dk/arduino/2313.htm
If you have any comments, improvements please let me know

Erni:
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...
http://code.google.com/p/arduino-tiny/

Hello :slight_smile:

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
cheers.

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
http://forum.arduino.cc/index.php?topic=203108.0
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
:slight_smile: