Pages: [1]   Go Down
Author Topic: Attiny 4313 Serial Spitting out junk.  (Read 1403 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 [url]http://www.sure-electronics.com/goods.php?id=984[/url.

I have wired it up correctly and written a simple code:
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
Logged

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

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


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


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

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

Thanks for the reply.

I have tried both 1 & 8 MHZ configuration

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

Quote
In my experience, the internal oscillator is fairly easy to tune.
Can you point me to a Tuning guide Guide?

Thanks
« Last Edit: January 28, 2012, 03:10:27 am by dlar » Logged

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

Quote
I have tried both 1 & 8 MHZ configuration

Using the internal oscillator?

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

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

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

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

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


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

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

Quote

Yes i have this core.

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

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

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

Pages: [1]   Go Up
Jump to: