Pages: 1 2 [3] 4 5 ... 14   Go Down
Author Topic: SoftwareSerial with ATTiny84 using ATtiny library  (Read 38622 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 45
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

#define RELAY_SERIAL_ENABLED              1

• Navigate to the TinyISP tab

• Remove the comment from this line...

#include <SoftwareSerial.h>

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

--- Monitor starting ---

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

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

--- Monitor stopped ---


Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am ready  !!!
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

#define RELAY_KNOCK_BANG_ENABLED           1  

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

#define RELAY_SERIAL_ENABLED               0  

• Navigate to the TinyISP tab

• Add a comment to this line...

// #include <SoftwareSerial.h>

• Upload the sketch to your Uno
« Last Edit: September 25, 2012, 02:12:20 pm by Coding Badly » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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:
#include <TinyDebugKnockBang.h>

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

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

• Verify that the sketch compiles
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Debug.begin( 250000 );

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

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
« Last Edit: September 25, 2012, 03:45:04 pm by Coding Badly » Logged

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Denmark
Offline Offline
Edison Member
*
Karma: 35
Posts: 1029
Happy Hobbyist
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: 1 2 [3] 4 5 ... 14   Go Up
Jump to: