Global Moderator
Dallas
Online
Shannon Member
Karma: 129
Posts: 10374
|
 |
« Reply #45 on: September 26, 2012, 10:08:16 pm » |
Certainly a good idea but not where I'm headed. Null would be stripped from the sketch by the optimizer.
The example above, with one change...
#include <TinyDebugNull.h>
void setup( void ) { Debug.begin( 250000 ); }
void loop( void ) { Debug.println( F( "Caitlin! " ) ); delay( 1000 ); }
...would essentially become this...
#include <TinyDebugNull.h>
void setup( void ) { }
void loop( void ) { delay( 1000 ); }
It would allow debugging to be easily turned on and off.
|
|
|
|
|
Logged
|
|
|
|
|
Valencia, Spain
Offline
Faraday Member
Karma: 72
Posts: 2500
|
 |
« Reply #46 on: September 28, 2012, 02:42:08 pm » |
I used an ATTiny85 to send serial data and an Arduino Uno to receive it. First I got some strange gibberish too until I pulled the ATTiny's VCC out by accident. Without VCC on the ATTiny it sent what I wanted, after reconnecting VCC it was gibberish again. There were no pins except Tx, Rx and GND connected.
That's BAD. It means the chip was drawing power from the TX line (or something). The 8mHz internal clock varies with temperature and voltage. I'm guessing you got lucky and the bad power source made it work but, DON'T DO IT AGAIN. Ever. You can damage the chips.
|
|
|
|
|
Logged
|
No, I don't answer questions sent in private messages...
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #47 on: October 04, 2012, 07:43:21 am » |
Just a quick note and a question. I have the exact same setup as Erni. I wasn't able to get any output when using SoftwareSerial. The code was running on the target (ATTiny85) but there was no output. Monitor enabled with "!" and "#" for restarting the tiny works.
I then tried to use TinyDebugKnockBang. When I put the header and implementation files into my sketches folder (inside the TinyDebugKnockBang directory), the Arduino IDE isn't able to pick it up (after restarting). It just states that "Debug." isn't declared. Since I am on a Mac, I have put the TinyDebugKnockBang directory directly inside the Arduino.app/Contents/Resources/java/libraries. Now it works and I get the desired output.
Whats weird though, when I try the same blink example as Erni (just changed the led pin to 1 for the tiny), I get output as long as I don't connect the LED. When I connect it, the serial monitor prints: --- Knock-Bang fault: 15 ---
Thanks Stefan
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
God Member
Karma: 23
Posts: 704
|
 |
« Reply #48 on: October 04, 2012, 08:43:01 am » |
just changed the led pin to 1 for the tiny pin 1 (PB1) is the MISO pin used when sending from the Tiny to the arduino (Master in /Slave out), that's why I used pin 3.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #49 on: October 04, 2012, 08:50:52 am » |
Thanks Erni, I also tried pin3 (analog input). But it didn't work. I think it isn't enough to set it to OUTPUT then?
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
God Member
Karma: 23
Posts: 704
|
 |
« Reply #50 on: October 04, 2012, 09:05:17 am » |
Oh I see, thast old example I made is not the one I used afterall, I am sorry to confuse you. Try this: #include <SoftwareSerial.h> const int rx=3; const int tx=1;
SoftwareSerial mySerial(rx, tx);
void setup() { pinMode(rx,INPUT); pinMode(tx,OUTPUT); mySerial.begin(9600);
}
void loop() { mySerial.println("Testing..."); delay(500); }
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #51 on: October 04, 2012, 09:37:21 am » |
No problem. I set TinyISP to use SoftwareSerial again. I do get output with your sketch, but it is not legible. The second problem is - I have a push button and an led. I need to connect both to the attiny without interfering with the other pins used for programming. So far I have tried pin 3 for the led and pin 2 for the button, but this breaks my code - i.e. it behaves weird. If I disconnect all jump wires and attach the led to pin 1 and the button to pin 0, it works - but I obviously don't get any output. I am doing all this because I want to save a value to the tiny's EEPROM and I am using the button to enter a "settings mode". Then I am using the led as a visual feedback for the user so he knows which value has been saved. Upon reset I want to load the value from EEPROM and blink the led n-times according to the saved value. This fails and I don't know why. This was my initial reason to search for a way to print the debug output from the tiny to check the EEPROM value.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 4
|
 |
« Reply #52 on: October 04, 2012, 10:05:26 am » |
Just a little follow-up. I was able to get output with KnockBang. I have attached the led to attiny's pin 3 and the button to pin 0. This does not interfere with the programming via Arduino Uno. And writing and reading from EEPROM works too  I needed to convert values with int() and byte().
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 1
Posts: 5
|
 |
« Reply #53 on: December 02, 2012, 01:19:19 pm » |
Hello, I think it is a bit off topic, but I found no better post for this topic. I wanted to use the famous TinyISP programm to allow serial debug output of an ATtinyx5 into the Arduino IDE Serial Monitor. Unfortunately the ATtinyx5 pin number in file TinyDebugSerial.h was not set to fit the standard ArduinoISP setup. I had to change the pin number from 3 to 1, then it worked (CPU clock 1 MHz). I have documented all that on my web page: http://www.rudiswiki.de/wiki9/AVRTinyISPRegards to Coding Badly for the good software.  Rudolf
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 129
Posts: 10374
|
 |
« Reply #54 on: December 05, 2012, 12:17:42 am » |
Hello, I wanted to use the famous TinyISP programm... Famous? Thank you for taking the time to write about your experience and posting a link here. Regards to Coding Badly for the good software.  My pleasure. I'm glad you find it useful. Have (had) you considered using Knock-Bang instead of Serial? I use it with an ATtiny13 processor so the footprint has to be even smaller than TinyDebugSerial. (There are a few other benefits over Serial.)
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 1
Posts: 5
|
 |
« Reply #55 on: December 05, 2012, 12:31:19 am » |
Hello Coding Badly,
No, I have not tried the Knock-Bang protocol, because I thought it needs more flash-ROM space than the serial protocol. When you say so that it needs less space, I will give it a try.
Regards, Rudolf
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 129
Posts: 10374
|
 |
« Reply #56 on: December 05, 2012, 03:26:14 am » |
Knock-Bang uses roughly half the space of TinyDebugSerial. println of an integer is 292 bytes versus 582 bytes. println of a Flash string constant is 282 versus 638. One println of each is 348 versus 710.
|
|
|
|
|
Logged
|
|
|
|
|
Denmark
Offline
God Member
Karma: 23
Posts: 704
|
 |
« Reply #57 on: December 05, 2012, 10:57:10 am » |
I use it with an ATtiny13 I did not know your Tiny core supported the attiny13 ? I have used smeezekitty's tiny13 core, which is great, but it would be nice to be able to use your TinyISP.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 129
Posts: 10374
|
 |
« Reply #58 on: December 05, 2012, 02:46:22 pm » |
I did not know your Tiny core supported the attiny13 ? The version on my desk (mostly) does. It has some goodies that actually make the ATtiny13 useful. But the core is not complete (no: analogRead, delay, delayMicroseconds, tone w/ variable parameters). I have used smeezekitty's tiny13 core, which is great, but it would be nice to be able to use your TinyISP. Knock-Bang should be independent of the core. TinyISP + Knock-Bang should work well with smeezekitty's core (or any other core).
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 1
Posts: 5
|
 |
« Reply #59 on: December 06, 2012, 02:28:07 pm » |
Hello Coding Badly,
I tried the KnockBang protocol, but I got the error message from the compiler : warning: TinyDebugKnockBang.h: No such file or directory
I had copied before both files to the "library" folder. Also copying them to the "hardware/cores/tiny" folder did not help.
Regards, Rudolf
|
|
|
|
|
Logged
|
|
|
|
|
|