> Most people who work with atmegas strongly
> recommend to use a quartz 
> when it comes to serial communication (even at low
> speed such as 9600
> characters per second). The internal oscillator
> works at 8MHz which is
> cut down to 1MHz and it is known to be very
> unstable.
> 
Hi,
some points I've gathered with serial i/o and terminals with amforth
(I am using XP, usb connectivity, atmega32 @11.0592MHz, atmega1284p
@25Mhz):
1. there are only 2 terminals which work reliable to me - Forfiter
and Mosaic Serial Terminal, the later I am using now.
2. the speeds - I run Mosaic up to 256kbits - absolutely no problem
3. you CANNOT use terminals which do not commit "ok" or each
character, amforth will not work - it will corrupt when writing new
words !!!!
Amforth needs a lot of time (sometimes fraction of seconds) in order
to compile and flash the word - when not commiting 'ok' terminal
will shoot characters to amforth and amforth will loose them!!
therefore you must wait until ready again. There is none handshaking
except this one!
4. amforth is very demanding as the baudrate precision is concerned,
the 8n1 communication can have +/- 4.5% baudrate precision, but
amforth will not compile with such spread. It means in practise
unless you have so called any_baud crystals (e.g. 11.0592 etc.) you
can compile only for specific speeds!!!
5. baudrate - you may change it in amforth session by: Num UBRR0L c!
where Num is the baudrate_constant - you may see the atmega guide
table 17.9-17.10 or you may calculate it for a given resonator or
crystal (!! with known frequency!!). When reset the amforth reverts
to default baudrate burned in.
Finetuning: you may try to change the constant a little bit until
the serial works reliable (do not forget to change the baudrate in
terminal as well when you change to next baudrate step)
6. crystals, resonators, internal RC - you will not have any issues
with standard crystals, but pls mind the 2 capacitors must have a
specific value as well (15-22pf). Be carefull with higher
frequences, crystals higher than 25MHz are so called overtone
crystals, they oscillate on 1/3 of the frequency depicted on its
body.
Resonators easily have 10-20% deviation from depicted frequency, so
it may not work with serial at given baudrate, however you may
measure its frequency and adjust baudrate constant accordingly. The
stability is good for serial. 
Internal RC - the chip makers claim up to 3% precision, so-so
usable, but it is voltage (! the chip voltage - pls mind very good
decoupling caps near the chip Vcc, Avcc) dependand so you may go out
of baudrate easily as well when voltage fluctuates (mind BOD
Brown-out Detector - when enabled (fuses!) a small drop in voltage
causes an reset (2ns impuls can trigger it), also EEPROM and FLASH
WRITE does not work properly when voltage fluctuates). You may
measure the frequency on a pin, then udjust baudrate accordingly,
or, some chips have internal udjustment (register value) for
finetuning (+/- 10%) of the internal frequency. I would recommend
internal oscillator up to 2400baud to be safe.
7. for amforth the finetuned serial communication with appropriate
terminal supporting 'ok' commit is absolutely vital!! It flashes in
its flash directly from serial, there are no large buffers (as far
as I know) with checksums, so any instability means corruption of
data.
8. From my other experience - electronics - the 97% of instabilities
and corruptions in sw area comes from hardware issues - wrong
capacitors, crystals, decoupling, voltage source instability,
interference between PC and development board, grounding, unreliable
sockets, connectors, cables too long, mobile phones laying near the
testbed, statics, etc.etc.)
Pito


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Amforth-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to