Go Down

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

Erni

Quote
(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.

Coding Badly

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?

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


Excellent!

Erni

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

hilukasz

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:

Code: [Select]
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?
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Coding Badly


fungus



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


It won't.


That's what they taught me in EE ;)


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.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

hilukasz

for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

hilukasz

#97
Jan 18, 2013, 05:44 am Last Edit: Jan 18, 2013, 05:46 am by hilukasz Reason: 1


Install the Tiny Debug Knock-Bang library...

• Download the latest version of Tiny Debug Knock-Bang...
https://github.com/Coding-Badly/TinyDebugKnockBang/zipball/master
https://github.com/Coding-Badly/TinyDebugKnockBang

• Extract the contents to a directory named TinyDebugKnockBang in your Arduino sketchbook library folder

• Start the Arduino IDE

• Ensure one of the tiny processor "boards" is selected

• Copy-and-paste this small test into the edit window...

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

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

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


• Verify that the sketch compiles



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:

Code: [Select]
#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?
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Coding Badly

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[font=Courier New] _TinyISP_BuildOptions.h [/font]tab # (sadly, it ended up the last tab)

• Add this line below the[font=Courier New] Put build options here [/font]comment...

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

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

hilukasz

#99
Jan 19, 2013, 05:36 am Last Edit: Jan 19, 2013, 06:48 am by hilukasz Reason: 1

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[font=Courier New] _TinyISP_BuildOptions.h [/font]tab # (sadly, it ended up the last tab)

• Add this line below the[font=Courier New] Put build options here [/font]comment...

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

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



Quote
• 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:

Code: [Select]

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

--- Knock-Bang fault: 11 ---
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Coding Badly

Is that the on between reset and ground?


Yes.

Quote
I did that and no change, still get the error:
Code: [Select]

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

hilukasz

#101
Jan 19, 2013, 07:29 am Last Edit: Jan 19, 2013, 07:49 am by Coding Badly Reason: 1

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.
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Coding Badly


The receive errors are listed here...
https://github.com/Coding-Badly/TinyISP/blob/master/KnockBangReceiver.cpp#L285

The one of interest is...
[font=Courier New]fault_timeout_knock          = 0x11[/font]

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?

Erni

#103
Jan 19, 2013, 01:11 pm Last Edit: Jan 19, 2013, 01:14 pm by Erni Reason: 1
Quote
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:

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


hilukasz


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

Quote
--- 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.
for(i = 0, i < 820480075, i++){ Design(); Code(); delay(1000); } // hellowoo.com

Go Up