Attiny 4313 Serial Spitting out junk.

Hi all,

The Attiny4313 will be reading the output from some Reed Switches, IR Proximity Sensors and then send it to an MRF24J40, Arduino Ethernet which then sends info to a PHP Form-mail Script for emailing out.

I have been trying to get an Attiny4313 to transmit ASCII data using an MRF24J40 Module from Sure Electronics http://www.sure-electronics.com/goods.php?id=984[/url.

I have wired it up correctly and written a simple code:

void setup() {     
  Serial.begin(9600);
}

void loop() {
  Serial.println("test");
  delay(100);
};

The other MRF24J40 Module is connected to a CP2102 USB-TTL module and all i get is junk, However when I upload the code to an arduino (both 168 & 328p) the data is readable. I have checked the Baud Rate on the Attiny4313 (MRF24J40 must be set @ 9600).

I also have a pair of APC200's & APC220's and an old pair of GP-Gc010/CY2196R and will be pulling them out of their homes to test with the Attiny4313 but if i'm getting junk @ 9600 then I don't see how a faster rate of 19200 will make a difference.

I have read somewhere that the internal Oscillators can be inaccurate and may need tuning on the Attiny mcu's.

My questions are: Will an 8 or 16 MHZ Crystal or Resonator to correct this(send data rather than junk)?

Can an Attiny4313 withe this configuration be used with the Arduino IDE?

Thanks in Advance

I have read somewhere that the internal Oscillators can be inaccurate and may need tuning on the Attiny mcu's.

The internal oscillator is ±10% from the factory. Past about ±4.5% typically gives trouble with serial data.

In my experience, the internal oscillator is fairly easy to tune.

Will an 8 or 16 MHZ Crystal or Resonator to correct this(send data rather than junk)?

Maybe. You may want to determine what's actually wrong before tossing random solutions at the problem.

Can an Attiny4313 withe this configuration be used with the Arduino IDE?

I don't understand.

Is the processor configured to run at 1 MHz or 8 MHz?

Thanks for the reply.

I have tried both 1 & 8 MHZ configuration

Maybe. You may want to determine what's actually wrong before tossing random solutions at the problem.

How would I determine what's actually going wrong?

I have tried uploading the sketch to other Attiny4313 and still get the problem.

In my experience, the internal oscillator is fairly easy to tune.

Can you point me to a Tuning guide Guide?

Thanks

I have tried both 1 & 8 MHZ configuration

Using the internal oscillator?

How would I determine what's actually going wrong?

That would be the point of this thread. For you to get assistance determining what's wrong. Which is why I've been asking questions.

Can you point me to a Tuning guide Guide?

A few... http://www.atmel.com/dyn/resources/prod_documents/doc2555.pdf http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=99463 http://forums.adafruit.com/viewtopic.php?t=5078 http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287558192

Using the internal oscillator?

Correct, I have tried both 2313's and 4313's with the same junk being spat out.

I will be looking at the links you posted.

Thanks

Until you have this problem resolved, I suggest running the processors at 8 MHz.

Are you using this core? http://code.google.com/p/arduino-tiny/

Are the results the same at 2400 baud? At 4000 baud?

http://code.google.com/p/arduino-tiny/

Yes i have this core.

Are the results the same at 2400 baud? At 4000 baud?

I will hook up the USB-TTL directly to the processor ad post my results.

Thanks

Problem Solved!!

I was using arduino 0022.

I upgraded to Arduino 1.0 and the Corresponding Core and it works.

I was unaware that there was an update for the Tiny core. the last time i tried to add the core to the 1.0 it threw up errors so i a returned to 0022.

Thanks for the pointers, Now both 4313 & 2313 serial works.