Go Down

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

Coding Badly

Quote
I can upload the blink sketch as before but when I try to send a exclamation mark (!) in the serial monotor, all I get is  this


No sign-on message from the Monitor?

Is the PC-to-Arduino baud rate set to 19200?

daywalkerdha

@Coding Badly
Thanks, I'll try that once I get back from work today.

Erni

Quote
No sign-on message from the Monitor?

No
Quote
Is the PC-to-Arduino baud rate set to 19200?

Yes if you mean the com port that connects to the Arduino

Coding Badly


What I did and the results...

• Download the latest version of TinyISP...
https://github.com/Coding-Badly/TinyISP/zipball/master

• Extract the contents to a directory named TinyISP in my Arduino sketchbook folder

• Load TinyISP.pde into Arduino 1.0.1

• Navigate to the TinyISP_BuildOptions.h tab

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

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

• Navigate to the TinyISP tab

• Remove the comment from this line...

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

• Upload the sketch to my Uno

• Open Serial Monitor

• Ensure No line ending is selected

• Ensure 19200 baud is selected

• Enter a single exclamation mark (!) and click Send

• The following line is output by the Arduino...

[font=Courier New]--- Monitor starting ---[/font]

• Enter a single exclamation mark (!) and click Send

• The following line is output by the Arduino...

[font=Courier New]--- Monitor stopped ---[/font]



Erni

Ohh I totally overlooked this, sorry

Ensure 19200 baud is selected

Now it works as expected.
Thankyou Coding Badly for your help and patience.

With this setup it is so much easyer to program the tiny's no more swappinp between programmer and serial/usb connectors

Coding Badly


Excellent.  Let me know when you are ready to try Knock-Bang.

Erni


Coding Badly

#37
Sep 25, 2012, 09:07 pm Last Edit: Sep 25, 2012, 09:12 pm by Coding Badly 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

Coding Badly


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

Coding Badly


At this point, you should be able to upload the test sketch to a tiny processor and use Serial Monitor for debugging.

Knock-Bang uses MISO (and GND) for communications.  You only need to connect the target (the tiny processor) and programmer (the Uno) as would normally do for programming.  No extra connections are needed.

Erni

That worked right out of the box !

So it seems that if you only need the output from the tiny you would choose KnockBang, and if you need to also send something to the tiny you would use
RelaySerial ?

Another observation in the test script you use

Code: [Select]
Debug.begin( 250000 );

But you have to set the serial monitor to 19200 (I mean usually they should be the same) ?

Coding Badly

#41
Sep 25, 2012, 10:43 pm Last Edit: Sep 25, 2012, 10:45 pm by Coding Badly Reason: 1
That worked right out of the box !


Excellent.

Quote
So it seems that if you only need the output from the tiny you would choose KnockBang, and if you need to also send something to the tiny you would use RelaySerial ?


That's what I do.  Knock-Bang is smaller, faster, more reliable, uses a pin already connected to the programmer, and consumes almost zero CPU time if the programmer is not connected.  For simple debugging it is a great choice.

Quote
Another observation in the test script you use
Code: [Select]
Debug.begin( 250000 );
But you have to set the serial monitor to 19200 (I mean usually they should be the same) ?


Sort of.  My ultimate goal is to provide three Tiny Debuggers: Serial, Knock-Bang, and Null.  The parameter (the "250000") will eventually be the baud rate for Serial.  For the other two debuggers the parameter is ignored.  You can put what you'd like in there but 19200 is certainly a better choice.

Erni

I am impressed with the tools you have made
  It will be interesting to hear what a Null debugger can be used to

Coding Badly

I am impressed with the tools you have made


Thanks.

Quote
It will be interesting to hear what a Null debugger can be used to


What popped into your mind when you read "Null debugger"?

Erni

My first thought was null modem, as in the old days when we interconnected two PC's with a crossover serial cable.

So maybe a smart way to let 2 attiny communicate together, while debugging the result ?

Go Up