SoftwareSerial with ATTiny84 using ATtiny library

Erni:
Sigh now i feel stupid

Why? Were you born knowing how to modify boards.txt? If not (and we both know you were not) you are not even close to "stupid".

You made a mistake. We all do. To be "stupid" you would have to refuse to acknowledge your mistake then correct it. Clearly that is not the case.

So now KnockBang works on Attiny13, whit clockspeeds 9.6 4.8 1.2 and 0.6 MHz.

Excellent!

(Except for 0.6 MHz. I'm surprised that works. As the clock speed is reduced below 1 MHz, the protocol becomes less reliable. At 0.5 MHz it should fail.)

(Except for 0.6 MHz. I'm surprised that works. As the clock speed is reduced below 1 MHz, the protocol becomes less reliable. At 0.5 MHz it should fail.)

Now I have done some more testing at 600 kHz and it is indeed unreliable.

I had a sketch running for more than 40 minutes whitout any errors,
other tests only 4-5 lines before I got a KnockBang error, and most tests between those.

Erni:
Now I have done some more testing at 600 kHz and it is indeed unreliable.

Do you have a need for Knock-Bang to work at clock speeds below 1 MHz?

I had a sketch running for more than 40 minutes whitout any errors,

Excellent!

Do you have a need for Knock-Bang to work at clock speeds below 1 MHz?

No, I was just curious to see if it worked.

this seems like a really awesome project and exactly what I am looking for. however the sketch doesn't seem to want to compile. I get this error:

In file included from KnockBangReceiver.cpp:36:
TinyISP_SelectBuildOptions.h:175:2: error: #error

I'm on an Uno and IDE v1.0.1. I think it might have to do with TinyISP_BuildOptions.h, that doesn't seem to be in the files included.i did find TinyISP_SelectBuildOptions.h and that seemed right, however settings in there already matched what you said to change.

any suggestions?

Sorry about that. Try it now.

daywalkerdha:

[quote author=Coding Badly link=topic=123388.msg929989#msg929989 date=1348162209]

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

It won't.

That's what they taught me in EE :wink:
[/quote]

It might ... if one of the I/O pins is connected to a voltage source.

OTOH this is a good way to destroy chips, don't try it at home.

ahh, there we go! perfect. thank you.

I seem to be missing something. Maybe I don't fully understand what knock-bang is. Was assuming this was a simple "hello world" type message that you can test this one, could be wrong.

I have selected attiny85 at 8mhz as board and it upload fine and I can even add "!" into debugger and I get "--- Monitor starting ---" but it seems nothing is coming out. Also have 19200 baud set, no line ending. I uploaded the sketch you showed earlier:

#include <TinyDebugKnockBang.h>

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

void loop( void )
{
  Debug.println( F( "Caitlin! " ) );
  delay( 1000 );
}

But I am not getting anything in the monitor aside from initiated message. On arduino its connected to Tx (though it seems like it would be Rx but all other monitors I have set up use Rx for some reason) and PB3 on the attiny (with 220ohm resistor between). Might be missing something though?

hilukasz:
I seem to be missing something.

You are. Documentation. Work keeps getting in the way.

Try this...

• With the TinyISP sketch loaded in the Arduino IDE, switch to the _TinyISP_BuildOptions.h tab # (sadly, it ended up the last tab)

• Add this line below the Put build options here comment...

#define RELAY_KNOCK_BANG_ENABLED 1

• Upload the modified sketch (don't forget to remove the auto-reset disable capacitor)

# Or, with the Arduino IDE not running use an external editor to modify the file.

• Upload the modified sketch (don't forget to remove the auto-reset disable capacitor)

Is that the on between reset and ground? I did that and no change, still get the error:

--- Knock-Bang fault: 11 ---

--- Knock-Bang fault: 11 ---

hilukasz:
Is that the on between reset and ground?

Yes.

I did that and no change, still get the error:

--- Knock-Bang fault: 11 ---

--- Knock-Bang fault: 11 ---

No change? Earlier you reported that nothing was being output to the Serial Monitor. Were error messages being output?

definitely a change, it now says --- Knock-Bang fault: 11 --- instead of nothing. Of course I should clarify, it did indicate the monitor was starting and stopping.

Edit: trimmed the unnecessary quote.

The receive errors are listed here...

The one of interest is...
fault_timeout_knock = 0x11

The receiver (your Uno) is expecting a low pulse of a certain duration (a "knock"). The pulse is too short to be a knock.

The problem could be caused by the target running at 1 MHz with code built for a processor running at 8 MHz. Which "board" do you have selected? Have you used "burn bootloader" to change the fuses?

The problem could be caused by the target running at 1 MHz with code built for a processor running at 8 MHz.

If it is of any help, I just tried a Attiny85 running at 1MHZ and selected board Attiny85 @ 8MHZ and got:

--- Knock-Bang fault: 11 ---

With the same target and selcting board Attiny85 @ 1MHZ it works as expected (Output to the serial monitor looks as it should)

Erni:

The problem could be caused by the target running at 1 MHz with code built for a processor running at 8 MHz.

If it is of any help, I just tried a Attiny85 running at 1MHZ and selected board Attiny85 @ 8MHZ and got:

--- Knock-Bang fault: 11 ---

With the same target and selcting board Attiny85 @ 1MHZ it works as expected (Output to the serial monitor looks as it should)

yeah, I just did this too. It makes sense since the frequency is 8 times faster, would make the signal shorter. I was under impression serial monitor needed to be 8Mhz like normal, but this seems to run differently.

It works perfect now! thanks guys.

I have it in still and it seems to be working fine. should I leave it? I honestly don't know what it does. I was under impression it just resets arduino so that it can program the attiny, but what that really means I have no idea.

I have it in still and it seems to be working fine. should I leave it?

As long as you use your Arduino as programmer, the capacitor between reset and ground should be connected.
It is there tp prevent your Arduino to reset and then starting the bootloader, instead of talking to the ArduinoISP.

For those using TinyISP with ATTinyx4 etc (specifically i use 84A_PU) and TinyDebugSerial at <=8Mhz

I found that on a new vanilla install (for windows 7 64) of Arduino IDE 1.0.3 (downloaded today 8/feb/2013) you should change the
define for the debug register and bit (see 2 lines below 'Use MISO as TX').

#elif defined( AVR_ATtinyX4 )

#if F_CPU <= 8000000L
// port B bit 0 (PB0)
//#define TINY_DEBUG_SERIAL_REGISTER 0x18 <<<<original settings
//#define TINY_DEBUG_SERIAL_BIT 0 <<<original settings
//use MISO as TX back to host, i.e Port A 5 (PA5)
#define TINY_DEBUG_SERIAL_REGISTER 0x1B
#define TINY_DEBUG_SERIAL_BIT 5
#else
// port A bit 0 (PA0)
#define TINY_DEBUG_SERIAL_REGISTER 0x1B
#define TINY_DEBUG_SERIAL_BIT 0
#endif

I am very new to all this (1 week in) so I hope the above is helpful, please reply if this info is erroneous and I'll correct.

PS: Thx very much for TinyISP, makes using 84/85's almost pleasurable :wink:

Kind Regards

did that file get revered maybe? I formatted and had to download it again and that file seems to be missing again.