Attiny2313A with Tiny core and TinyDebugSerial

Hi,

I have a few Attiny’s both a 2313 and 2313A.

The 2313 works great but the 2313A seems to work better at 1Mhz. I get garbled data out of the serial port when at 8Mhz using TinyDebugSerial.

Anyone else experience this or have a solution? I am building a project around this and though the 2313A would by fine.

At 8Mhz I can blink and LED and stuff but just not TX serial.

Thanks,
-William

What baud rate?

Have you tried to tune the internal oscillator?

I have tried all 3 baud rates.

I did read about tuning. So that would mean some IC would work out of the box and not others.

I am making small batches so if tuning works I would have tune every uC?

MobileWill:
I have tried all 2 baud rates.

There are three choices available.

I did read about tuning. So that would mean some IC would work out of the box and not others.

Atmel guarantees the internal oscillator is ±10%. About ±4.5% is the limit for serial communications.

I am making small batches so if tuning works I would have tune every uC?

Correct. I store the tuning value towards the end of EEPROM and then load the value in setup so a variation of the program does not have to be created for each processor.

Well I guess I should either have a external resonator or stick with 1Mhz. In the end I don't need serial so everything else should be fine.

Hmm.

For TinyTuner which pin am I using? And should I be using TinyTuner2?

All the TinyTuner examples sketches are too big.

Hmm, think I am just going to stick with 1Mhz.

If you change your mind, let me know and I'll help you get TinyTuner2 working with the 2313.

I still would like to try, I hate giving up on something.

The latest version of Tiny Tuner 2 is available here... http://code.google.com/p/arduino-tiny/source/browse?repo=tuner Click "Download zip" to download all the files of the repository. It's a library so the files belong in the {ArduinoSketchbookFolder}/libraries/TinyTuner2/ directory (which you will have to create).

Both examples use Tiny Debug Knock-Bang but it is not required for Tiny Tuner 2 to work. You can either install Tiny Debug Knock-Bang or modify one of the examples. If you decide to install Tiny Debug Knock-Bang, it can be downloaded from that same site... Google Code Archive - Long-term storage for Google Code Project Hosting. It is also a library and belongs in the {ArduinoSketchbookFolder}/libraries/TinyDebugKnockBang/ directory.

You will need something that generates a "tuning pulse" (it's a 16ms high pulse). I use a drop-in replacement for ArduinoISP named TinyISP... Google Code Archive - Long-term storage for Google Code Project Hosting. It's a sketch that you use with your Arduino just as you would use ArduinoISP. TinyISP is configured with compile-time options in the _TinyISP_BuildOptions.h file. Open that file, remove the comment from the following line, and upload to your Arduino...

#define TUNING_SIGNAL_ENABLED  1

If you are going to use Tiny Debug Knock-Bang, remove the comment from this line...

#define RELAY_KNOCK_BANG_ENABLED  1

On an Arduino ATmega328[P] based board (like an Uno), the tuning pulse is output on digital pin 3 which is connected to XTAL2 on the target (your ATtiny2313).

Tiny Debug Knock-Bang uses MISO which is already connected between the Arduino and the target.

Thanks for the detailed guide. Should this work with the Leonardo running TinyISP?

Is it possible to change the tuning pin on the Attiny?

Or change the output pin of TinyDebugSerial

MobileWill:
Should this work with the Leonardo running TinyISP?

The pin assignments may need to be adjusted but it can certainly be made to work.

Until you know the software is working correctly, I suggest adding series resistors between the programmer (your Leonardo) and the target (the ATtiny2313). Anything over 125 ohms will work. 1 K ohms seems to be a common choice. The resistors should be added to the three SPI lines (MISO, MOSI, and SCK) as well as the tuning signal (pin 3).

MobileWill:
Is it possible to change the tuning pin on the Attiny?

Yes. The pin assignments are here...
http://code.google.com/p/arduino-tiny/source/browse/TinyTuner2.h?repo=tuner#63

MobileWill:
Or change the output pin of TinyDebugSerial

Yes. That pin assignment is here...
http://code.google.com/p/arduino-tiny/source/browse/cores/tiny/TinyDebugSerial.h#590

Unfortunately, it is by register address (and bit). You can find the register addresses for the PORTs in the datasheet.

Thanks I will try it tomorrow. It was easier to use TinyDebugSerial but uses same PIN as for tuning.

So much for that, ugh. I redesigned the project with the 328p, I will test it when the PCB comes in. In the mean time I decided to try the tuning again. I don't know what happened, but the Leonardo doesn't want to talk to me any more. I can't reload the bootloader or anything. Only thing I can think of, is it was connected when I tried to program the tiny and may have botched the fuses. Idk if I just want to get another one or go through the pain of replacing the IC. I have plenty around here but still a pita. But I guess not too bad since It comes off pretty easy with a hot air gun.

Argh.

That is odd. I have used my Arduino Micro (Leonardo's little brother) as a programmer several times and I often use a Teensy 2.0 (same processor) as a programmer. I have never had any problems.

Does the computer recognize it as a USB device?

Nope, nothing. Both on Windows and OSX. Just solid Leds. Last sketch was TinyISP but I had both connected together but I was programming Attiny directly. Probably what messed it up. I couldn't get it to work with TinyISP and KnockBang stuff.

I have a USBTinyISP programmer and it fails, actually it causes the programmer to not be seen by the system when I connect the Leo till I power cycle it. But then I get the initialization failed.

Oh well, this will be my 2nd lol. First was was a Rev 1 Uno, but that one when poof. Not bad for 3years doing this stuff.

Definitely sounds like it's toast.